From cb819daab8cc1c0103cd2d1a5cc0de37273fedae Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:50:38 -0400 Subject: [PATCH 001/137] attempted (and failed) at sunken sea fountain --- CalPlayer/CalamityPlayer.cs | 6 ++ .../Furniture/Fountains/SunkenSeaFountain.cs | 30 ++++++ .../Furniture/Fountains/SunkenSeaFountain.png | Bin 0 -> 499 bytes NPCs/CalamityGlobalNPC.cs | 2 + .../Fountains/SunkenSeaFountainTile.cs | 87 ++++++++++++++++++ .../Fountains/SunkenSeaFountainTile.png | Bin 0 -> 3566 bytes .../SunkenSeaFountainTile_Highlight.png | Bin 0 -> 2256 bytes Utilities/CalamityUtils.cs | 27 ++++++ Waters/AbyssWater.cs | 4 +- Waters/AstralWater.cs | 4 +- Waters/SulphuricWater.cs | 5 +- Waters/SunkenSeaWater.cs | 4 +- 12 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs create mode 100644 Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile.png create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4d9aeaa1d2..2abf4401af 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -840,6 +840,10 @@ namespace CalamityMod.CalPlayer public bool tundraFlameBlossom = false; #endregion + #region Fountains + public int fountain = 0; + #endregion + #region Biome public bool ZoneCalamity = false; public bool ZoneAstral = false; @@ -1251,6 +1255,8 @@ namespace CalamityMod.CalPlayer externalColdImmunity = externalHeatImmunity = false; alcoholPoisonLevel = 0; + fountain = 0; + thirdSage = false; if (player.immuneTime <= 0) thirdSageH = false; diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs new file mode 100644 index 0000000000..82099e5799 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class SunkenSeaFountain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunken Water Fountain"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 32; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 0; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png new file mode 100644 index 0000000000000000000000000000000000000000..a4dbce972b480c984785a2992ebfef1bc03dfbc0 GIT binary patch literal 499 zcmVPx$tw}^dR7i=vmc35GP!z|1CD4$fVAQIKCdME!ad&dy4IEsZd<1vj!P&`Y;T0HI zkhp04K#gE%NNHM!avDydxN!Sl+WT>Ce?9r1d#}Y*uH9f(>pN8dem{m03skO^Er9W0 ztor+Y7l6W|pjF5c(u!LFVALNe!n3P$06w4JRNzyqr`mS4WC8fY36KXd5CI%D>uSRG z!JcXh`Jn%$`oB9r$(mr0xR~x3oL90My(q6_DiyyWX&-@rH@zB_Xet0Pu$sRe{dFqXNAb4}hXm zv;YDx0CLzX5?9EV++k9QaRu20A&g+2JPg8x3!BezmL&H@C;qv>3lzEJTGq-h$7#Z3 zLI&x7GEbc4WAUd{qDU&PU>7Wa(AVxTM=Ye`S0POk%AS$lD@dK;$$BeCoyv0U#?n2Z zT(ebsJn&U}#>YzLT_LA)`c%$Ra?d!{{c_(hpX02Gk{qXVn5697U#Tzb}t p-XC9qdAFo1F~7UpD%J#p#DB!)mu^9W{AvII002ovPDHLkV1jIm=aT>c literal 0 HcmV?d00001 diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 12dd74c0b4..6f7de6cd9b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Ammo; using CalamityMod.Items.Dyes; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Ranged; @@ -5603,6 +5604,7 @@ namespace CalamityMod.NPCs if (type == NPCID.WitchDoctor) { + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.Abeemination, CalamityMod.CalamityConfig.SellBossSummons, price: Item.buyPrice(0, 8)); SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), NPC.downedPlantBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.SolarTablet, NPC.downedGolemBoss, Item.buyPrice(0, 25)); diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs new file mode 100644 index 0000000000..0db5f61fd3 --- /dev/null +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class SunkenSeaFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sunken Sea Fountain"); + AddMapEntry(new Color(104, 195, 255), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile tile = Main.tile[i, j]; + Player player = Main.LocalPlayer; + if (player is null) + return; + if (player.active) + { + if (tile.frameX < 54) + { + player.Calamity().fountain = 1; + } + } + } + + public override bool HasSmartInteract() + { + return 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(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 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 AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool NewRightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = ModContent.ItemType(); + } + } +} \ No newline at end of file diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png new file mode 100644 index 0000000000000000000000000000000000000000..e8ceb8d0a192244ef3735d0d93ce65e916306ad7 GIT binary patch literal 3566 zcmcJSXHZk?*2g!XiOLaFniL5jVCWVEK?p@i5ETI_M^H*Y0*JK8fzU+-i9ik_AV|-- z)I&n=Ay^_+5h>D9dJB_OlJ1pnf0u_*8lfk&oevL+zfT}h}aPT z0FGWYF|q`&CIG-CbqE69iRfN@4_>&imMBAj^hsg?3@W^8WMCDPLC>`JlCTwRjhNb4 z*{ZmW$-HEiq|VY%SMd-yqNupeeL_*t`dM+6=P}D%%iI%_GEeXaZc0gR>30g09?MfJ z#Rpr&=BS)dyuo|GTH5T3yr*hH?;ZN3^2!<)2I;GVWV4n-_cE#bQ-U!ulfjx?Ssof9 zU*6Z6yF8(_#t+Bmfj=XG)`*-lewlLt_O{|cy%))fexL+_E9LQB+3mHS@S(d00Qe;1 z?$z&a%OP){28erm&tt<8VwcQq8&izgHS%s|21u>6>Q3OKZa_Qn+0j66ZYOqna+bif zoh6_C$nukdu!sq10LkaLS;bghcnFYwbL3h!Wh&*%$xC;CdReSkgV{BOI{ln>>Sx)b z6Q;t)u}vv?RtCa$yU;j)1ZC}y?$zfQ2-o~h7ZFgVdO#vicT*0uH2COox7e$}{Pmenwln*35LaaT8?5!slbsJc*`(Xj5w@Fvxj)(6PnNf3{h;VrKI$)@ zHKn%q{n#)yAahIs7(RdErn2f7=I!olyY$V_akx9$s##4hna9cV4zm00V3kDnpHl*J z^2Hx=k5ru1#0zZ^k^xKa3FotH#*AiGaR48dkpj3OQNSzz{hA5(J)fyC@P6k`XY>B>8yz7=8WY@GqegUe15K*?hp# zh3He&vd`m&-e4$Uv(b%u{4Mqq`>`yeKz!Z~?sn+MyG$6yu|TX?idU!-H`?PqPC5MY z!qkK8K}gF0BV0IAS8tob^SOFOzFT7MTMYD32g2PUTfTBdj7@0o?3y2@i{JH2c0$S} zIXh}=P6NvJ{q|8zcg&VDQTB1H+PI1}5aE!2q{2KmC*{eGTjkT+_5Sv$+<$hOW;w46 z(fRcN{qwymz%;7B6bMsmTMpmq8qvoMJXkc`Yc3d&@bcE6dL9L6Sd0$#Jn;}w>PjBv zBNzNSPAO+^lVe!+Db|kll*Pf@zZc5W>$&s!&*9G!O;od!@aT%t12YyhILTDfx|&gB zTpAQtaTF<9AFB|1rr#k77e;taee3ZY#bJ5*y5*rfPoq?0y z*%v6j&9|U@`uAg=cr9K+4%IK?fENmBbPSYYdT#aouwt>$l9anzy7X3agc9U7NchGUC5#%a8J;|DpS% z#4!~(ugeTCx&q3Vt7zZXYcH)c70x#3ZicHhq0b4Z>Uo~JZ%Bb*KV@io0l<} zNU3nBp0O#KPs8Wgr^Z^_2tQ(qQK*sv>RFP3szLK~gcf;Q87U*gk~Qr0b~~jmY5nKH zf-`<&QTNBI&thM9eZ1`2cd3jVtU!kBY4!Mie}!|CvC_Fq5rs-!R&RiF5Ou|)tFu;C z^5SzjY7gsS{2QHH-zQohH`0fedslmdbeKjh>EZ)wrX1s4#H>}5UgC<~7>(Op z&#G1LSQgh=9%cH`K>K|2y0fMLd{B$SZORT@^YlpN@m(c;k4DDVs1Dr<3jP@ekZL&k z+qHrre0>e5n1pL8!#d@dli2KSCQOsQTj}w*9-U8esT-aIC)?MPUPexJHC-9nF$%y$ zYug;xX}nJUl|u0a1WVYmmEG;4*RIkJuh+83{#H0Q7X!o!=MA%hedDKDD}8eH+_6wI`LAof4Ev{CJYfpZ_NDlaW=UJcgi58mf#G(cm$YEy)PDS|fp8zHCki~Bw%`qg1oY!VLf#fU`bwB!KkA&sBC!yG|85R5 z-mv&BW(!_SKws)ZS%e9`v#2FZ-lcBrF*RVukK3F2QRP=Henp|&VaB0pRaZchgfEt~31G3F9Mjbg(O#1Dh5)`;%BXINASIuz7tZSPdR5 zR-+G9-tIAo>RB#+^(w;`Fw4-+Mc^%D%LwSdQKJmi&>w-ohu%fvNe}LAxEs16i9+3g z0Qj&*FlPrSn;gfc8x~dXLCfSI@WLQ3P}&oOU)tJnz=J|wa@1YdI|99Rkp4* zZ^1RRj&8$OLgzI1urGlu>Qrka*mQJsm>_I%o3Jk-7b#LZ0Ri=PJwzwIf*pS<+epDB zfgw+RAn;m6CF_lB!oQf+?lMKPrrN753$*qYvw=3pliW@_^H4CKhVCQXu8M;Sv<=nN zdb524Tn*Njlm*+Oo~i>%k%E?JUjGv1#_#+}}8kQC}w3Rlq}pE~j*A4}NyIO}t4Sfwa)B>>mVi zFMznq*YcrUm$u1NZJ@-5`n4BYL_iyXGSuy19YGW9t*LBS#K}DWMhp_zmGd2oq4OI1pg1-VOjP#CJ+WmJ3)O zoDVT@V}Wari)~t{6Av|CAC6PxJQ{ApM(r|IQ#QcaGWxP*Vj3#vIMdD^-hl1pg(vr2kcXEU%jsBQpxhIBrQg)2^l*_La^7Kj46?#%4w&L#L?!1C7q>W&i*H literal 0 HcmV?d00001 diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..5866fcb8b8fa8491955c08b71ae70007ef9463ae GIT binary patch literal 2256 zcmeH}ZB)`%9LF&Uf|Ns=^P!kjXwIB-O)Et}noiU*C`&6z%~Q^_OiW27G)+TIG}E*) zq||9Kq0KUbj82*V=`z&vAq(+|DXHL7Dl1`s_i*-d@Aj&D?m73qx#xa=_xJsN&ds9w zdmAIIkPryO*oWe|8(b+6hyiv54BVL$TpA&e6~#WDcc^%3YTYs1bM@$`wMA8G)-=$jileeTY z>hPv02fQ5f9UGE}7P-k=`{?@M zn5{g#-6g;9MA&lG}zj*d2fSMhNZ0TNJTpBScAqL`qFz| zCr{c-tlTKYuQ17Q<}WjP34>;BuTwljrnq8~=~l;`EouM^?z55UmEVNv&ztoh7yqp3 z-K&!)PKSncX3#4Ek{^?5ThKIZl;+MZ-;}D@!(f6EUl-*RWk+>cOE)|RnquKU6P6nQb#VG zx(CnD-@VF8RIcFgrjGeM3eLk*^0#6QO`zg;J;|~06PjL(s)gm7vNdH+G@Y1pWOrn= z2ZHjs)sm=@IO^4u==z!9vDJhF;6W-KWyhlq-QYCJm+I%)R%>TfwMI@<0Nj`QEHI+e{~(nw|-;V)v__f&O+iz@IGwD=Tyct2u* z^dm1f&l(XiwkCH7m3Devamq&e@bO)>gSD7Trpj&hkMMS;vpvu*G^fF$`|4!2N@rWA(kSVLr_!2nL7;!CvF3nSHTvMUGiF} z)jdG8$$KcTchC8yUKd87+2h)vtdj5x?E5(VyQH^dNnn?DNB{n1wamPBdvT&TVR+sW zG=mk@AT!c1tx=#H?UNo9wN%XxGvVZ$`LKZ0u-;TG?Uy-8(7;z!;Ud5CTv+-0`t-)Z zV0M`8_#!DA*>+#0v@D!=P&|Eze5Foe!CHlWmxA?&rv{tk<$4tj?n-e?te($stJBJra z^P^At^ySr%GuICB$ceIP!gGPggb;{m8}|i#pSg_XDOUX!K2)C`NFK literal 0 HcmV?d00001 diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 70f7fe3459..7ec060b2b4 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -2138,6 +2138,33 @@ namespace CalamityMod // All work benches count as tables. mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); } + + /// + /// Extension which initializes a ModTile to be a fountain. + /// + /// The ModTile which is being initialized. + internal static void SetUpFountain(this ModTile mt) + { + //All fountains are immune to lava + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = false; + Main.tileWaterDeath[mt.Type] = false; + //TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + //TileObjectData.newTile.Width = 2; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(mt.Type); + TileID.Sets.HasOutlines[mt.Type] = true; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addTile(mt.Type); + } #endregion #endregion diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index acf70e4ef8..d20ca43865 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneAbyss; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneAbyss && modPlayer.fountain == 0) || modPlayer.fountain == 2; } public override int ChooseWaterfallStyle() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 61c8de3d82..ab7c1b88bc 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneAstral; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneAstral && modPlayer.fountain == 0) || modPlayer.fountain == 4; } public override int ChooseWaterfallStyle() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 1c0a59d613..144eebd262 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -32,7 +33,9 @@ namespace CalamityMod.Waters bool inYZone = Main.LocalPlayer.Center.Y < Main.rockLayer * 16f - 320 && Main.LocalPlayer.Center.Y >= 5800f; - return (inXZone && inYZone) || Main.LocalPlayer.Calamity().ZoneSulphur; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + bool greenWater = (inXZone && inYZone) || modPlayer.ZoneSulphur; + return (greenWater && modPlayer.fountain == 0) || modPlayer.fountain == 3; } public override int ChooseWaterfallStyle() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 16f9e35348..4bb6903bf0 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneSunkenSea; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneSunkenSea && modPlayer.fountain == 0) || modPlayer.fountain == 1; } public override int ChooseWaterfallStyle() From 632e869448fe0d466e5eba9492ef0a40bd6bd0b4 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 26 Apr 2020 00:45:09 -0500 Subject: [PATCH 002/137] Boss Rush no longer disables mounts. Forbidden Oathblade line projectile piercing tweaks. Multiple refactors. Skeletron Prime defense scales with number of arms remaining and all arms explode when the head reaches phase 2. Gatling Laser sound bug fix. Yharon and Birb tornado/aura spawner projectiles last longer so they can actually reach their max velocity. --- CalPlayer/CalamityPlayerLifeRegen.cs | 2 +- Items/SummonItems/BossRush.cs | 2 +- Items/Weapons/Melee/DevilsDevastation.cs | 7 +- Items/Weapons/Melee/ForbiddenOathblade.cs | 2 +- Items/Weapons/Melee/TrueForbiddenOathblade.cs | 5 +- NPCs/CalamityAI.cs | 395 ++++++----- NPCs/CalamityGlobalAI.cs | 624 +++++++++--------- NPCs/CalamityGlobalNPC.cs | 5 - NPCs/Yharon/Yharon.cs | 38 +- Projectiles/Boss/BigFlare.cs | 2 +- Projectiles/Boss/BigFlare2.cs | 2 +- Projectiles/Boss/BirbAuraFlare.cs | 2 +- Projectiles/Boss/BrimstoneRay.cs | 2 + Projectiles/Boss/BrimstoneTargetRay.cs | 2 + Projectiles/Boss/DarkOrb.cs | 371 ++++++++--- .../DraedonsArsenal/GatlingLaserProj.cs | 19 +- .../Melee/ForbiddenOathbladeProjectile.cs | 53 ++ .../Melee/ForbiddenOathbladeProjectile.png | Bin 0 -> 792 bytes Projectiles/Melee/Oathblade.cs | 6 +- Tiles/CalamityGlobalTile.cs | 10 +- 20 files changed, 941 insertions(+), 608 deletions(-) create mode 100644 Projectiles/Melee/ForbiddenOathbladeProjectile.cs create mode 100644 Projectiles/Melee/ForbiddenOathbladeProjectile.png diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 317d93e20a..0e224c85a1 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -533,7 +533,7 @@ namespace CalamityMod.CalPlayer } } - if (modPlayer.weakPetrification || CalamityWorld.bossRushActive) + if (modPlayer.weakPetrification) { if (player.mount.Active) player.mount.Dismount(player); diff --git a/Items/SummonItems/BossRush.cs b/Items/SummonItems/BossRush.cs index 12caa05aa5..21c2f2b616 100644 --- a/Items/SummonItems/BossRush.cs +++ b/Items/SummonItems/BossRush.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.SummonItems 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, wired devices, and mounts will be disabled"); + "During the Boss Rush, all wires and wired devices will be disabled"); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 6f8066883e..91d5a5d742 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -41,12 +41,13 @@ namespace CalamityMod.Items.Weapons.Melee 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 j = -8; j <= 8; j += 8) + int index = 8; + for (int j = -index; j <= index; j += index) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(j)); - 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; + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); } + 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/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 2dbd3a7f1a..5bdae7c940 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 76; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index b420bf771e..d303f9216a 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -31,13 +31,14 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 78; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } 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 = -8; i <= 8; i += 8) + int index = 8; + for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index d51f9cdceb..66afe2e74d 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,4 +1,3 @@ -using CalamityMod; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; @@ -19,7 +18,6 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; namespace CalamityMod.NPCs { @@ -3827,7 +3825,7 @@ namespace CalamityMod.NPCs npc.timeLeft = 1800; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; @@ -4032,7 +4030,7 @@ namespace CalamityMod.NPCs if (phase2) { Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } else if (NPC.CountNPCS(ModContent.NPCType()) < num1305) @@ -4045,7 +4043,7 @@ namespace CalamityMod.NPCs featherAmt *= 2; for (int num186 = 0; num186 < featherAmt; num186++) { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -4218,14 +4216,14 @@ namespace CalamityMod.NPCs npc.ai[0] = 3.2f; npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; + npc.ai[1] = npc.direction; } } // Charge else if (npc.ai[0] == 3.2f) { - npc.damage = (int)((double)npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.5); npc.collideX = false; npc.collideY = false; @@ -4280,14 +4278,14 @@ namespace CalamityMod.NPCs if (!WorldGen.SolidTile(num1313, num1314)) { - while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) + while (!WorldGen.SolidTile(num1313, num1314) && num1314 < Main.worldSurface) num1314++; - if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 1200f) + if ((new Vector2(num1313 * 16 + 8, num1314 * 16 + 8) - player.Center).Length() < 1200f) { npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1313; - npc.ai[2] = (float)num1314; + npc.ai[1] = num1313; + npc.ai[2] = num1314; break; } } @@ -4313,8 +4311,8 @@ namespace CalamityMod.NPCs int num1317 = (int)npc.ai[1]; int num1318 = (int)npc.ai[2]; - float x2 = (float)(num1317 * 16 + 8); - float y2 = (float)(num1318 * 16 - 20); + float x2 = num1317 * 16 + 8; + float y2 = num1318 * 16 - 20; Vector2 vector207 = new Vector2(x2, y2); vector207 -= npc.Center; @@ -4341,8 +4339,8 @@ namespace CalamityMod.NPCs int num1321 = (int)npc.ai[1]; int num1322 = (int)npc.ai[2]; - float x3 = (float)(num1321 * 16 + 8); - float y3 = (float)(num1322 * 16 - 20); + float x3 = num1321 * 16 + 8; + float y3 = num1322 * 16 - 20; Vector2 vector208 = new Vector2(x3, y3); vector208 -= npc.Center; @@ -4354,10 +4352,10 @@ namespace CalamityMod.NPCs { int num1325 = 10; if (Main.expertMode) - num1325 = (int)((double)num1325 * 0.75); + num1325 = (int)(num1325 * 0.75); npc.ai[3] += 1f; - if (npc.ai[3] == (float)num1325) + if (npc.ai[3] == num1325) { SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsySummon, (int)npc.position.X, (int)npc.position.Y); if (sound != null) @@ -4367,7 +4365,7 @@ namespace CalamityMod.NPCs NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - else if (npc.ai[3] == (float)(num1325 * 2)) + else if (npc.ai[3] == num1325 * 2) { npc.TargetClosest(true); npc.ai[0] = 0f; @@ -4406,8 +4404,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; - Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, phase3 ? 1f : 0f, (float)(npc.target + 1)); + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; + Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, phase3 ? 1f : 0f, npc.target + 1); } } @@ -4431,8 +4429,8 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.7 : 0.5) || death; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * (death ? 0.5 : (revenge ? 0.35 : 0.2)) && expertMode; + bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.7 : 0.5) || death; + bool phase3 = npc.life <= npc.lifeMax * (death ? 0.5 : (revenge ? 0.35 : 0.2)) && expertMode; bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -4457,11 +4455,11 @@ namespace CalamityMod.NPCs npc.defense = calamityGlobalNPC.newAI[1] == 1f ? npc.defDefense / 4 : npc.defDefense; if (phase3AI) { - npc.damage = (int)((float)npc.defDamage * 1.32f); + npc.damage = (int)(npc.defDamage * 1.32f); } else if (phase2AI) { - npc.damage = (int)((float)npc.defDamage * 1.44f); + npc.damage = (int)(npc.defDamage * 1.44f); } else { @@ -4535,7 +4533,7 @@ namespace CalamityMod.NPCs int num12 = 30; int num13 = 120; int num14 = 24; - float spinTime = (float)(num13 / 2); + float spinTime = num13 / 2; float scaleFactor3 = 9f; float scaleFactor4 = 22f; float num15 = MathHelper.TwoPi / spinTime; @@ -4579,8 +4577,8 @@ namespace CalamityMod.NPCs // Enrage variable bool enrage = !CalamityWorld.bossRushActive && - (player.position.Y < 300f || (double)player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7200f && player.position.X < (float)(Main.maxTilesX * 16 - 7200))); + (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7200f && player.position.X < (Main.maxTilesX * 16 - 7200))); // If the player isn't in the ocean biome or Old Duke is transitioning between phases, become immune if (!phase3AI) @@ -4610,7 +4608,7 @@ namespace CalamityMod.NPCs } // Rotation - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (npc.spriteDirection == 1) num17 += pie; if (num17 < 0f) @@ -4704,12 +4702,12 @@ namespace CalamityMod.NPCs } // Spawn dust and play sound - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == num9 - 30) { int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * MathHelper.TwoPi / (float)num20), default) + npc.Center; + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + npc.Center; Vector2 vector2 = dust - npc.Center; int num21 = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); Main.dust[num21].noGravity = true; @@ -4721,7 +4719,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) + if (npc.ai[2] >= num16) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -4735,7 +4733,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(500 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; if (npc.velocity.X < vector3.X) @@ -4782,7 +4780,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) { npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2 || (phase2 && !phase2AI)) + if (npc.ai[2] >= num2 || (phase2 && !phase2AI)) { int num23 = 0; switch ((int)npc.ai[3]) @@ -4818,7 +4816,7 @@ namespace CalamityMod.NPCs // Velocity Vector2 distanceVector = player.Center + player.velocity * 20f - vector; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num22 != 0) @@ -4871,8 +4869,8 @@ namespace CalamityMod.NPCs 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)) * (double)pie / (double)(float)num24, default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * pie / num24) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; @@ -4881,7 +4879,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 0f; @@ -4897,7 +4895,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(500 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor2; if (npc.velocity.X < vector5.X) @@ -4929,14 +4927,14 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % (float)num7 == 0f) + if (npc.ai[2] % num7 == 0f) { if (npc.ai[2] % 40f == 0f && npc.ai[2] != 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (float)(npc.width + 20) / 2f + vector; + Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); } } @@ -4952,7 +4950,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num6) + if (npc.ai[2] >= num6) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 0f; @@ -4970,21 +4968,21 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn sharks - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == num9 - 30) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] >= (float)(num9 - 90)) + if (npc.ai[2] >= num9 - 90) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 100f; - NPC.NewNPC((int)(vector.X + 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); - NPC.NewNPC((int)(vector.X - 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X + 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X - 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) + if (npc.ai[2] >= num9) { calamityGlobalNPC.newAI[0] += 30f; calamityGlobalNPC.newAI[2] = 0f; @@ -5003,10 +5001,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == (float)(num10 - 60)) + if (npc.ai[2] == num10 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] >= (float)(num10 - 60)) + if (npc.ai[2] >= num10 - 60) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { @@ -5017,7 +5015,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num10) + if (npc.ai[2] >= num10) { calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -5035,7 +5033,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(500 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; if (npc.velocity.X < vector8.X) @@ -5082,7 +5080,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) { npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2 || (phase3 && !phase3AI)) + if (npc.ai[2] >= num2 || (phase3 && !phase3AI)) { int num28 = 0; switch ((int)npc.ai[3]) @@ -5116,7 +5114,7 @@ namespace CalamityMod.NPCs // Velocity and rotation Vector2 distanceVector = player.Center + player.velocity * 20f - vector; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num27 != 0) @@ -5135,7 +5133,7 @@ namespace CalamityMod.NPCs { // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num27 != 0) @@ -5183,8 +5181,8 @@ namespace CalamityMod.NPCs 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)) * (double)pie / (double)(float)num29, default) + vector; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * pie / num29) + vector; + Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); Main.dust[num30].noGravity = true; Main.dust[num30].noLight = true; @@ -5193,7 +5191,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 5f; @@ -5213,35 +5211,35 @@ namespace CalamityMod.NPCs Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); int damage = expertMode ? 100 : 140; - Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -(float)npc.direction) * spinTime / MathHelper.TwoPi; + Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vortexSpawn.X, vortexSpawn.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); } } - if (npc.ai[2] % (float)num14 == 0f) + if (npc.ai[2] % num14 == 0f) { if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType(), 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].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = (float)Main.rand.Next(30, 181); + Main.npc[num31].ai[3] = Main.rand.Next(30, 181); } } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default); - npc.rotation -= num15 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); + npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) + if (npc.ai[2] >= num13) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 5f; @@ -5259,36 +5257,36 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == num9 - 30) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; int damage = expertMode ? 55 : 70; for (int i = 0; i < 20; i++) { - float velocityX = (float)(npc.direction * 6) * (Main.rand.NextFloat() + 0.5f); + float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); float velocityY = 8f * (Main.rand.NextFloat() + 0.5f); Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } - if (npc.ai[2] >= (float)(num9 - 90)) + if (npc.ai[2] >= num9 - 90) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 100f; float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC((int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); - NPC.NewNPC((int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) + if (npc.ai[2] >= num9) { calamityGlobalNPC.newAI[0] += 30f; calamityGlobalNPC.newAI[2] = 0f; @@ -5307,10 +5305,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == (float)(num11 - 60)) + if (npc.ai[2] == num11 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] >= (float)(num11 - 60)) + if (npc.ai[2] >= num11 - 60) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { @@ -5321,7 +5319,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) + if (npc.ai[2] >= num11) { calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -5344,7 +5342,7 @@ namespace CalamityMod.NPCs // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = (float)(540 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 540 * Math.Sign((vector - player.Center).X); Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; npc.SimpleFlyMovement(desiredVelocity, num3); @@ -5372,7 +5370,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f) { npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + if (npc.ai[2] >= num2) { int num33 = 0; switch ((int)npc.ai[3]) @@ -5409,7 +5407,7 @@ namespace CalamityMod.NPCs // Velocity and rotation Vector2 distanceVector = player.Center + player.velocity * 20f - vector; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num32 != 0) @@ -5443,7 +5441,7 @@ namespace CalamityMod.NPCs { // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num32 != 0) @@ -5476,8 +5474,8 @@ namespace CalamityMod.NPCs 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)) * (double)pie / (double)(float)num34, default) + vector; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * pie / num34) + vector; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); Main.dust[num35].noGravity = true; Main.dust[num35].noLight = true; @@ -5486,7 +5484,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 10f; @@ -5503,7 +5501,7 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; // Alpha - if (npc.alpha < 255 && npc.ai[2] >= (float)num12 - 15f) + if (npc.alpha < 255 && npc.ai[2] >= num12 - 15f) { npc.alpha += 17; if (npc.alpha > 255) @@ -5515,14 +5513,14 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == (float)(num12 / 2)) + if (npc.ai[2] == num12 / 2) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num12 / 2)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) { // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = (float)(480 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 480 * Math.Sign((vector - player.Center).X); // Rotation and direction Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); @@ -5547,7 +5545,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) + if (npc.ai[2] >= num12) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -5571,36 +5569,36 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == num9 - 30) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; int damage = expertMode ? 55 : 70; for (int i = 0; i < 20; i++) { - float velocityX = (float)(npc.direction * 6) * (Main.rand.NextFloat() + 0.5f); + float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); float velocityY = 8f * (Main.rand.NextFloat() + 0.5f); Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } - if (npc.ai[2] >= (float)(num9 - 90)) + if (npc.ai[2] >= num9 - 90) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 150f; float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC((int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); - NPC.NewNPC((int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, (float)npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC((int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) + if (npc.ai[2] >= num9) { calamityGlobalNPC.newAI[0] += 30f; calamityGlobalNPC.newAI[2] = 0f; @@ -5620,14 +5618,14 @@ namespace CalamityMod.NPCs Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); int damage = expertMode ? 100 : 140; - Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -(float)npc.direction) * spinTime / MathHelper.TwoPi; + Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(vortexSpawn.X, vortexSpawn.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); } } - if (npc.ai[2] % (float)num14 == 0f) + if (npc.ai[2] % num14 == 0f) { if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeVomit"), (int)npc.position.X, (int)npc.position.Y); @@ -5637,18 +5635,18 @@ namespace CalamityMod.NPCs Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType(), 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].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = (float)Main.rand.Next(30, 361); + Main.npc[num31].ai[3] = Main.rand.Next(30, 361); } } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default); - npc.rotation -= num15 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); + npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) + if (npc.ai[2] >= num13) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 10f; @@ -5669,9 +5667,6 @@ namespace CalamityMod.NPCs // Used for Brimling AI states CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.2f, 0f, 0f); - // Center Vector2 vectorCenter = npc.Center; @@ -5718,8 +5713,11 @@ namespace CalamityMod.NPCs // Reset defense npc.defense = npc.defDefense; + // Hide the sprite + npc.alpha = 255; + // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Variables for buffing the AI bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; @@ -5729,20 +5727,6 @@ namespace CalamityMod.NPCs bool calamity = modPlayer.ZoneCalamity; bool phase2 = (lifeRatio < 0.5f && revenge) || death; - // Emit dust - int dustAmt = 1; - int size = 35; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(vectorCenter - 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; - } - } - // Speed while moving in phase 1 float speed = expertMode ? 5f : 4.5f; if (CalamityWorld.bossRushActive) @@ -5756,11 +5740,11 @@ namespace CalamityMod.NPCs float speedBoost = death ? 2f : 2f * (1f - lifeRatio); speed += speedBoost; - // Variables for target location relative to npc location + int damage = expertMode ? 125 : 200; float radialOffset = 32f; float xDistance = player.Center.X - vectorCenter.X; float yDistance = player.Center.Y - vectorCenter.Y; - float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); + float totalDistance = (float)Math.Sqrt(xDistance * xDistance + yDistance * yDistance); // Static movement towards target if (npc.ai[0] == 5f) @@ -5789,17 +5773,18 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; bool shootProjectile = false; - if (npc.ai[1] % 6f == 5f) + float fireRate = 60f; + if (npc.ai[1] % fireRate == fireRate - 1f) shootProjectile = true; if (shootProjectile) { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num742 = 6f; - float num743 = player.position.X + (float)player.width * 0.5f - vectorCenter.X; - float num744 = player.position.Y + (float)player.height * 0.5f - vectorCenter.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + float num742 = 16f; + float num743 = player.position.X + player.width * 0.5f - vectorCenter.X; + float num744 = player.position.Y + player.height * 0.5f - vectorCenter.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -5808,24 +5793,30 @@ namespace CalamityMod.NPCs vectorCenter.X += num743 * 3f; vectorCenter.Y += num744 * 3f; - int damage = expertMode ? 25 : 30; + float radians = MathHelper.TwoPi / 3f; - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num743, num744, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 3f, 0f); - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num743, num744, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 4f, 0f); + for (int i = 0; i < 3; i++) + { + Vector2 vector = new Vector2(0f, -3f).RotatedBy(radians * i); + int proj = Projectile.NewProjectile(vectorCenter, vector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 8f, 0f); + Main.projectile[proj].scale = 4f; + } + + //Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num743, num744, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 4f, 0f); 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 deltaAngle = rotation / numProj; double offsetAngle; - /*for (int i = 0; i < numProj; i++) + for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 5f, 0f); - }*/ + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 10f, 0f); + } } } @@ -5834,7 +5825,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - 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; @@ -5844,22 +5835,22 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - 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; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 150f) //100 + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 150f) //100 { if (npc.velocity.X > 0f) npc.velocity.X *= 0.985f; - 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; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 150f) //100 + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 150f) //100 { if (npc.velocity.X < 0f) npc.velocity.X *= 0.985f; @@ -5890,60 +5881,122 @@ namespace CalamityMod.NPCs { npc.localAI[0] += 1f; - if (npc.localAI[0] % 120f == 0f) + float projectileSpeed = revenge ? 8f : 6f; + if (CalamityWorld.bossRushActive) + projectileSpeed = 12f; + + Vector2 targetVector = player.Center - vectorCenter; + float offsetAngle = 0f; + int totalProjectiles = 0; + int chains = 0; + + // Arcs + /*if (npc.localAI[0] % 60f == 0f) { - float projectileSpeed = revenge ? 8f : 6f; - if (CalamityWorld.bossRushActive) - projectileSpeed = 12f; + radialOffset = 0.1f; + float diameter = 120f; - Vector2 targetVector = player.Center - vectorCenter; - targetVector.Y -= Math.Abs(targetVector.X) * 0.1f; + targetVector.Y -= Math.Abs(targetVector.X) * radialOffset; targetVector = Vector2.Normalize(targetVector) * projectileSpeed; - npc.netUpdate = true; - - int damage = expertMode ? 25 : 30; - - // Can be used to create a large circle of projectiles fired at the target - float offsetAngle = (float)Math.PI * 0.1f; - int totalProjectiles = 10; - Vector2 velocity = targetVector; velocity.Normalize(); - velocity *= 180f; + velocity *= diameter; - // Arcs - /*for (int j = 0; j < totalProjectiles; j++) + totalProjectiles = 8; + offsetAngle = (float)Math.PI * radialOffset; + + for (int j = 0; j < totalProjectiles; j++) { - float num120 = (float)j - ((float)totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy((double)(offsetAngle * num120), default); - int proj = Projectile.NewProjectile(vectorCenter + offset, targetVector, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, -1f, 0f); - }*/ + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians, default); + int proj = Projectile.NewProjectile(vectorCenter + offset, targetVector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 11, 0f); + } + } - totalProjectiles = 18; - int offsetAngle2 = 360 / totalProjectiles; + if (npc.localAI[0] % 120f == 0f) + { + totalProjectiles = 24; + offsetAngle = 360 / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { - //Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, (float)(i * offsetAngle2)); - Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 12f, (float)(i * offsetAngle2)); + Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 15f, i * offsetAngle); + } + + totalProjectiles = 16; + chains = 4; + float velocityTimer = 90f / (totalProjectiles / chains); + double radians = MathHelper.TwoPi / totalProjectiles; + int j = 0; + + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector = new Vector2(0f, -3f).RotatedBy(radians * i, default); + Projectile.NewProjectile(vectorCenter, vector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 16f, j * velocityTimer); + + j++; + if (j % 4 == 0) + j = 0; + } + } + + totalProjectiles = 36; + float divisor = 6f; + chains = 3; + float interval = totalProjectiles / chains * divisor; + double patternInterval = Math.Floor(npc.localAI[0] / interval); + + if (patternInterval % 2 == 0) + { + if (npc.localAI[0] % divisor == 0f) + { + double radians = (patternInterval % 4 == 0 ? MathHelper.TwoPi + MathHelper.Pi / 3 : MathHelper.TwoPi) / chains; + radialOffset = MathHelper.ToRadians(npc.ai[2]); + + for (int i = 0; i < chains; i++) + { + Vector2 vector = new Vector2(0f, -3f).RotatedBy(radians * i + radialOffset, default); + Projectile.NewProjectile(vectorCenter, vector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 3f, 0f); + } + + // Radial offset + npc.ai[2] += 5f; + } + } + else + npc.ai[2] = 0f;*/ + + if (npc.localAI[0] % 180f == 0f) + { + totalProjectiles = 12; + offsetAngle = 360 / totalProjectiles; + + for (int i = 0; i < totalProjectiles; i++) + { + Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, i * offsetAngle); + //Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, Main.rand.Next(12, 14), i * offsetAngle); } } } - npc.velocity *= 0.95f; + if (npc.velocity.Length() > 0f) + npc.velocity = Vector2.Zero; + npc.rotation = npc.velocity.X * 0.04f; + float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= 600f) { npc.TargetClosest(true); npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.localAI[0] = 0f; npc.netUpdate = true; } } @@ -6016,15 +6069,15 @@ namespace CalamityMod.NPCs int totalProjectiles = 4; float spread = MathHelper.ToRadians(90); // 30 degrees in radians = 0.523599 double startAngle = Math.Atan2(laserVelocity2.X, laserVelocity2.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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; int i; for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + radialOffset * i; - Projectile.NewProjectile(source.X, source.Y, (float)(Math.Sin(offsetAngle)), (float)(Math.Cos(offsetAngle)), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); - Projectile.NewProjectile(source.X, source.Y, (float)(-Math.Sin(offsetAngle)), (float)(-Math.Cos(offsetAngle)), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); + Projectile.NewProjectile(source.X, source.Y, (float)Math.Sin(offsetAngle), (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 1f, npc.whoAmI); + Projectile.NewProjectile(source.X, source.Y, (float)-Math.Sin(offsetAngle), (float)-Math.Cos(offsetAngle), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 1f, npc.whoAmI); } } } @@ -6056,7 +6109,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) { - Projectile.NewProjectile(source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + Projectile.NewProjectile(source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); calamityGlobalNPC.newAI[0] = 1f; } else @@ -6072,15 +6125,15 @@ namespace CalamityMod.NPCs int totalProjectiles = 4; float spread = MathHelper.ToRadians(90); // 30 degrees in radians = 0.523599 double startAngle = Math.Atan2(laserVelocity2.X, laserVelocity2.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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; int i; for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + radialOffset * i; - Projectile.NewProjectile(source.X, source.Y, (float)(Math.Sin(offsetAngle)), (float)(Math.Cos(offsetAngle)), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); - Projectile.NewProjectile(source.X, source.Y, (float)(-Math.Sin(offsetAngle)), (float)(-Math.Cos(offsetAngle)), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); + Projectile.NewProjectile(source.X, source.Y, (float)Math.Sin(offsetAngle), (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + Projectile.NewProjectile(source.X, source.Y, (float)-Math.Sin(offsetAngle), (float)-Math.Cos(offsetAngle), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); } } } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 1596da8475..a42d5acc0c 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -6298,28 +6298,28 @@ namespace CalamityMod.NPCs 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); + int arm = NPC.NewNPC((int)(npc.position.X + (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].ai[1] = 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); + arm = NPC.NewNPC((int)(npc.position.X + (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].ai[1] = 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); + arm = NPC.NewNPC((int)(npc.position.X + (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].ai[1] = 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); + arm = NPC.NewNPC((int)(npc.position.X + (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].ai[1] = npc.whoAmI; Main.npc[arm].target = npc.target; Main.npc[arm].netUpdate = true; Main.npc[arm].ai[3] = 150f; @@ -6353,20 +6353,46 @@ namespace CalamityMod.NPCs 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; + // Set stats + if (npc.ai[1] == 5f) + npc.damage = 0; + else if (allArmsDead) + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + else + { + npc.defense = npc.defDefense + (cannonAlive ? 8 : 0) + (laserAlive ? 8 : 0) + (viceAlive ? 8 : 0) + (sawAlive ? 8 : 0); + } // Phases - bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.66 || (death && allArmsDead); - bool phase3 = (double)npc.life < (double)npc.lifeMax * 0.33 || (death && allArmsDead); + bool phase2 = npc.life < npc.lifeMax * 0.66 || (death && allArmsDead); + bool phase3 = npc.life < npc.lifeMax * 0.33 || (death && allArmsDead); + + // Kill all arms if Prime Head enters phase 2 + if (phase2 && !allArmsDead) + { + if (Main.npc[CalamityGlobalNPC.primeCannon].active) + KillNPC(Main.npc[CalamityGlobalNPC.primeCannon]); + + if (Main.npc[CalamityGlobalNPC.primeLaser].active) + KillNPC(Main.npc[CalamityGlobalNPC.primeLaser]); + + if (Main.npc[CalamityGlobalNPC.primeVice].active) + KillNPC(Main.npc[CalamityGlobalNPC.primeVice]); + + if (Main.npc[CalamityGlobalNPC.primeSaw].active) + KillNPC(Main.npc[CalamityGlobalNPC.primeSaw]); + + void KillNPC(NPC npc2) + { + npc2.life = -1; + npc2.HitEffect(0, 10.0); + npc2.active = false; + npc2.netUpdate = true; + } + } // 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) @@ -6434,11 +6460,11 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= 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); + Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; int damage = 31; @@ -6531,7 +6557,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + 150f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -6541,7 +6567,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 7f) npc.velocity.X = 7f; } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 150f) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 150f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -6567,11 +6593,11 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= 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); + Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; int damage = 31; @@ -6604,11 +6630,11 @@ namespace CalamityMod.NPCs 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)); + npc.rotation += npc.direction * 0.3f; + Vector2 vector48 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num455 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector48.X; + float num456 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector48.Y; + float num457 = (float)Math.Sqrt(num455 * num455 + num456 * num456); float speed = CalamityWorld.bossRushActive ? 7f : 3f; if (phase2 || CalamityWorld.bossRushActive) @@ -6620,8 +6646,8 @@ namespace CalamityMod.NPCs 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)); + float speedBuff = 3f + (3f * (1f - npc.life / npc.lifeMax)); + float speedBuff2 = 8f + (8f * (1f - npc.life / npc.lifeMax)); speed += num457 / 100f; if (speed < speedBuff) @@ -6640,12 +6666,12 @@ namespace CalamityMod.NPCs npc.damage = 1000; npc.defense = 9999; - npc.rotation += (float)npc.direction * 0.3f; + npc.rotation += 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)); + Vector2 vector49 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num458 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector49.X; + float num459 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector49.Y; + float num460 = (float)Math.Sqrt(num458 * num458 + num459 * num459); float num461 = 10f; num461 += num460 / 100f; @@ -6668,14 +6694,14 @@ namespace CalamityMod.NPCs 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)); + float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt(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); + Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); value.Normalize(); value *= num159; value += npc.velocity; @@ -6725,7 +6751,7 @@ namespace CalamityMod.NPCs else if (Main.player[npc.target].velocity.X < 0f) calamityGlobalNPC.newAI[0] = -1f; else - calamityGlobalNPC.newAI[0] = (float)Main.player[npc.target].direction; + calamityGlobalNPC.newAI[0] = Main.player[npc.target].direction; // Set spin velocity npc.velocity.X = 3.14159265f * npc.ai[3] / spinVelocity; @@ -6751,14 +6777,14 @@ namespace CalamityMod.NPCs { 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)); + float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt(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); + Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); value.Normalize(); value *= num159; num160 = value.X; @@ -6808,7 +6834,7 @@ namespace CalamityMod.NPCs 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)); + float distance = (float)Math.Sqrt(posX * posX + posY * posY); if (distance < 20f) { posX = npc.velocity.X; @@ -6970,7 +6996,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -2.5f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -6980,7 +7006,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 7f) npc.velocity.X = 7f; } - 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -6992,11 +7018,11 @@ namespace CalamityMod.NPCs } 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; + Vector2 vector62 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X; + float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y; + float num508 = (float)Math.Sqrt(num506 * num506 + num507 * num507); + npc.rotation = (float)Math.Atan2(num507, num506) - 1.57f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7050,10 +7076,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 350f - vector63.X; + float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120f - vector63.Y; // Used to be 20f + float num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); num515 = (CalamityWorld.bossRushActive ? 10f : 7f) / num515; num513 *= num515; num514 *= num515; @@ -7084,11 +7110,11 @@ namespace CalamityMod.NPCs } 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; + vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; + num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; + num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); + npc.rotation = (float)Math.Atan2(num514, num513) - 1.57f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7104,11 +7130,11 @@ namespace CalamityMod.NPCs 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); + Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; int damage = 31; @@ -7252,7 +7278,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -2.5f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -7262,7 +7288,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 7f) npc.velocity.X = 7f; } - 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -7273,11 +7299,11 @@ namespace CalamityMod.NPCs npc.velocity.X = -7f; } - 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; + Vector2 vector60 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num492 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector60.X; + float num493 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector60.Y; + float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); + npc.rotation = (float)Math.Atan2(num493, num492) - 1.57f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7310,11 +7336,11 @@ namespace CalamityMod.NPCs 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; + Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num499 = Main.npc[(int)npc.ai[1]].position.X + (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)); + num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 80f - vector61.Y; + float num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); num501 = (CalamityWorld.bossRushActive ? 10f : 7f) / num501; num499 *= num501; num500 *= num501; @@ -7345,11 +7371,11 @@ namespace CalamityMod.NPCs } 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; + vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; + num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; + num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); + npc.rotation = (float)Math.Atan2(num500, num499) - 1.57f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7396,10 +7422,10 @@ namespace CalamityMod.NPCs 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; + Vector2 vector55 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num477 = Main.npc[(int)npc.ai[1]].position.X + (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)); + float num479 = (float)Math.Sqrt(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) @@ -7468,7 +7494,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -7f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -7478,7 +7504,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 10f) npc.velocity.X = 10f; } - 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -7537,7 +7563,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -2.5f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 250f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.94f; @@ -7547,7 +7573,7 @@ namespace CalamityMod.NPCs 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)) + if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.94f; @@ -7558,11 +7584,11 @@ namespace CalamityMod.NPCs npc.velocity.X = -7f; } - 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; + Vector2 vector57 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num483 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); + npc.rotation = (float)Math.Atan2(num484, num483) + 1.57f; return false; } @@ -7572,11 +7598,11 @@ namespace CalamityMod.NPCs 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; + Vector2 vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num486 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); + npc.rotation = (float)Math.Atan2(num487, num486) + 1.57f; npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; npc.velocity.X += 0.5f; @@ -7597,10 +7623,10 @@ namespace CalamityMod.NPCs 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)); + vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num486 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector58.X; + num487 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector58.Y; + num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); num488 = chargeVelocity / num488; npc.velocity.X = num486 * num488; npc.velocity.Y = num487 * num488; @@ -7637,11 +7663,11 @@ namespace CalamityMod.NPCs // 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; + Vector2 vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num489 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); + npc.rotation = (float)Math.Atan2(num490, num489) + 1.57f; npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; @@ -7649,7 +7675,7 @@ namespace CalamityMod.NPCs 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) + if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) { float chargeVelocity = CalamityWorld.bossRushActive ? 21f : 14f; if (!cannonAlive) @@ -7661,10 +7687,10 @@ namespace CalamityMod.NPCs 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)); + vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num489 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector59.X; + num490 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector59.Y; + num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); num491 = chargeVelocity / num491; npc.velocity.X = num489 * num491; npc.velocity.Y = num490 * num491; @@ -7673,7 +7699,7 @@ namespace CalamityMod.NPCs } // 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) + else if (npc.ai[2] == 5f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 100f) { float chargeAmt = 4f; if (!cannonAlive) @@ -7704,10 +7730,10 @@ namespace CalamityMod.NPCs 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; + Vector2 vector50 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num462 = Main.npc[(int)npc.ai[1]].position.X + (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)); + float num464 = (float)Math.Sqrt(num462 * num462 + num463 * num463); if (npc.ai[2] != 99f) { @@ -7775,7 +7801,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -7f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -7785,7 +7811,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 10f) npc.velocity.X = 10f; } - 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -7840,7 +7866,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -2.5f; } - 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -7850,7 +7876,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 10f) npc.velocity.X = 10f; } - 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 250f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -7861,21 +7887,21 @@ namespace CalamityMod.NPCs npc.velocity.X = -10f; } - 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; + Vector2 vector52 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num468 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num470 = (float)Math.Sqrt(num468 * num468 + num469 * num469); + npc.rotation = (float)Math.Atan2(num469, 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; + Vector2 vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num471 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); + npc.rotation = (float)Math.Atan2(num472, num471) + 1.57f; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.3f; @@ -7894,10 +7920,10 @@ namespace CalamityMod.NPCs 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)); + vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num471 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector53.X; + num472 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector53.Y; + num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); num473 = chargeVelocity / num473; npc.velocity.X = num471 * num473; npc.velocity.Y = num472 * num473; @@ -7924,10 +7950,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num474 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector54.X; + float num475 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector54.Y; + float num476 = (float)Math.Sqrt(num474 * num474 + num475 * num475); num476 = chargeVelocity / num476; num474 *= num476; num475 *= num476; @@ -7968,15 +7994,15 @@ namespace CalamityMod.NPCs 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; + vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num474 = Main.npc[(int)npc.ai[1]].position.X + (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; + num476 = (float)Math.Sqrt(num474 * num474 + num475 * num475); + npc.rotation = (float)Math.Atan2(num475, 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)))) + if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)))) npc.ai[2] = 0f; } } @@ -10767,7 +10793,7 @@ namespace CalamityMod.NPCs } // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Phases bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -10906,7 +10932,7 @@ namespace CalamityMod.NPCs new List().Add(npc.whoAmI); for (int j = 0; j < Main.maxNPCs; j++) { - if (Main.npc[j].active && Main.npc[j].type == 440 && Main.npc[j].ai[3] == (float)npc.whoAmI) + if (Main.npc[j].active && Main.npc[j].type == 440 && Main.npc[j].ai[3] == npc.whoAmI) { Main.npc[j].life = 0; Main.npc[j].HitEffect(0, 10.0); @@ -10990,7 +11016,7 @@ namespace CalamityMod.NPCs npc.direction = npc.spriteDirection = num14; } npc.ai[1] += 1f; - if (npc.ai[1] >= (float)idleTime & isCultist) + if (npc.ai[1] >= idleTime & isCultist) { int num15 = 0; if (phase2) @@ -11106,7 +11132,7 @@ namespace CalamityMod.NPCs if (num15 == 0) { // Set a location to move to - float num16 = (float)Math.Ceiling((double)((player.Center + new Vector2(0f, -100f) - center).Length() / 50f)); + float num16 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); if (num16 == 0f) { num16 = 1f; @@ -11118,7 +11144,7 @@ namespace CalamityMod.NPCs list2.Add(npc.whoAmI); for (int k = 0; k < Main.maxNPCs; k++) { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) { list2.Add(k); } @@ -11130,7 +11156,7 @@ namespace CalamityMod.NPCs { NPC nPC2 = Main.npc[current2]; Vector2 center2 = nPC2.Center; - float num18 = (float)((num17 + flag5.ToInt() + 1) / 2) * 6.28318548f * 0.4f / (float)list2.Count; + float num18 = (num17 + flag5.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; if (num17 % 2 == 1) { num18 *= -1f; @@ -11139,7 +11165,7 @@ namespace CalamityMod.NPCs { num18 = 0f; } - Vector2 value = new Vector2(0f, -1f).RotatedBy((double)num18, default) * new Vector2(150f, 200f); + Vector2 value = new Vector2(0f, -1f).RotatedBy(num18, default) * new Vector2(150f, 200f); Vector2 value2 = player.Center + value - center2; nPC2.ai[0] = 1f; nPC2.ai[1] = num16; @@ -11215,7 +11241,7 @@ namespace CalamityMod.NPCs Vector2 vec = Vector2.Normalize(player.Center - center); if (vec.HasNaNs()) { - vec = new Vector2((float)npc.direction, 0f); + vec = new Vector2(npc.direction, 0f); } if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) { @@ -11224,7 +11250,7 @@ namespace CalamityMod.NPCs List list3 = new List(); for (int l = 0; l < Main.maxNPCs; l++) { - if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) + if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == npc.whoAmI) { list3.Add(l); } @@ -11241,9 +11267,9 @@ namespace CalamityMod.NPCs vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f); if (vec.HasNaNs()) { - vec = new Vector2((float)npc.direction, 0f); + vec = new Vector2(npc.direction, 0f); } - Vector2 vector = center3 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector = center3 + new Vector2(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); @@ -11254,15 +11280,15 @@ namespace CalamityMod.NPCs vec = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec.HasNaNs()) { - vec = new Vector2((float)npc.direction, 0f); + vec = new Vector2(npc.direction, 0f); } - Vector2 vector3 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector3 = npc.Center + new Vector2(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)) + if (npc.ai[1] >= (4 + iceMistFireRate * 2)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11279,7 +11305,7 @@ namespace CalamityMod.NPCs Vector2 vec2 = Vector2.Normalize(player.Center - center); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2(npc.direction, 0f); } if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) { @@ -11288,7 +11314,7 @@ namespace CalamityMod.NPCs List list4 = new List(); for (int num20 = 0; num20 < Main.maxNPCs; num20++) { - if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == (float)npc.whoAmI) + if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == npc.whoAmI) { list4.Add(num20); } @@ -11307,9 +11333,9 @@ namespace CalamityMod.NPCs vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2(npc.direction, 0f); } - Vector2 vector5 = center4 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector5 = center4 + new Vector2(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); @@ -11326,16 +11352,16 @@ namespace CalamityMod.NPCs vec2 = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2(npc.direction, 0f); } - Vector2 vector7 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector7 = npc.Center + new Vector2(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)) + if (npc.ai[1] >= (4 + fireballFireRate * 4)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11361,7 +11387,7 @@ namespace CalamityMod.NPCs List list5 = new List(); for (int num25 = 0; num25 < Main.maxNPCs; num25++) { - if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == (float)npc.whoAmI) + if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == npc.whoAmI) { list5.Add(num25); } @@ -11378,9 +11404,9 @@ namespace CalamityMod.NPCs Vector2 vec3 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f); if (vec3.HasNaNs()) { - vec3 = new Vector2((float)npc.direction, 0f); + vec3 = new Vector2(npc.direction, 0f); } - Vector2 vector9 = center5 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector9 = center5 + new Vector2(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); @@ -11388,7 +11414,7 @@ namespace CalamityMod.NPCs 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)) + if (npc.ai[1] >= (20 + lightningOrbFireRate)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11404,7 +11430,7 @@ namespace CalamityMod.NPCs npc.localAI[2] = 10f; if (Vector2.Normalize(player.Center - center).HasNaNs()) { - new Vector2((float)npc.direction, 0f); + new Vector2(npc.direction, 0f); } if (npc.ai[1] >= 0f && npc.ai[1] < 30f) { @@ -11421,7 +11447,7 @@ namespace CalamityMod.NPCs List list6 = new List(); for (int num29 = 0; num29 < Main.maxNPCs; num29++) { - if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == (float)npc.whoAmI) + if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == npc.whoAmI) { list6.Add(num29); } @@ -11435,7 +11461,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), player.Center); + array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(num32 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, default), player.Center); } int num33 = 0; for (int num34 = 1; num34 < array.Length; num34++) @@ -11458,11 +11484,11 @@ namespace CalamityMod.NPCs { if (num33 != num36) { - Vector2 vector11 = npc.Center + spinningpoint.RotatedBy((double)((float)num36 * 6.28318548f / (float)num31 - 1.57079637f), default); + Vector2 vector11 = npc.Center + spinningpoint.RotatedBy(num36 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, 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].ai[3] = npc.whoAmI; Main.npc[num37].netUpdate = true; Main.npc[num37].localAI[1] = npc.localAI[1]; } @@ -11474,8 +11500,8 @@ 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); + npc.ai[2] = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + npc.Center += spinningpoint.RotatedBy(num33 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, default); npc.netUpdate = true; list6.Clear(); } @@ -11616,7 +11642,7 @@ namespace CalamityMod.NPCs { npc.localAI[2] = 13f; npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(idleTime * 3)) + if (npc.ai[1] >= (idleTime * 3)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11633,7 +11659,7 @@ namespace CalamityMod.NPCs Vector2 vec4 = Vector2.Normalize(player.Center - center); if (vec4.HasNaNs()) { - vec4 = new Vector2((float)npc.direction, 0f); + vec4 = new Vector2(npc.direction, 0f); } if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) { @@ -11642,7 +11668,7 @@ namespace CalamityMod.NPCs List list7 = new List(); for (int num44 = 0; num44 < Main.maxNPCs; num44++) { - if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == (float)npc.whoAmI) + if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == npc.whoAmI) { list7.Add(num44); } @@ -11661,11 +11687,11 @@ namespace CalamityMod.NPCs vec4 = Vector2.Normalize(player.Center - center6 + player.velocity * 20f); if (vec4.HasNaNs()) { - vec4 = new Vector2((float)npc.direction, 0f); + vec4 = new Vector2(npc.direction, 0f); } - Vector2 vector16 = center6 + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector16 = center6 + new Vector2(npc.direction * 30, 12f); int num46 = 0; - while ((float)num46 < 5f) + while (num46 < 5f) { Vector2 vector17 = vec4 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); vector17 = vector17.RotatedByRandom(1.2566370964050293); @@ -11685,20 +11711,20 @@ namespace CalamityMod.NPCs vec4 = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec4.HasNaNs()) { - vec4 = new Vector2((float)npc.direction, 0f); + vec4 = new Vector2(npc.direction, 0f); } - Vector2 vector18 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); + Vector2 vector18 = npc.Center + new Vector2(npc.direction * 30, 12f); float scaleFactor = 10f; if (CalamityWorld.bossRushActive) scaleFactor *= 1.5f; float num48 = 0.251327425f; int num49 = 0; - while ((float)num49 < 5f) + while (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; + vector19 = vector19.RotatedBy(num48 * num49 - (1.2566371f - num48) / 2f, default); + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 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++; @@ -11706,7 +11732,7 @@ namespace CalamityMod.NPCs } } npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientLightSpawnRate * 2)) + if (npc.ai[1] >= (4 + ancientLightSpawnRate * 2)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11725,7 +11751,7 @@ namespace CalamityMod.NPCs List list8 = new List(); for (int num51 = 0; num51 < Main.maxNPCs; num51++) { - if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == (float)npc.whoAmI) + if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == npc.whoAmI) { list8.Add(num51); } @@ -11771,7 +11797,7 @@ namespace CalamityMod.NPCs } if (flag7) { - NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, (float)npc.whoAmI, 0f, 0f, 0f, 255); + NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI, 0f, 0f, 0f, 255); break; } } @@ -11831,7 +11857,7 @@ namespace CalamityMod.NPCs return false; } - npc.rotation = npc.velocity.ToRotation() - 1.57079637f; + npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; if (npc.localAI[0] == 0f) { @@ -11840,7 +11866,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = npc.ai[3]; for (int num1492 = 0; num1492 < 13; num1492++) { - int num1493 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 2.5f); + int num1493 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); Main.dust[num1493].noGravity = true; Main.dust[num1493].fadeIn = 1f; Dust dust = Main.dust[num1493]; @@ -11853,7 +11879,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) { - int num1495 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 2.5f); + int num1495 = Dust.NewDust(npc.position, npc.width, npc.height, 261, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); Main.dust[num1495].noGravity = true; Dust dust = Main.dust[num1495]; dust.velocity *= 0.2f; @@ -11871,14 +11897,14 @@ namespace CalamityMod.NPCs } } - npc.dontTakeDamage = (npc.ai[0] >= 0f && npc.ai[0] <= 180f); + npc.dontTakeDamage = npc.ai[0] >= 0f && npc.ai[0] <= 180f; if (npc.ai[0] >= 0f) { npc.ai[0] += 1f; if (npc.ai[0] > 60f) { - npc.velocity = npc.velocity.RotatedBy((double)npc.ai[1], default(Vector2)); + npc.velocity = npc.velocity.RotatedBy(npc.ai[1], default); } if (npc.ai[0] > 120f) { @@ -11922,7 +11948,7 @@ namespace CalamityMod.NPCs { flag110 = true; } - npc.ai[1] += (float)num1498; + npc.ai[1] += num1498; float num1500 = npc.ai[1] / num1497; num1500 = MathHelper.Clamp(num1500, 0f, 1f); npc.position = npc.Center; @@ -11931,27 +11957,27 @@ namespace CalamityMod.NPCs npc.alpha = (int)(255f - num1500 * 255f); if (Main.rand.NextBool(6)) { - Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); 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.position = npc.Center - spinningpoint4 * Main.rand.Next(10, 21) * npc.scale; + dust17.velocity = spinningpoint4.RotatedBy(MathHelper.PiOver2, 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); + Vector2 spinningpoint5 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); 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.velocity = spinningpoint5.RotatedBy(-MathHelper.PiOver2, 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); + Vector2 vector254 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); 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; @@ -11960,7 +11986,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).Y * 0.25f; + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f, default).Y * 0.25f; if (npc.ai[1] >= num1496) { int damage = 50; @@ -11972,7 +11998,7 @@ namespace CalamityMod.NPCs { for (int num1501 = 0; num1501 < 4; num1501++) { - Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy((double)(1.57079637f * (float)num1501), default); + Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy(MathHelper.PiOver2 * num1501, default); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -12046,7 +12072,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.type == NPCID.MoonLordCore) { - npc.ai[2] = (float)Main.rand.Next(3); + npc.ai[2] = Main.rand.Next(3); npc.ai[2] = 0f; npc.netUpdate = true; } @@ -12072,7 +12098,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.type == NPCID.MoonLordCore) { - npc.ai[2] = (float)Main.rand.Next(3); + npc.ai[2] = Main.rand.Next(3); npc.ai[2] = 0f; npc.netUpdate = true; @@ -12083,7 +12109,7 @@ namespace CalamityMod.NPCs 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].ai[2] = num1156; Main.npc[num1157].netUpdate = true; int[] arg_381A6_0 = array5; num = num1155; @@ -12101,12 +12127,12 @@ namespace CalamityMod.NPCs for (int num1159 = 0; num1159 < 3; num1159 = num + 1) { - Main.npc[array5[num1159]].ai[3] = (float)npc.whoAmI; + Main.npc[array5[num1159]].ai[3] = npc.whoAmI; num = num1159; } for (int num1160 = 0; num1160 < 3; num1160 = num + 1) { - npc.localAI[num1160] = (float)array5[num1160]; + npc.localAI[num1160] = array5[num1160]; num = num1160; } } @@ -12126,7 +12152,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { int num = NPC.NewNPC((int)Main.npc[(int)npc.localAI[2]].Center.X, (int)Main.npc[(int)npc.localAI[2]].Center.Y, NPCID.MoonLordFreeEye, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num].ai[3] = (float)npc.whoAmI; + Main.npc[num].ai[3] = npc.whoAmI; Main.npc[num].netUpdate = true; } } @@ -12244,7 +12270,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 2f) { npc.dontTakeDamage = true; - Vector2 value6 = new Vector2((float)npc.direction, -0.5f); + Vector2 value6 = new Vector2(npc.direction, -0.5f); npc.velocity = Vector2.Lerp(npc.velocity, value6, 0.98f); npc.ai[1] += 1f; @@ -12291,8 +12317,8 @@ namespace CalamityMod.NPCs flag86 = false; float num1163 = (float)Main.rand.Next(6, 19); - float num1164 = 6.28318548f / num1163; - float num1165 = 6.28318548f * Main.rand.NextFloat(); + float num1164 = MathHelper.TwoPi / num1163; + float num1165 = MathHelper.TwoPi * Main.rand.NextFloat(); float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; float num1166 = 1f + Main.rand.NextFloat(); float fadeIn = 0.4f + Main.rand.NextFloat(); @@ -12310,7 +12336,7 @@ namespace CalamityMod.NPCs 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.velocity = Vector2.UnitY.RotatedBy(num1165 + num1164 * num1168, default) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); dust2.fadeIn = fadeIn; dust2.scale = num1166; ai1 = num1168; @@ -12365,8 +12391,8 @@ 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) * 6f; + float num1170 = (Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + MathHelper.PiOver4 * Main.rand.NextFloat()); + Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy(num1170, default) * 6f; Projectile.NewProjectile(vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); } } @@ -12409,7 +12435,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 3f) { npc.dontTakeDamage = true; - Vector2 value7 = new Vector2((float)npc.direction, -0.5f); + Vector2 value7 = new Vector2(npc.direction, -0.5f); npc.velocity = Vector2.Lerp(npc.velocity, value7, 0.98f); npc.ai[1] += 1f; @@ -12610,8 +12636,8 @@ namespace CalamityMod.NPCs while (num1214 < 5) { - num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; - if (num1208 + (float)num1215 > npc.ai[1]) + num1208 = NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; + if (num1208 + num1215 > npc.ai[1]) break; num1215 += (int)num1208; @@ -12623,12 +12649,12 @@ namespace CalamityMod.NPCs { num1214 = 0; npc.ai[1] = 0f; - num1208 = (float)NPC.MoonLordAttacksArray[num1212, num1213, 1, num1214]; + num1208 = 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); + npc.ai[0] = NPC.MoonLordAttacksArray[num1212, num1213, 0, num1214]; + num1207 = (int)npc.ai[1] - num1215; if (npc.ai[0] != num1211) npc.netUpdate = true; @@ -12698,9 +12724,9 @@ namespace CalamityMod.NPCs num1223 = 1.65f; } - Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; + Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).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].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - num1220 * 2f) / 10f; Main.dust[num1224].noGravity = true; Main.dust[num1224].scale = num1223; Main.dust[num1224].customData = npc; @@ -12760,9 +12786,9 @@ namespace CalamityMod.NPCs 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, projectileType, damage, 0f, Main.myPlayer, num1225 * 6.28318548f / calamityGlobalNPC.newAI[1], (float)npc.whoAmI); - npc.ai[2] = (vector200.ToRotation() + 9.424778f) * num1225; + vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f, default); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, projectileType, damage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], (float)npc.whoAmI); + npc.ai[2] = (vector200.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1225; npc.netUpdate = true; } @@ -12770,15 +12796,15 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - float num1226 = (float)(npc.ai[2] >= 0f).ToDirectionInt(); + float num1226 = (npc.ai[2] >= 0f).ToDirectionInt(); float num1227 = npc.ai[2]; if (num1227 < 0f) num1227 *= -1f; - num1227 += -9.424778f; - num1227 += num1226 * 6.28318548f / calamityGlobalNPC.newAI[1]; + num1227 += -(MathHelper.Pi + MathHelper.TwoPi); + num1227 += num1226 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; npc.localAI[0] = num1227; - npc.ai[2] = (num1227 + 9.424778f) * num1226; + npc.ai[2] = (num1227 + MathHelper.Pi + MathHelper.TwoPi) * num1226; } else { @@ -12811,7 +12837,7 @@ namespace CalamityMod.NPCs 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); + Projectile.NewProjectile(vector201.X, vector201.Y, vector202.X, vector202.Y, ProjectileID.MoonLeech, 0, 0f, Main.myPlayer, npc.whoAmI + 1, num1228); } } } @@ -12826,8 +12852,8 @@ namespace CalamityMod.NPCs 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; + Main.npc[num1230].ai[0] = npc.whoAmI + 1; + Main.npc[num1230].ai[1] = num1229; } } } @@ -12907,9 +12933,9 @@ namespace CalamityMod.NPCs // Dictates whether this npc is vulnerable or not int num1231 = num1209 * 7; - if ((float)num1231 > npc.localAI[2]) + if (num1231 > npc.localAI[2]) npc.localAI[2] += 1f; - if ((float)num1231 < npc.localAI[2]) + if (num1231 < npc.localAI[2]) npc.localAI[2] -= 1f; if (npc.localAI[2] < 0f) npc.localAI[2] = 0f; @@ -12917,9 +12943,9 @@ namespace CalamityMod.NPCs npc.localAI[2] = 14f; int num1232 = num1210 * 5; - if ((float)num1232 > npc.localAI[3]) + if (num1232 > npc.localAI[3]) npc.localAI[3] += 1f; - if ((float)num1232 < npc.localAI[3]) + if (num1232 < npc.localAI[3]) npc.localAI[3] -= 1f; if (npc.localAI[3] < 0f) npc.localAI[2] = 0f; @@ -12941,7 +12967,7 @@ namespace CalamityMod.NPCs // Variables bool flag90 = npc.ai[2] == 0f; - float num1177 = (float)-(float)flag90.ToDirectionInt(); + float num1177 = -flag90.ToDirectionInt(); npc.spriteDirection = (int)num1177; npc.dontTakeDamage = npc.frameCounter >= 21.0; @@ -12979,8 +13005,8 @@ namespace CalamityMod.NPCs while (num1184 < 5) { - num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; - if (num1179 + (float)num1185 > npc.ai[1]) + num1179 = NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; + if (num1179 + num1185 > npc.ai[1]) break; num1185 += (int)num1179; @@ -12992,12 +13018,12 @@ namespace CalamityMod.NPCs { num1184 = 0; npc.ai[1] = 0f; - num1179 = (float)NPC.MoonLordAttacksArray[num1182, num1183, 1, num1184]; + num1179 = 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); + npc.ai[0] = NPC.MoonLordAttacksArray[num1182, num1183, 0, num1184]; + num1178 = (int)npc.ai[1] - num1185; if (npc.ai[0] != num1181) npc.netUpdate = true; } @@ -13080,20 +13106,20 @@ namespace CalamityMod.NPCs break; } - if (num1178 >= (float)(num1186 * num1187 * 2)) + if (num1178 >= (num1186 * num1187 * 2)) { npc.localAI[1] -= 0.07f; if (npc.localAI[1] < 0f) npc.localAI[1] = 0f; } - else if (num1178 >= (float)(num1186 * num1187)) + else if (num1178 >= (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(); + float num1188 = MathHelper.TwoPi * (num1178 % (num1186 * num1187)) / (num1186 * num1187) - MathHelper.PiOver2; + npc.localAI[0] = new Vector2((float)Math.Cos(num1188) * vector165.X, (float)Math.Sin(num1188) * vector165.Y).ToRotation(); int damage = 40; if (death) @@ -13124,7 +13150,7 @@ namespace CalamityMod.NPCs } Vector2 vector170 = Vector2.Normalize(vector168) * velocity; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1177; + float ai = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * num1177; Projectile.NewProjectile(vector169.X, vector169.Y, vector170.X, vector170.Y, ProjectileID.PhantasmalEye, damage, 0f, Main.myPlayer, 0f, ai); } } @@ -13134,8 +13160,8 @@ namespace CalamityMod.NPCs 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(); + float num1189 = MathHelper.TwoPi * (num1178 % (num1186 * num1187)) / (num1186 * num1187) - MathHelper.PiOver2; + npc.localAI[0] = new Vector2((float)Math.Cos(num1189) * vector165.X, (float)Math.Sin(num1189) * vector165.Y).ToRotation(); } } @@ -13229,10 +13255,10 @@ namespace CalamityMod.NPCs { 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.X += (num1191 - 3.5f) * num1177 * 3f; + vector173.Y += (num1191 - 4.5f) * 1f; vector173 *= 1.2f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, ProjectileID.PhantasmalSphere, damage, 1f, Main.myPlayer, 0f, (float)npc.whoAmI); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, ProjectileID.PhantasmalSphere, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); } Vector2 vector174 = Vector2.SmoothStep(value12, value12 + value13, (num1178 - 30f) / 180f) - npc.Center; @@ -13283,7 +13309,7 @@ namespace CalamityMod.NPCs if (num1178 == 292f && Main.netMode != NetmodeID.MultiplayerClient) { - int num1193 = (int)Player.FindClosest(npc.position, npc.width, npc.height); + int num1193 = 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; @@ -13310,7 +13336,7 @@ namespace CalamityMod.NPCs for (int num1194 = 0; num1194 < Main.maxProjectiles; num1194++) { Projectile projectile3 = Main.projectile[num1194]; - if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == (float)npc.whoAmI && projectile3.ai[0] != -1f) + if (projectile3.active && projectile3.type == ProjectileID.PhantasmalSphere && projectile3.ai[1] == npc.whoAmI && projectile3.ai[0] != -1f) { projectile3.ai[0] = -1f; projectile3.velocity = vector176; @@ -13469,12 +13495,12 @@ namespace CalamityMod.NPCs // Frames int num1195 = num1180 * 7; - if ((double)num1195 > npc.frameCounter) + if (num1195 > npc.frameCounter) { double num1196 = npc.frameCounter; npc.frameCounter = num1196 + 1.0; } - if ((double)num1195 < npc.frameCounter) + if (num1195 < npc.frameCounter) { double num1196 = npc.frameCounter; npc.frameCounter = num1196 - 1.0; @@ -13541,8 +13567,8 @@ namespace CalamityMod.NPCs int num1244 = 0; while (num1243 < 10) { - num1241 = (float)NPC.MoonLordAttacksArray2[1, num1243]; - if (num1241 + (float)num1244 > npc.ai[1]) + num1241 = NPC.MoonLordAttacksArray2[1, num1243]; + if (num1241 + num1244 > npc.ai[1]) break; num1244 += (int)num1241; @@ -13553,12 +13579,12 @@ namespace CalamityMod.NPCs { num1243 = 0; npc.ai[1] = 0f; - num1241 = (float)NPC.MoonLordAttacksArray2[1, num1243]; + num1241 = NPC.MoonLordAttacksArray2[1, num1243]; num1244 = 0; } - npc.ai[0] = (float)NPC.MoonLordAttacksArray2[0, num1243]; - float num1245 = (float)((int)npc.ai[1] - num1244); + npc.ai[0] = NPC.MoonLordAttacksArray2[0, num1243]; + float num1245 = (int)npc.ai[1] - num1244; if (npc.ai[0] != num1242) npc.netUpdate = true; @@ -13576,9 +13602,9 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; - npc.localAI[1] = (float)Math.Sin((double)(npc.ai[1] * 6.28318548f / 15f)) * 0.35f; + npc.localAI[1] = (float)Math.Sin(npc.ai[1] * MathHelper.TwoPi / 15f) * 0.35f; if (npc.localAI[1] < 0f) - npc.localAI[0] = 3.14159274f; + npc.localAI[0] = MathHelper.Pi; } else if (npc.ai[1] < 120f) { @@ -13622,8 +13648,8 @@ namespace CalamityMod.NPCs value24 = Vector2.Normalize(value24) * velocity; int num1246 = 30; - npc.velocity.X = (npc.velocity.X * (float)(num1246 - 1) + value24.X) / (float)num1246; - npc.velocity.Y = (npc.velocity.Y * (float)(num1246 - 1) + value24.Y) / (float)num1246; + npc.velocity.X = (npc.velocity.X * (num1246 - 1) + value24.X) / num1246; + npc.velocity.Y = (npc.velocity.Y * (num1246 - 1) + value24.Y) / num1246; // Fly towards Moon Lord Head and stay away from other True Eyes float num1247 = 0.5f; @@ -13746,9 +13772,9 @@ namespace CalamityMod.NPCs } Vector2 spinningpoint2 = Vector2.UnitY * -30f; - Vector2 value25 = spinningpoint2.RotatedBy((double)((float)num1250 * 6.28318548f / 6f), default(Vector2)); - Vector2 value26 = spinningpoint2.RotatedBy((double)((float)num1251 * 6.28318548f / 6f), default(Vector2)); - Vector2 vector216 = Vector2.Lerp(value25, value26, num1249 - (float)((int)num1249)); + Vector2 value25 = spinningpoint2.RotatedBy(num1250 * MathHelper.TwoPi / 6f, default); + Vector2 value26 = spinningpoint2.RotatedBy(num1251 * MathHelper.TwoPi / 6f, default); + Vector2 vector216 = Vector2.Lerp(value25, value26, num1249 - (int)num1249); float value27 = vector216.Length() / 30f; npc.localAI[0] = vector216.ToRotation(); @@ -13756,7 +13782,7 @@ namespace CalamityMod.NPCs for (int num1252 = 0; num1252 < 2; num1252++) { - int num1253 = Dust.NewDust(npc.Center + vector216 - Vector2.One * 4f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f); + int num1253 = Dust.NewDust(npc.Center + vector216 - Vector2.One * 4f, 0, 0, 229, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num1253]; dust.velocity += vector216 / 15f; Main.dust[num1253].noGravity = true; @@ -13776,7 +13802,7 @@ namespace CalamityMod.NPCs { if (num1245 < 105f) { - npc.localAI[0] = npc.localAI[0].AngleLerp(npc.ai[2] - 1.57079637f, 0.2f); + npc.localAI[0] = npc.localAI[0].AngleLerp(npc.ai[2] - MathHelper.PiOver2, 0.2f); npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 0.75f, 0.2f); @@ -13791,7 +13817,7 @@ namespace CalamityMod.NPCs for (int num1255 = 0; num1255 < Main.maxProjectiles; num1255++) { Projectile projectile7 = Main.projectile[num1255]; - if (projectile7.active && projectile7.type == ProjectileID.PhantasmalSphere && projectile7.ai[1] == (float)npc.whoAmI && projectile7.ai[0] != -1f) + if (projectile7.active && projectile7.type == ProjectileID.PhantasmalSphere && projectile7.ai[1] == npc.whoAmI && projectile7.ai[0] != -1f) { Projectile projectile8 = projectile7; projectile8.velocity += npc.velocity; @@ -13802,7 +13828,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = npc.velocity.Y * 0.96f; - npc.ai[2] = (Main.player[npc.target].Center - npc.Center).ToRotation() + 1.57079637f; + npc.ai[2] = (Main.player[npc.target].Center - npc.Center).ToRotation() + MathHelper.PiOver2; npc.rotation = npc.rotation.AngleTowards(npc.ai[2], 0.104719758f); @@ -13817,13 +13843,13 @@ namespace CalamityMod.NPCs npc.netUpdate = true; float velocity = CalamityWorld.bossRushActive ? 16f : 12f; - Vector2 velocity6 = (npc.ai[2] - 1.57079637f).ToRotationVector2() * velocity; + Vector2 velocity6 = (npc.ai[2] - MathHelper.PiOver2).ToRotationVector2() * velocity; npc.velocity = velocity6 * 2f; for (int num1256 = 0; num1256 < Main.maxProjectiles; num1256++) { Projectile projectile9 = Main.projectile[num1256]; - if (projectile9.active && projectile9.type == ProjectileID.PhantasmalSphere && projectile9.ai[1] == (float)npc.whoAmI && projectile9.ai[0] != -1f) + if (projectile9.active && projectile9.type == ProjectileID.PhantasmalSphere && projectile9.ai[1] == npc.whoAmI && projectile9.ai[0] != -1f) { projectile9.ai[0] = -1f; projectile9.damage = 55; @@ -13857,9 +13883,9 @@ namespace CalamityMod.NPCs { npc.localAI[0] = 0f; - npc.localAI[1] = (float)Math.Sin((double)((num1245 - 15f) * 6.28318548f / 15f)) * 0.5f; + npc.localAI[1] = (float)Math.Sin((num1245 - 15f) * MathHelper.TwoPi / 15f) * 0.5f; if (npc.localAI[1] < 0f) - npc.localAI[0] = 3.14159274f; + npc.localAI[0] = MathHelper.Pi; } else { @@ -13879,7 +13905,7 @@ namespace CalamityMod.NPCs if (num1245 == 45f) { - npc.ai[2] = (float)(Main.rand.Next(2) == 0).ToDirectionInt() * 6.28318548f / 40f; + npc.ai[2] = (Main.rand.Next(2) == 0).ToDirectionInt() * MathHelper.TwoPi / 40f; npc.netUpdate = true; } @@ -13896,14 +13922,14 @@ namespace CalamityMod.NPCs float scaleFactor10 = MathHelper.Lerp(8f, 20f, (num1245 - 15f - 30f) / 140f); npc.velocity = Vector2.Normalize(vector218) * scaleFactor10; - npc.rotation = npc.rotation.AngleLerp(npc.velocity.ToRotation() + 1.57079637f, 0.2f); + npc.rotation = npc.rotation.AngleLerp(npc.velocity.ToRotation() + MathHelper.PiOver2, 0.2f); if ((num1245 - 15f - 30f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector219 = npc.Center + Vector2.Normalize(vector218) * value22.Length() * 0.4f; float velocity = CalamityWorld.bossRushActive ? 14f : 10f; Vector2 vector220 = Vector2.Normalize(vector218) * velocity; - float ai3 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * npc.ai[2]; + float ai3 = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * npc.ai[2]; Projectile.NewProjectile(vector219.X, vector219.Y, vector220.X, vector220.Y, ProjectileID.PhantasmalEye, 35, 0f, Main.myPlayer, 0f, ai3); } } @@ -13946,9 +13972,9 @@ namespace CalamityMod.NPCs num1260 = 1.65f; } - Vector2 vector221 = center25 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value22 / 2f; - int num1261 = Dust.NewDust(vector221 - Vector2.One * 8f, 16, 16, num1259, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default(Color), 1f); - Main.dust[num1261].velocity = Vector2.Normalize(center25 - vector221) * 3.5f * (10f - (float)num1257 * 2f) / 10f; + Vector2 vector221 = center25 + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * value22 / 2f; + int num1261 = Dust.NewDust(vector221 - Vector2.One * 8f, 16, 16, num1259, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default, 1f); + Main.dust[num1261].velocity = Vector2.Normalize(center25 - vector221) * 3.5f * (10f - num1257 * 2f) / 10f; Main.dust[num1261].noGravity = true; Main.dust[num1261].scale = num1260; Main.dust[num1261].customData = npc; @@ -13977,9 +14003,9 @@ namespace CalamityMod.NPCs if (vector222.X < 0f) num1262 = 1f; - vector222 = vector222.RotatedBy((double)(-(double)num1262 * 6.28318548f / 6f), default(Vector2)); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, ProjectileID.PhantasmalDeathray, 50, 0f, Main.myPlayer, num1262 * 6.28318548f / calamityGlobalNPC.newAI[1], (float)npc.whoAmI); - npc.ai[2] = (vector222.ToRotation() + 9.424778f) * num1262; + vector222 = vector222.RotatedBy(-(double)num1262 * MathHelper.TwoPi / 6f, default); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, ProjectileID.PhantasmalDeathray, 50, 0f, Main.myPlayer, num1262 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + npc.ai[2] = (vector222.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1262; npc.netUpdate = true; } @@ -13987,16 +14013,16 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - float num1263 = (float)(npc.ai[2] >= 0f).ToDirectionInt(); + float num1263 = (npc.ai[2] >= 0f).ToDirectionInt(); float num1264 = npc.ai[2]; if (num1264 < 0f) num1264 *= -1f; - num1264 += -9.424778f; - num1264 += num1263 * 6.28318548f / calamityGlobalNPC.newAI[1]; + num1264 += -(MathHelper.Pi + MathHelper.TwoPi); + num1264 += num1263 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1]; npc.localAI[0] = num1264; - npc.ai[2] = (num1264 + 9.424778f) * num1263; + npc.ai[2] = (num1264 + MathHelper.Pi + MathHelper.TwoPi) * num1263; return false; } @@ -14039,7 +14065,7 @@ namespace CalamityMod.NPCs for (int num1272 = 0; num1272 < Main.maxNPCs; num1272++) { - if (Main.npc[num1272].active && Main.npc[num1272].ai[3] == (float)num1268) + if (Main.npc[num1272].active && Main.npc[num1272].ai[3] == num1268) { if (num1269 == -1 && Main.npc[num1272].type == NPCID.MoonLordHand && Main.npc[num1272].ai[2] == 0f) num1269 = num1272; @@ -14126,20 +14152,20 @@ namespace CalamityMod.NPCs 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; + Vector2 spinningpoint3 = Vector2.UnitY * -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); + int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1286 * MathHelper.TwoPi / 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; + spinningpoint3 = Vector2.UnitY * -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); + int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1288 * MathHelper.TwoPi / 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; @@ -15292,10 +15318,10 @@ namespace CalamityMod.NPCs #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)); + Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; + float num178 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector21.Y; + float num179 = (float)Math.Sqrt(num177 * num177 + num178 * num178); num179 = 12f / num179; npc.velocity.X = num177 * num179; npc.velocity.Y = num178 * num179; @@ -15309,13 +15335,13 @@ namespace CalamityMod.NPCs 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)); + float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt(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); + Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); value.Normalize(); value *= num159; value += npc.velocity; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2fc4e81043..dd7bad9b40 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -956,13 +956,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronPrime) { - npc.lifeMax = (int)(npc.lifeMax * 1.15); npc.npcSlots = 12f; } - else if (npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser) - { - npc.lifeMax = (int)(npc.lifeMax * 0.9); - } else if (npc.type == NPCID.Retinazer) { npc.lifeMax = (int)(npc.lifeMax * 1.25); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 5462edc67a..e06c61640a 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -413,7 +413,7 @@ namespace CalamityMod.NPCs.Yharon } // Rotation - float npcRotation = (float)Math.Atan2((double)(player.Center.Y - vectorCenter.Y), (double)(player.Center.X - vectorCenter.X)); + float npcRotation = (float)Math.Atan2(player.Center.Y - vectorCenter.Y, player.Center.X - vectorCenter.X); if (npc.spriteDirection == 1) npcRotation += pie; if (npcRotation < 0f) @@ -522,13 +522,13 @@ namespace CalamityMod.NPCs.Yharon } // Dust - if (npc.ai[2] == (float)(num1457 - 30)) + if (npc.ai[2] == 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)) * MathHelper.TwoPi / (float)num1468), default) + npc.Center; + Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f; + vector169 = vector169.RotatedBy((num1469 - (num1468 / 2 - 1)) * MathHelper.TwoPi / 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; @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1464) + if (npc.ai[2] >= num1464) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -1613,7 +1613,7 @@ namespace CalamityMod.NPCs.Yharon 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)); + npc.ai[1] = 360 * Math.Sign((vectorCenter - player.Center).X); } Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance @@ -1639,7 +1639,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) + if (npc.ai[2] >= aiChangeRate) { int aiState = 0; switch ((int)npc.ai[3]) @@ -1680,7 +1680,7 @@ namespace CalamityMod.NPCs.Yharon 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); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num32 != 0) { @@ -1719,9 +1719,9 @@ namespace CalamityMod.NPCs.Yharon 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)) * (double)pie / (double)(float)num34, default) + vectorCenter; - Vector2 value8 = ((float)(Main.rand.NextDouble() * (double)pie) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector11 = vector11.RotatedBy((m - (num34 / 2 - 1)) * pie / num34, default) + vectorCenter; + Vector2 value8 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * 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; @@ -1730,7 +1730,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 21f; npc.ai[1] = 0f; @@ -1753,13 +1753,13 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1460 / 2)) + if (npc.ai[2] == 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 (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num1460 / 2) { if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vectorCenter - player.Center).X); Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance vectorCenter = npc.Center = center; @@ -1784,7 +1784,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1460) + if (npc.ai[2] >= num1460) { npc.ai[0] = 21f; npc.ai[1] = 0f; @@ -1792,7 +1792,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[3] += 1f; if (npc.ai[3] == 5f && Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); if (npc.ai[3] >= 20f) //14 npc.ai[3] = 0f; @@ -1808,11 +1808,11 @@ namespace CalamityMod.NPCs.Yharon npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) + if (npc.ai[2] == 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) + if (npc.ai[2] >= num1459) { startSecondAI = true; npc.ai[0] = 0f; diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index 7c85e55b01..57ba185e96 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 600; + projectile.timeLeft = 1200; projectile.scale = 1.5f; } diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 22f9777ffa..e00325d4f9 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 600; + projectile.timeLeft = 1200; projectile.scale = 1.5f; } diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index bcd79cbe65..95046b04b2 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.penetrate = -1; - projectile.timeLeft = 600; + projectile.timeLeft = 1200; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 58a6f26d05..9b9962edb0 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -53,6 +53,8 @@ namespace CalamityMod.Projectiles.Boss Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; } + else + projectile.Kill(); float num801 = 1f; projectile.localAI[0] += 1f; diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 8d1e954070..22ba609b66 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -54,6 +54,8 @@ namespace CalamityMod.Projectiles.Boss Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; } + else + projectile.Kill(); Vector2 laserVelocity = new Vector2(Main.npc[(int)projectile.ai[1]].Calamity().newAI[1], Main.npc[(int)projectile.ai[1]].Calamity().newAI[2]); float rotationVelocity = projectile.ai[0] == 0f ? laserVelocity.ToRotation() : projectile.velocity.ToRotation(); diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 49a7a2cc33..bd52c57328 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Projectiles.Boss { private bool start = true; private Vector2 center = Vector2.Zero; - private double distance = 0D; - private double distance2 = 0D; private Vector2 velocity = Vector2.Zero; + private double[] distances = new double[4]; public override void SetStaticDefaults() { @@ -39,42 +38,51 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); writer.Write(start); writer.WriteVector2(center); - writer.Write(distance); - writer.Write(distance2); + writer.Write(distances[0]); + writer.Write(distances[1]); + writer.Write(distances[2]); + writer.Write(distances[3]); writer.WriteVector2(velocity); } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); start = reader.ReadBoolean(); center = reader.ReadVector2(); - distance = reader.ReadDouble(); - distance2 = reader.ReadDouble(); + distances[0] = reader.ReadDouble(); + distances[1] = reader.ReadDouble(); + distances[2] = reader.ReadDouble(); + distances[3] = reader.ReadDouble(); velocity = reader.ReadVector2(); } public override void AI() { - // Pulse in and out - if (projectile.localAI[1] == 0f) + if (projectile.ai[0] != 8f) { - projectile.scale -= 0.006f; - if (projectile.scale <= 0.9f) + // Pulse in and out + if (projectile.localAI[1] == 0f) { - projectile.scale = 0.9f; - projectile.localAI[1] = 1f; + projectile.scale -= 0.012f; + if (projectile.scale <= 0.8f) + { + projectile.scale = 0.8f; + projectile.localAI[1] = 1f; + } } - } - else - { - projectile.scale += 0.006f; - if (projectile.scale >= 1.1f) + else { - projectile.scale = 1.1f; - projectile.localAI[1] = 0f; + projectile.scale += 0.012f; + if (projectile.scale >= 1.2f) + { + projectile.scale = 1.2f; + projectile.localAI[1] = 0f; + } } } @@ -84,14 +92,14 @@ namespace CalamityMod.Projectiles.Boss case -1: break; - // Rotate around a point and spread outward + // Rotate around a point, spread outward and move case 0: case 1: if (start) { center = projectile.Center; - velocity = Vector2.Normalize(Main.player[(int)Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * 2f; + velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * 2f; start = false; } @@ -103,17 +111,17 @@ namespace CalamityMod.Projectiles.Boss if (amount < 0f) amount = 0f; - distance += (double)MathHelper.Lerp(1f, 6f, amount); + distances[0] += MathHelper.Lerp(1f, 6f, amount); if (projectile.ai[0] == 0f) { - projectile.position.X = center.X - (int)(Math.Sin(rad) * distance) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distance) - projectile.height / 2; + projectile.position.X = center.X - (int)(Math.Sin(rad) * distances[0]) - projectile.width / 2; + projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distances[0]) - projectile.height / 2; } else { - projectile.position.X = center.X - (int)(Math.Cos(rad) * distance) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distance) - projectile.height / 2; + projectile.position.X = center.X - (int)(Math.Cos(rad) * distances[0]) - projectile.width / 2; + projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distances[0]) - projectile.height / 2; } projectile.ai[1] += 0.25f + amount; @@ -124,9 +132,7 @@ namespace CalamityMod.Projectiles.Boss // Lurch forward case 2: - projectile.ai[1] += 0.05f; - - projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(projectile.ai[1]))); + LurchForward(0.05f, 0.95f, 1.05f); break; @@ -134,41 +140,20 @@ namespace CalamityMod.Projectiles.Boss case 3: case 4: - if (start) - { - velocity = projectile.velocity; - start = false; - } + bool useSin = projectile.ai[0] == 3f; - projectile.ai[1] += 0.1f; - - float wavyVelocity = projectile.ai[0] == 3f ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); - - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * velocity.Length(); + WavyMotion(0.1f, 0f, useSin); break; // Speed up then slow down on a timer case 5: + case 16: - projectile.ai[1] += 1f; + float fastGateValue = projectile.ai[0] == 5f ? 30f : 60f; + float maxVelocity = projectile.ai[0] == 5f ? 12f : 6f; - float velocityGateValue = 90f; - float velocityGateValue2 = 30f; - if (projectile.ai[1] <= velocityGateValue) - { - if (projectile.velocity.Length() > 3f) - projectile.velocity *= 0.95f; - } - else if (projectile.ai[1] <= velocityGateValue + velocityGateValue2) - { - if (projectile.velocity.Length() < 18f) - projectile.velocity *= 1.1f; - } - else if (projectile.ai[1] == velocityGateValue + velocityGateValue2) - { - projectile.ai[1] = 0f; - } + LurchForwardOnTimer(90f, fastGateValue, 3f, maxVelocity, 0.95f, 1.2f); break; @@ -183,8 +168,8 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 4; i++) { - Vector2 vector = new Vector2(0f, -8f).RotatedBy((double)(MathHelper.PiOver2 * (float)i), default); - Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, (float)Main.rand.Next(6), 0f); + Vector2 vector = new Vector2(0f, -8f).RotatedBy(MathHelper.PiOver2 * i); + Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); } } @@ -204,8 +189,8 @@ namespace CalamityMod.Projectiles.Boss { for (int i = 0; i < 8; i++) { - Vector2 vector = new Vector2(0f, -8f).RotatedBy((double)(MathHelper.PiOver4 * (float)i), default); - Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); + Vector2 vector = new Vector2(0f, -8f).RotatedBy(MathHelper.PiOver4 * i); + Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); } } @@ -214,20 +199,47 @@ namespace CalamityMod.Projectiles.Boss break; - // Split into 3 projectiles multiple times + // Split into 3 wavy projectiles multiple times case 8: - projectile.ai[1] += 1f; + bool splitOnce = projectile.timeLeft < 1800; + bool splitTwice = projectile.timeLeft < 900; + bool splitThrice = projectile.timeLeft < 450; - if (projectile.ai[1] >= 120f) + if (splitOnce) + WavyMotion(0.05f, 2f, true); + + projectile.localAI[0] += 1f; + + if (projectile.localAI[0] >= 180f) { if (projectile.owner == Main.myPlayer) { + float randomRotation = MathHelper.ToRadians(Main.rand.NextFloat() * 60f); + float radians = MathHelper.TwoPi / 3f + randomRotation; + int spread = 8; + + if (splitOnce) + { + spread *= (splitTwice ? 3 : 0) + + (splitThrice ? 3 : 0); + } + + Vector2 vector = Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center; + vector.Normalize(); + vector *= 3f; + for (int i = 0; i < 3; i++) { - Vector2 vector = new Vector2(0f, -8f).RotatedBy((double)(MathHelper.Pi * 0.66666666667f * (float)i), default); - int proj = Projectile.NewProjectile(projectile.Center, vector, projectile.type, projectile.damage, 0f, Main.myPlayer, 8f, 0f); - Main.projectile[proj].timeLeft = projectile.timeLeft / 4; + Vector2 vector2 = splitOnce ? projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); + + int proj = Projectile.NewProjectile(projectile.Center, vector + vector2, projectile.type, projectile.damage, 0f, Main.myPlayer, 8f, 0f); + + Main.projectile[proj].timeLeft = projectile.timeLeft / 2; + if (Main.projectile[proj].timeLeft < 150) + Main.projectile[proj].timeLeft = 150; + + Main.projectile[proj].scale = projectile.scale * 0.6f; } } @@ -236,23 +248,17 @@ namespace CalamityMod.Projectiles.Boss break; - // Walls + // idk yet case 9: case 10: - projectile.ai[1] += 1f; + bool useSin2 = projectile.ai[0] == 9f; - if (projectile.ai[1] >= 90f) - { - if (projectile.ai[0] == 9f) - projectile.velocity.X = 0f; - else - projectile.velocity.Y = 0f; - } + OscillationMotion(0.05f, useSin2); break; - // Homing arc + // Homing case 11: projectile.ai[1] += 1f; @@ -262,7 +268,7 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[0] += 1f; if (projectile.localAI[0] < 180f) { - Vector2 vector = Main.player[(int)Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center; + Vector2 vector = Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center; float scaleFactor = projectile.velocity.Length(); vector.Normalize(); vector *= scaleFactor; @@ -283,7 +289,7 @@ namespace CalamityMod.Projectiles.Boss if (start) { center = projectile.Center; - velocity = Vector2.Normalize(Main.player[(int)Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center); + velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center); start = false; } @@ -301,33 +307,226 @@ namespace CalamityMod.Projectiles.Boss amount2 = MathHelper.Clamp(0f, 1f, amount2); - double distanceVariable = (double)MathHelper.Lerp(0f, 6f, amount2); + double distanceVariable = MathHelper.Lerp(0f, 6f, amount2); - distance += (flyOutward ? distanceVariable : -distanceVariable); + distances[0] += flyOutward ? distanceVariable : -distanceVariable; double rad2 = MathHelper.ToRadians(projectile.ai[1]); if (projectile.ai[0] == 12f) { - projectile.position.X = center.X - (int)(Math.Sin(rad2) * distance * 2D) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distance) - projectile.height / 2; + projectile.position.X = center.X - (int)(Math.Sin(rad2) * distances[0] * 2D) - projectile.width / 2; + projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distances[0]) - projectile.height / 2; } else { - projectile.position.X = center.X - (int)(Math.Cos(rad2) * distance) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distance * 2D) - projectile.height / 2; + projectile.position.X = center.X - (int)(Math.Cos(rad2) * distances[0]) - projectile.width / 2; + projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distances[0] * 2D) - projectile.height / 2; } projectile.ai[1] += 0.25f + amount2; projectile.localAI[0] += 1f; break; + + // Spread out then drift inward after some time and then drift outward + case 14: + case 15: + + float velocityMult = 12f; + + if (start) + { + center = projectile.Center; + velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * velocityMult; + start = false; + } + + center += velocity; + + float flyInwardGateValue = 240f; + + float amount3 = 1f - projectile.localAI[0] / flyInwardGateValue; + if (amount3 < 0f) + amount3 = 0f; + + bool changeXPos = projectile.ai[0] == 14f; + + float units = 6f; + + distances[0] += MathHelper.Lerp(1f, units, amount3); + + if (projectile.localAI[0] > flyInwardGateValue) + { + distances[2] = changeXPos ? Math.Abs(center.X - projectile.Center.X) : Math.Abs(center.Y - projectile.Center.Y); + + if (distances[3] == 0D) + distances[3] = distances[2] - units * 10f; + + distances[3] += changeXPos ? velocity.X : velocity.Y; + + distances[1] -= distances[2] < (units * 10f) ? distances[2] * 0.1f : MathHelper.Lerp(units, units + 2f, (float)(distances[2] / distances[3])); + } + else + { + float slowDownGateValue = 30f; + + if (projectile.localAI[0] > flyInwardGateValue - slowDownGateValue) + velocity *= 1f - velocityMult / slowDownGateValue; + + distances[1] = distances[0]; + } + + double distanceX = changeXPos ? distances[1] : distances[0]; + double distanceY = changeXPos ? distances[0] : distances[1]; + + double rad3 = MathHelper.ToRadians(projectile.ai[1]); + + projectile.position.X = center.X - (int)(Math.Sin(rad3) * distanceX) - projectile.width / 2; + projectile.position.Y = center.Y - (int)(Math.Cos(rad3) * distanceY) - projectile.height / 2; + + projectile.localAI[0] += 1f; + + if (projectile.localAI[0] > 600f) + projectile.Kill(); + + break; } } - public override Color? GetAlpha(Color lightColor) + private void WavyMotion(float frequency, float amplitude, bool useSin) + { + if (start) + { + velocity = projectile.velocity; + start = false; + } + + projectile.ai[1] += frequency; + + if (amplitude == 0f) + amplitude = velocity.Length(); + + float wavyVelocity = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); + + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + } + + private void LurchForward(float frequncy, float deceleration, float acceleration) + { + projectile.ai[1] += frequncy; + + projectile.velocity *= MathHelper.Lerp(deceleration, acceleration, (float)Math.Abs(Math.Sin(projectile.ai[1]))); + } + + private void LurchForwardOnTimer(float slowGateValue, float fastGateValue, float minVelocity, float maxVelocity, float deceleration, float acceleration) + { + projectile.ai[1] += 1f; + + if (projectile.ai[1] <= slowGateValue) + { + if (projectile.velocity.Length() > minVelocity) + projectile.velocity *= deceleration; + } + else if (projectile.ai[1] < slowGateValue + fastGateValue) + { + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= acceleration; + } + else + projectile.ai[1] = 0f; + } + + private void OscillationMotion(float frequncy, bool useSin) + { + if (start) + { + velocity = projectile.velocity; + start = false; + } + + projectile.ai[1] += frequncy; + + float amplitude = velocity.Length(); + + float oscillation = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); + + projectile.velocity.Normalize(); + projectile.velocity *= amplitude * oscillation; + } + + public override Color? GetAlpha(Color lightColor) { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); + switch ((int)projectile.ai[0]) + { + // No AI + case -1: + + return new Color(0, 100, 255, projectile.alpha); + + // Rotate around a point, spread outward and move + case 0: + case 1: + + return new Color(0, 100, 255, projectile.alpha); + + // Lurch forward + case 2: + + return new Color(255, 200, 0, projectile.alpha); + + // Wavy motion + case 3: + case 4: + + return new Color(0, 255, 200, projectile.alpha); + + // Speed up then slow down on a timer + case 5: + case 16: + + return new Color(0, 255, 100, projectile.alpha); + + // Split into 4 projectiles that can use any of the first 6 AIs + case 6: + + return new Color(200, 0, 255, projectile.alpha); + + // Split into 8 projectiles that can use either of the first 2 AIs + case 7: + + return new Color(255, 0, 150, projectile.alpha); + + // Split into 3 wavy projectiles multiple times + case 8: + + return new Color(200, 0, 0, projectile.alpha); + + // idk yet + case 9: + case 10: + + return new Color(255, 255, 0, projectile.alpha); + + // Homing + case 11: + + return new Color(150, 0, 200, projectile.alpha); + + // Rotate around a moving point and spread outward then inward in an oval pattern + case 12: + case 13: + + return new Color(0, 100, 255, projectile.alpha); + + // Spread out then drift inward after some time and then drift outward + case 14: + case 15: + + return new Color(0, 100, 255, projectile.alpha); + } + + return null; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index e75f7c98c1..0a1692cb45 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int fireRate = 2; projectile.ai[1] += 1f; bool flag = false; - if (projectile.ai[1] >= (float)fireRate) + if (projectile.ai[1] >= fireRate) { projectile.ai[1] = 0f; flag = true; @@ -70,10 +70,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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; + Vector2 value3 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value2; if (player.gravDir == -1f) { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + value3.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - value2.Y; } Vector2 vector3 = Vector2.Normalize(value3); if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float velocity = 3f; value2 = projectile.Center; Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocity; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914); if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) { spinningpoint = -Vector2.UnitY; @@ -101,15 +101,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal velocity2.Normalize(); velocity2 *= 5f; } - float SpeedX = velocity2.X + (float)Main.rand.Next(-1, 2) * 0.01f; - float SpeedY = velocity2.Y + (float)Main.rand.Next(-1, 2) * 0.01f; + float SpeedX = velocity2.X + Main.rand.Next(-1, 2) * 0.01f; + float SpeedY = velocity2.Y + Main.rand.Next(-1, 2) * 0.01f; float ai0 = projectile.ai[0] - 2f; // 0, 1, or 2 Projectile.NewProjectile(value2.X, value2.Y, SpeedX, SpeedY, type, weaponDamage2, projectile.knockBack, projectile.owner, ai0, 0f); } else { - gatlingLaserLoop.Stop(); + if (gatlingLaserLoop != null) + gatlingLaserLoop.Stop(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireEnd"), (int)projectile.position.X, (int)projectile.position.Y); + projectile.Kill(); } } @@ -122,7 +125,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } } } diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs new file mode 100644 index 0000000000..9e418aff11 --- /dev/null +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ForbiddenOathbladeProjectile : ModProjectile + { + 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + aiType = ProjectileID.DemonScythe; + } + + 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) + { + 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; + } + } +} diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.png b/Projectiles/Melee/ForbiddenOathbladeProjectile.png new file mode 100644 index 0000000000000000000000000000000000000000..e594d983b1e1e40a9b17d1ccb431a54f7a6be5f8 GIT binary patch literal 792 zcmeAS@N?(olHy`uVBq!ia0vp^W+2SL1|)l2v+go5Fx~ZZaSX|Demm3NTh>wJXzfzh z4c%+kwsJTv>Q!rPRaoz<;QEO(C*EO85KHb~mW={iYB@B6jx0GTFVJ)}`*N1Jjt;Nn z58FGNtM9)#H$(9F*5W(6i_cpYpWnN=>=;vh+?h4^@9@RWnX{rM`1{L{r&a$yl|TJ; zz1zO^>*ddL{XDuH9siqE6&%>N-?GT-%ei{XMN-Ttl>*XrF-at`yBX{Ryg zBv)SFxo}=&sbi{CYJvo7qTlt`cI}f^*=%j|PAb#b_xI&q;p`O=Wd}qAd>$K3OPYG^ zyS#W|w722c2ET6y3U*GH-zQqJJbxv37H`Je0~>ZNInTN>@b%vvOTKMA|6Yts&ng7y zs2yCJ=d9OX$a89u#;J_@hbyw>5AWTw_C-R2(5fX@zt0G?zR7&K&T(O+aNE%xT5N@T z=HCjuo_gq`<~m`{%B*@>t!cIf^Ro-vrWVe)Ts>K?wD%xt~Bv-R|DyeKLF>mtkz%nn}ovFqo|12yK4FC1}tTw|WQ_TzEpGrQz}#%P6f?kaqBXkX2q z`|nC0@80xvSA$b0-@owO%SVFj?=yLyt$0(nHfbZzvc7y#qB!TnHtt{KvNz4$zR?z# R-Wfby{an^LB{VTG004n1fB*mh literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index 95bf1d44e0..416d3324ae 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -24,22 +24,20 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.tileCollide = true; - projectile.penetrate = 3; + projectile.penetrate = 1; aiType = ProjectileID.DemonScythe; } 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) { - target.immune[projectile.owner] = 10; target.AddBuff(BuffID.OnFire, 180); target.AddBuff(BuffID.ShadowFlame, 180); } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index ba38ea934b..0aaa5a42cc 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Tiles (ushort)ModContent.TileType(), }; - 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; + } - public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) + public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) { // Custom plant framing for (int k = 0; k < PlantTypes.Length; k++) From f1e7bf315cce0b30e4e057c929e6037ad51ba47a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 11:02:22 -0400 Subject: [PATCH 003/137] I will balance your weapon --- CalamityMod.cs | 23 +++++++++++++++++-- Items/CalamityGlobalItem.cs | 10 ++++---- Items/Weapons/Magic/CalamitasInferno.cs | 2 +- Items/Weapons/Magic/PrimordialEarth.cs | 2 +- Items/Weapons/Magic/TearsofHeaven.cs | 2 +- Items/Weapons/Magic/TerraRay.cs | 6 ++--- Items/Weapons/Magic/Wingman.cs | 6 ++--- Items/Weapons/Magic/WintersFury.cs | 6 ++--- Items/Weapons/Melee/AegisBlade.cs | 6 ++--- Items/Weapons/Melee/ArkoftheCosmos.cs | 2 +- Items/Weapons/Melee/FlameScytheMelee.cs | 2 +- Items/Weapons/Melee/HellfireFlamberge.cs | 6 +++-- .../Weapons/Melee/TruePaladinsHammerMelee.cs | 2 +- Items/Weapons/Melee/VirulentKatana.cs | 7 ++++++ Items/Weapons/Ranged/CursedCapper.cs | 2 +- Items/Weapons/Ranged/HeavenlyGale.cs | 8 +++---- Items/Weapons/Ranged/MagnomalyCannon.cs | 2 +- Items/Weapons/Ranged/Photoviscerator.cs | 2 +- Items/Weapons/Rogue/DeepWounder.cs | 2 +- Items/Weapons/Rogue/FlameScythe.cs | 2 +- Items/Weapons/Rogue/ShockGrenade.cs | 2 +- Items/Weapons/Rogue/TruePaladinsHammer.cs | 2 +- Items/Weapons/Summon/SpikecragStaff.cs | 2 +- Projectiles/Magic/DivineRetributionSpear.cs | 2 +- Projectiles/Magic/ShiftingSandsProj.cs | 1 + Projectiles/Magic/UndinesRetributionSpear.cs | 3 ++- Projectiles/Melee/Spears/DiseasedPikeSpear.cs | 4 ++-- Projectiles/Summon/Spikecrag.cs | 8 +++---- 28 files changed, 76 insertions(+), 48 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 4392302c2c..a19e84b63c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -148,7 +148,9 @@ namespace CalamityMod public static List thirtyThreeDamageBuffList; //33% buff public static List twentyFiveDamageBuffList; //25% buff public static List twentyDamageBuffList; //20% buff + public static List tenDamageBuffList; //10% buff public static List weaponAutoreuseList; + public static List tenDamageNerfList; //10% nerf public static List quarterDamageNerfList; //25% nerf public static List pumpkinMoonBuffList; public static List frostMoonBuffList; @@ -359,7 +361,9 @@ namespace CalamityMod fiftyDamageBuffList = null; thirtyThreeDamageBuffList = null; twentyFiveDamageBuffList = null; + tenDamageBuffList = null; weaponAutoreuseList = null; + tenDamageNerfList = null; quarterDamageNerfList = null; pumpkinMoonBuffList = null; frostMoonBuffList = null; @@ -1308,6 +1312,12 @@ namespace CalamityMod ItemID.TacticalShotgun }; + tenDamageBuffList = new List() + { + ItemID.MagnetSphere, + ItemID.BatScepter + }; + weaponAutoreuseList = new List() { ItemID.NightsEdge, @@ -1325,12 +1335,21 @@ namespace CalamityMod ItemID.StylistKilLaKillScissorsIWish }; + tenDamageNerfList = new List() + { + ItemID.Razorpine, + ItemID.Phantasm, + ItemID.PossessedHatchet, + ItemID.Xenopopper + }; + quarterDamageNerfList = new List() { ItemID.DaedalusStormbow, ItemID.PhoenixBlaster, - ItemID.BlizzardStaff, - ItemID.DD2BetsyBow + ItemID.DD2BetsyBow, + ItemID.InfluxWaver, + ItemID.LaserMachinegun }; pumpkinMoonBuffList = new List() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 1788e73095..727c8969dd 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Items if (item.type == ItemID.PsychoKnife || item.type == ItemID.TaxCollectorsStickOfDoom) item.damage *= 4; - else if (item.type == ItemID.SpectreStaff) + else if (item.type == ItemID.SpectreStaff || item.type == ItemID.ShadowbeamStaff) item.damage *= 3; else if (CalamityMod.doubleDamageBuffList?.Contains(item.type) ?? false) item.damage *= 2; @@ -103,16 +103,16 @@ namespace CalamityMod.Items item.damage = (int)(item.damage * 1.25); else if (CalamityMod.twentyDamageBuffList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 1.2); - else if (item.type == ItemID.MagnetSphere) + else if (CalamityMod.tenDamageBuffList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 1.1); - else if (item.type == ItemID.Razorpine) - item.damage = (int)(item.damage * 0.95); - else if (item.type == ItemID.Phantasm) + else if (CalamityMod.tenDamageNerfList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 0.9); else if (item.type == ItemID.LastPrism) item.damage = (int)(item.damage * 0.85); else if (CalamityMod.quarterDamageNerfList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 0.75); + else if (item.type == ItemID.BlizzardStaff) + item.damage = (int)(item.damage * 0.7); else if (item.type == ItemID.StardustDragonStaff) item.damage = (int)(item.damage * 0.5); diff --git a/Items/Weapons/Magic/CalamitasInferno.cs b/Items/Weapons/Magic/CalamitasInferno.cs index 4dcc74056d..3a185591b2 100644 --- a/Items/Weapons/Magic/CalamitasInferno.cs +++ b/Items/Weapons/Magic/CalamitasInferno.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 88; + item.damage = 65; item.magic = true; item.mana = 20; item.width = 28; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index b072a3b452..cc05f17ec5 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 85; + item.damage = 69; item.magic = true; item.mana = 19; item.width = 30; diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 8260868d13..a7cf96e957 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 72; + item.damage = 65; item.magic = true; item.mana = 18; item.width = 28; diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index 031da444c2..c7e8c7bdb9 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 85; + item.damage = 60; item.magic = true; item.mana = 10; item.width = 54; item.height = 54; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 22; + item.useAnimation = 22; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 79654df9c4..ec57668e40 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 54; + item.damage = 49; item.magic = true; item.mana = 12; item.width = 42; @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Magic public override bool 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) + int beamAmt = 3; + for (int index = 0; index < beamAmt; ++index) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 507186bdd0..b69736bc4f 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Magic } public override void SetDefaults() { - item.damage = 69; + item.damage = 59; item.magic = true; item.mana = 7; item.width = 28; item.height = 30; - item.useTime = 9; - item.useAnimation = 9; + item.useTime = 12; + item.useAnimation = 12; item.useStyle = 5; item.useTurn = false; item.noMelee = true; diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 8bf4f7a002..0ad7576f0c 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); return false; } @@ -78,12 +78,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 1c0cb4657f..d36fddba5a 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 102; - item.damage = 500; + item.damage = 501; item.melee = true; item.useAnimation = 15; item.useTime = 15; diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs index 3d88b310f4..5ded2dbf1f 100644 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ b/Items/Weapons/Melee/FlameScytheMelee.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 50; - item.damage = 100; + item.damage = 90; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index bd81d77d35..1423a1a1a6 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 58; - item.damage = 102; + item.damage = 90; item.melee = true; item.useAnimation = 20; item.useStyle = 1; @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + float damageMult = 0.5f; switch (index) { case 0: @@ -51,11 +52,12 @@ namespace CalamityMod.Items.Weapons.Melee break; case 2: type = ModContent.ProjectileType(); + damageMult = 0.75f; break; default: break; } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index 22f27ca5af..63838e1415 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 14; - item.damage = 101; + item.damage = 81; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Melee/VirulentKatana.cs b/Items/Weapons/Melee/VirulentKatana.cs index 3cd73e7d04..b5a69bb3a9 100644 --- a/Items/Weapons/Melee/VirulentKatana.cs +++ b/Items/Weapons/Melee/VirulentKatana.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +34,12 @@ namespace CalamityMod.Items.Weapons.Melee 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); + return false; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs index 60432e1d28..a5527fb801 100644 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ b/Items/Weapons/Ranged/CursedCapper.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 24; + item.damage = 35; item.ranged = true; item.width = 44; item.height = 32; diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 7807f30b9e..17fc45cac9 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 720; + item.damage = 740; item.ranged = true; item.width = 44; item.height = 58; @@ -66,8 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged case 1: case 2: case 3: - type = ModContent.ProjectileType(); - dmg = 0.16f; + type = ModContent.ProjectileType(); break; case 4: case 5: @@ -76,7 +75,8 @@ namespace CalamityMod.Items.Weapons.Ranged break; case 7: case 8: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); + dmg = 0.5f; break; case 9: type = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index e130db7130..46b8b7340f 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1600; + item.damage = 1450; item.ranged = true; item.width = 84; item.height = 30; diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 364b0bf5c4..0442c34c4f 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 270; + item.damage = 250; item.ranged = true; item.width = 84; item.height = 30; diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 940802e836..9b33d8e8bb 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 52; - item.damage = 125; + item.damage = 106; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 23; diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index f717c72d5f..55d7aa87c8 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 50; item.height = 48; - item.damage = 100; + item.damage = 90; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 3d44ae0a60..f607055862 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 14; - item.damage = 100; + item.damage = 90; item.noMelee = true; item.noUseGraphic = true; item.consumable = true; diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.cs b/Items/Weapons/Rogue/TruePaladinsHammer.cs index d8bfd06b6b..eeaee61fc5 100644 --- a/Items/Weapons/Rogue/TruePaladinsHammer.cs +++ b/Items/Weapons/Rogue/TruePaladinsHammer.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 14; - item.damage = 101; + item.damage = 81; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 2445b8f8a1..e59accbe2a 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 70; + item.damage = 56; item.mana = 10; item.summon = true; item.sentry = true; diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index e7eb11bab2..0bf105abfc 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f); } else { diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index 08bd36ca4d..dc559f92c3 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.penetrate = 5; projectile.magic = true; + projectile.extraUpdates = 2; } public override void AI() diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index 3fcf1ad3b5..f001ca983d 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f); } else { @@ -102,6 +102,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 21, 1f, 0f); for (int num193 = 0; num193 < 4; num193++) diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 0dad8c1115..af0042f9e7 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -38,13 +38,13 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 360); if (projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 0c1125258e..ac1bb7e4e3 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -24,8 +24,6 @@ namespace CalamityMod.Projectiles.Summon projectile.sentry = true; projectile.timeLeft = Projectile.SentryLifeTime; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; } public override void AI() @@ -80,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (projectile.owner == Main.myPlayer && homeIn) + if (projectile.owner == Main.myPlayer && homeIn && projectile.velocity.Y == 0f) { if (projectile.ai[0] != 0f) { @@ -90,12 +88,12 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += 1f; if ((projectile.ai[1] % 10f) == 0f) { - int amount = Main.rand.Next(6, 10); + int amount = Main.rand.Next(5, 8); 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, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.80), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } From 292404a42fd5bc262d850b1821679f43ab806dc4 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 11:44:41 -0400 Subject: [PATCH 004/137] cryogen now has a 1% chance to derp out --- NPCs/Cryogen/Cryogen.cs | 23 +++++++++++++++++++++-- NPCs/Polterghast/Polterghast.cs | 4 ++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index de1ddf84f8..1d08d8921f 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -23,7 +24,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Cryogen { [AutoloadBossHead] @@ -732,6 +732,25 @@ namespace CalamityMod.NPCs.Cryogen teleportLocationX = 0; iceShard = 0; npc.netUpdate = true; + + int chance = 100; + if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) + { + chance = 20; + } + if (Main.rand.NextBool(50)) + { + 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 if (npc.ai[0] == 5f) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 775ca97e0a..f029d0aaf8 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; @@ -23,7 +24,6 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Polterghast { [AutoloadBossHead] From 7beeb929d1d5838db913b4b53ddf3f17daa4480d Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 11:49:32 -0400 Subject: [PATCH 005/137] gdi Ein forgot Archery Pot undid gale buff --- Items/Weapons/Ranged/HeavenlyGale.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 17fc45cac9..7807f30b9e 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 740; + item.damage = 720; item.ranged = true; item.width = 44; item.height = 58; @@ -66,7 +66,8 @@ namespace CalamityMod.Items.Weapons.Ranged case 1: case 2: case 3: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); + dmg = 0.16f; break; case 4: case 5: @@ -75,8 +76,7 @@ namespace CalamityMod.Items.Weapons.Ranged break; case 7: case 8: - type = ModContent.ProjectileType(); - dmg = 0.5f; + type = ModContent.ProjectileType(); break; case 9: type = ModContent.ProjectileType(); From 0b352d6769004c28340ddb1749f758d4c4268c97 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 13:53:55 -0400 Subject: [PATCH 006/137] more balancing lulw and resist fix --- Items/Weapons/Melee/HellionFlowerSpear.cs | 2 +- Items/Weapons/Rogue/DefectiveSphere.cs | 2 +- Items/Weapons/Rogue/FantasyTalisman.cs | 4 +- Items/Weapons/Rogue/FrostcrushValari.cs | 2 +- Items/Weapons/Summon/GodspawnHelixStaff.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 10 +- Projectiles/Rogue/FantasyTalismanProj.cs | 129 ++----------------- Projectiles/Rogue/FantasyTalismanStealth.cs | 134 ++------------------ 8 files changed, 28 insertions(+), 257 deletions(-) diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 6b8e85471c..c261d3e6e6 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 64; - item.damage = 120; + item.damage = 135; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 8c0aa9e116..5e994416f4 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DefectiveSphere : RogueWeapon { - public static int BaseDamage = 115; + public static int BaseDamage = 130; public static float Speed = 15f; public override void SetStaticDefaults() diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 4201d9f041..fc2b07cbb1 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -20,7 +20,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void SafeSetDefaults() { item.width = 34; - item.damage = 80; + item.damage = 90; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -57,7 +57,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); recipe.AddIngredient(ItemID.Silk, 3); recipe.AddIngredient(ItemID.Ectoplasm, 5); recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); + recipe.SetResult(this, 150); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 4f258e2366..40be84c827 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -21,7 +21,7 @@ Stealth strikes throws three short ranged boomerangs along with a spread of icic public override void SafeSetDefaults() { - item.damage = 70; + item.damage = 100; item.knockBack = 12; item.thrown = true; item.crit = 16; diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index f14ce99263..dab100d2ad 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 50; + item.damage = 60; item.mana = 10; item.width = 50; item.height = 50; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ddf6ba4e55..80ad7c3b3e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3431,13 +3431,6 @@ namespace CalamityMod.NPCs } } - NPCResists(npc, projectile, damage); - } - - #region NPC Resists - private void NPCResists(NPC npc, Projectile projectile, int damage) - { - Player player = Main.player[projectile.owner]; if (AstrumDeusIDs.Contains(npc.type)) { if (projectile.type == ModContent.ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) @@ -3549,7 +3542,7 @@ namespace CalamityMod.NPCs { if (projectile.penetrate == -1) projectile.penetrate = 1; - damage = (int)(damage * 0.01); + damage = (int)(damage * 0.1); } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) @@ -3615,7 +3608,6 @@ namespace CalamityMod.NPCs } } } - #endregion #endregion #region On Hit By Item diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 24c18b7275..5d14ce2f96 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Projectiles.Rogue { public class FantasyTalismanProj : ModProjectile { - int spiritTimer = 0; - public override void SetStaticDefaults() { DisplayName.SetDefault("Talisman"); @@ -26,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = -1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; @@ -41,64 +39,25 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } + CalamityUtils.StickyProjAI(projectile, 15); if (projectile.ai[0] == 1f) { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = 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(); - } - spiritTimer++; - if (spiritTimer >= 10) + if (projectile.timeLeft % 10 == 0) { - spiritTimer = 0; if (Main.rand.NextBool(2)) { int spiritDamage = projectile.damage / 2; - int[] numArray1 = new int[200]; + int[] numArray1 = new int[Main.maxNPCs]; int maxValue1 = 0; int maxValue2 = 0; - for (int index = 0; index < 200; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].CanBeChasedBy((object) projectile, false)) { - float num2 = Math.Abs(Main.npc[index].position.X + (float) (Main.npc[index].width / 2) - projectile.position.X + (float) (projectile.width / 2)) + Math.Abs(Main.npc[index].position.Y + (float) (Main.npc[index].height / 2) - projectile.position.Y + (float) (projectile.height / 2)); - if ((double) num2 < 800.0) + float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); + if (num2 < 800f) { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) num2 > 50.0) + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) { numArray1[maxValue2] = index; ++maxValue2; @@ -121,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue float num8 = (float) (num4 / num7); float SpeedX = num5 * num8; float SpeedY = num6 * num8; - int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float) num3, 0.0f); + int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float)num3, 0f); Main.projectile[ghost].Calamity().forceRogue = true; Main.projectile[ghost].penetrate = 1; } @@ -137,75 +96,7 @@ namespace CalamityMod.Projectiles.Rogue 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); - int num28 = 3; - 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(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 3, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 3e9d0511c6..4b6a606947 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -9,9 +9,6 @@ namespace CalamityMod.Projectiles.Rogue { public class FantasyTalismanStealth : ModProjectile { - int spiritTimer = 0; - int stealthTimer = 10; - public override void SetStaticDefaults() { DisplayName.SetDefault("Talisman"); @@ -27,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = -1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; @@ -44,8 +41,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] != 1f) { - stealthTimer--; - if (stealthTimer == 0) + if (projectile.timeLeft % 10 == 0) { if (projectile.owner == Main.myPlayer) { @@ -54,67 +50,27 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[sGhost].penetrate = 1; Main.projectile[sGhost].timeLeft = 240; } - stealthTimer = 10; } } + CalamityUtils.StickyProjAI(projectile, 15); if (projectile.ai[0] == 1f) { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = 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(); - } - spiritTimer += 3; - if (spiritTimer >= 10) + if (projectile.timeLeft % 4 == 0) { - spiritTimer = 0; if (Main.rand.NextBool(2)) { int spiritDamage = projectile.damage / 2; - int[] numArray1 = new int[200]; + int[] numArray1 = new int[Main.maxNPCs]; int maxValue1 = 0; int maxValue2 = 0; - for (int index = 0; index < 200; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].CanBeChasedBy((object) projectile, false)) { - float num2 = Math.Abs(Main.npc[index].position.X + (float) (Main.npc[index].width / 2) - projectile.position.X + (float) (projectile.width / 2)) + Math.Abs(Main.npc[index].position.Y + (float) (Main.npc[index].height / 2) - projectile.position.Y + (float) (projectile.height / 2)); - if ((double) num2 < 800.0) + float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); + if (num2 < 800f) { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) num2 > 50.0) + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) { numArray1[maxValue2] = index; ++maxValue2; @@ -137,7 +93,7 @@ namespace CalamityMod.Projectiles.Rogue float num8 = (float) (num4 / num7); float SpeedX = num5 * num8; float SpeedY = num6 * num8; - int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float) num3, 0.0f); + int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float)num3, 0f); Main.projectile[ghost].Calamity().forceRogue = true; Main.projectile[ghost].penetrate = 1; } @@ -153,75 +109,7 @@ namespace CalamityMod.Projectiles.Rogue 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); - int num28 = 1; - 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(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 1, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) From fe831ad9ff4cc4992051ca6dc28dba460570f0d0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 16:43:03 -0400 Subject: [PATCH 007/137] improved vile feeder and circlet eaters in cramped spaces --- Projectiles/Summon/ForbiddenCircletEater.cs | 7 ++----- Projectiles/Summon/VileFeederProjectile.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 636e4a175d..7b444099d2 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] += 1f; if (projectile.ai[0] > 30f) { - projectile.ai[0] = 30f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -168,6 +167,7 @@ namespace CalamityMod.Projectiles.Summon } else { + projectile.ai[0] += 15f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -180,9 +180,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool CanDamage() - { - return projectile.ai[0] >= 30f; - } + public override bool CanDamage() => projectile.ai[0] >= 30f; } } diff --git a/Projectiles/Summon/VileFeederProjectile.cs b/Projectiles/Summon/VileFeederProjectile.cs index fd7222d7a2..ab7a7be023 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] += 1f; if (projectile.ai[0] > 30f) { - projectile.ai[0] = 30f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -168,6 +167,7 @@ namespace CalamityMod.Projectiles.Summon } else { + projectile.ai[0] += 15f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; From 4f5e85230e04befcffaa4ebfa8231a586f973038 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 18:20:25 -0400 Subject: [PATCH 008/137] cryogen fix --- Items/Weapons/Melee/FlameburstShortsword.cs | 4 ++-- Items/Weapons/Melee/GaelsGreatsword.cs | 2 +- Items/Weapons/Melee/StellarStriker.cs | 4 ++-- NPCs/Cryogen/Cryogen.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Items/Weapons/Melee/FlameburstShortsword.cs b/Items/Weapons/Melee/FlameburstShortsword.cs index 4344dbd2b9..1065f8462f 100644 --- a/Items/Weapons/Melee/FlameburstShortsword.cs +++ b/Items/Weapons/Melee/FlameburstShortsword.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.life <= (target.lifeMax * 0.5f)) { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[boom].Calamity().forceMelee = true; } } @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.statLife <= (target.statLifeMax2 * 0.5f)) { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[boom].Calamity().forceMelee = true; } } diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 6869251532..70ad9a4f41 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(p.ToWorldCoordinates(8f, 0f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) { player.Calamity().gaelSwipes++; if (player.statLife <= player.statLifeMax2 * 0.5f) diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 2374549080..b9f097c495 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee 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)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); Main.projectile[proj].Calamity().forceMelee = true; } } @@ -134,7 +134,7 @@ namespace CalamityMod.Items.Weapons.Melee 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)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5), item.knockBack, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), item.knockBack, i, 0f, (float)Main.rand.Next(3)); Main.projectile[proj].Calamity().forceMelee = true; } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 1d08d8921f..0c95a6bc4c 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -738,7 +738,7 @@ namespace CalamityMod.NPCs.Cryogen { chance = 20; } - if (Main.rand.NextBool(50)) + if (Main.rand.NextBool(chance)) { string key = "Mods.CalamityMod.CryogenBossText"; Color messageColor = Color.Cyan; From 5d619228277a2ea9eedaf479d72f7bc334921bb2 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 19:00:21 -0400 Subject: [PATCH 009/137] added lion heart --- Buffs/Cooldowns/EnergyShellCooldown.cs | 24 ++++++ Buffs/Cooldowns/EnergyShellCooldown.png | Bin 0 -> 551 bytes CalPlayer/CalamityPlayer.cs | 7 ++ Items/CalamityGlobalItem.cs | 8 ++ Items/Weapons/Melee/LionHeart.cs | 101 ++++++++++++++++++++++++ Items/Weapons/Melee/LionHeart.png | Bin 0 -> 1432 bytes NPCs/CalamityGlobalNPC.cs | 2 + NPCs/Polterghast/Polterghast.cs | 2 + Projectiles/Typeless/EnergyShell.cs | 72 +++++++++++++++++ Projectiles/Typeless/EnergyShell.png | Bin 0 -> 3974 bytes 10 files changed, 216 insertions(+) create mode 100644 Buffs/Cooldowns/EnergyShellCooldown.cs create mode 100644 Buffs/Cooldowns/EnergyShellCooldown.png create mode 100644 Items/Weapons/Melee/LionHeart.cs create mode 100644 Items/Weapons/Melee/LionHeart.png create mode 100644 Projectiles/Typeless/EnergyShell.cs create mode 100644 Projectiles/Typeless/EnergyShell.png diff --git a/Buffs/Cooldowns/EnergyShellCooldown.cs b/Buffs/Cooldowns/EnergyShellCooldown.cs new file mode 100644 index 0000000000..696b9883bf --- /dev/null +++ b/Buffs/Cooldowns/EnergyShellCooldown.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class EnergyShellCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Energy Shell Cooldown"); + Description.SetDefault("Your energy shell 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().energyShellCooldown = true; + } + } +} diff --git a/Buffs/Cooldowns/EnergyShellCooldown.png b/Buffs/Cooldowns/EnergyShellCooldown.png new file mode 100644 index 0000000000000000000000000000000000000000..129de0c0856d7c7cc1f2e4beea84b0402fc22027 GIT binary patch literal 551 zcmV+?0@(eDP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00DJLL_t(o!_Aj1TEjpPhTrAERu+M( zYz}}7l2+m3F!TZ(03;lM3lxLP1=>oG9H5aX1d$wI5zQn|rXA8En)y_l-E8u`J3pI{ zWf=f@o=1+T!6*p;C&zr~E(IV0#JB;F%pU%{Vfgg{KzV*~&~=fF7cWovB%swrWM38Y zI{?z@4FK=Ul@9`^^5b$k0h&Ep&mVzi58oEcy%r3VZKsP@0LHWDo%8(=5a&8-we!xH zsPnn|gug7Xocy;k%6giFmLCF^6U%W?{ny!J z-Cy?rArj7<5ja$l;l@bis8HiNrgYZGe18OVCDf9=l-`l5>z2g1jv;>pMAFqTDqfdk zo&OeDzXWt8>#F^h^DgyHpzen0()] > 0 && player.HeldItem.type == ModContent.ItemType()) + { + damage = (int)(damage * 0.5); } if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 727c8969dd..d9b4b6f305 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -3332,6 +3332,14 @@ Provides heat and cold protection in Death Mode"; public static readonly int RarityDarkBlueBuyPrice = Item.buyPrice(1, 80, 0, 0); public static readonly int RarityVioletBuyPrice = Item.buyPrice(2, 50, 0, 0); public static readonly int RarityHotPinkBuyPrice = Item.buyPrice(5, 0, 0, 0); + + //These duplicates are for my sanity... + public static readonly int Rarity12BuyPrice = Item.buyPrice(1, 20, 0, 0); + public static readonly int Rarity13BuyPrice = Item.buyPrice(1, 40, 0, 0); + public static readonly int Rarity14BuyPrice = Item.buyPrice(1, 80, 0, 0); + public static readonly int Rarity15BuyPrice = Item.buyPrice(2, 50, 0, 0); + public static readonly int Rarity16BuyPrice = Item.buyPrice(5, 0, 0, 0); + public static int GetBuyPrice(int rarity) { switch (rarity) diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs new file mode 100644 index 0000000000..83c22f596b --- /dev/null +++ b/Items/Weapons/Melee/LionHeart.cs @@ -0,0 +1,101 @@ +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class LionHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lion Heart"); + Tooltip.SetDefault("Summons an energy explosion on enemy hits\n" + + "Right click to summon an energy shell for a few seconds that halves all damage sources\n" + + "This has a 45 second cooldown"); + } + + public override void SetDefaults() + { + item.width = 60; + item.height = 62; + + item.damage = 700; + item.knockBack = 5.5f; + item.useStyle = 1; + item.useAnimation = 15; + item.useTime = 15; + item.shootSpeed = 0f; + + item.melee = true; + item.useTurn = true; + item.autoReuse = true; + item.UseSound = SoundID.Item1; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = ModContent.ProjectileType(); + } + else + { + item.shoot = 0; + } + 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) + { + if (player.altFunctionUse == 2) + { + if (!player.Calamity().energyShellCooldown && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + return false; + } + + public override bool? CanHitNPC(Player player, NPC target) + { + if (player.altFunctionUse == 2) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player player, Player target) => player.altFunctionUse != 2; + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int explosion = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0f); + Main.projectile[explosion].Calamity().forceMelee = true; + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + int explosion = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, 0f); + Main.projectile[explosion].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, 132); + } + } + } +} diff --git a/Items/Weapons/Melee/LionHeart.png b/Items/Weapons/Melee/LionHeart.png new file mode 100644 index 0000000000000000000000000000000000000000..c3ed56d78b6ac580ffbe01a3dfe7f8f245c89217 GIT binary patch literal 1432 zcmV;J1!ww+P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00ibqL_t(&-tC&rPh3?Pho1`!1C$vC zDU3i7DU_Br##jy78f}%9ZkjGkSH`Ft6Z;34xN&9Fq)QWH;=ji#wJ z)>r~l5p1UwC?6vOLxBN@adCJ%oWs2^Wri~5-e)tpA9I<@liz#ZbMCeHpV7FZN!t#T z6$6l%Po>xTUQ^HlplGXa;C@rG)juEy(g2D16abwql>j{c^i#Gce|i1_;2ADlB)cmz z3uMd+AD;aVfKx9WvAvFGxX=)@!B7Z*>3BR18MBwK&j6V!ET2xe&ajpHB{l~qv-|cx z20-tX-vFo$mRkVh({pK9on5KUH8mj%Txhu9GMug1P?ZYn_|$Y7;OK$Y&7Eba(`S?!z70dGCMlDX`k?rM{bh3k`4jIBd>eg+M@MZdcnb07l1RDw9VJ z0&sm~7=XVnsVp8p(FMSTAA13K?ZxM{>xtR6)`u*Bfk9(O(*SRE?9q@Ph%06e?5X3gu%IGe3m!84pIVz#Qf8i1+E$uvOZST_K#rKYrk45!0NUHt=b4W_0W#ItWM@+tSighH z7S|chxtDe_`|2w%1DTFV%nGMZe+)ofs94)?j<;{TcMgEPE#aKZ3a&GJ&lz^=jaeRV zoy%ME*m?-g@3QE)PAny=rjGCSdLeKDJBb_LfN&ZSD*t|~6ZZUY&! zf^=5WGfQ%)&b%rIo z6_x6_?Ci{p?QBT+{pYLt_gfpaZOM9Plm0(H`_m8rVSmyBxH34F*BkZ>o2>UVPfVHF z6im~{AMt71mv5;R5Ha0zH3C3RbK2}ksW)Z44m@i?&g)i+z*XIMHZr}br(), CalamityWorld.downedPolterghast); } if (type == NPCID.Pirate) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index f029d0aaf8..5e41ac1b95 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -706,6 +706,8 @@ namespace CalamityMod.NPCs.Polterghast DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPolterghast); DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedPolterghast, 6, 3, 2); + npc.Calamity().SetNewShopVariable(new int[] { NPCID.Cyborg }, CalamityWorld.downedPolterghast); + // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { diff --git a/Projectiles/Typeless/EnergyShell.cs b/Projectiles/Typeless/EnergyShell.cs new file mode 100644 index 0000000000..d819990126 --- /dev/null +++ b/Projectiles/Typeless/EnergyShell.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class EnergyShell : ModProjectile + { + private bool playedSound = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Shell"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 72; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.penetrate = -1; + } + + public override void AI() + { + if (!playedSound) + { + Main.PlaySound(SoundID.Item92, (int)projectile.position.X, (int)projectile.position.Y); + playedSound = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + if (projectile.timeLeft < 51) //fade out + { + projectile.alpha += 5; + } + Player player = Main.player[projectile.owner]; + projectile.Center = player.Center; + //if player is dead, null, or stops holding the Lion Heart, kill the projectile + if (player.dead || player is null || player.HeldItem.type != ModContent.ItemType()) + { + projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + Main.PlaySound(SoundID.Item94, (int)projectile.position.X, (int)projectile.position.Y); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(45f)); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/EnergyShell.png b/Projectiles/Typeless/EnergyShell.png new file mode 100644 index 0000000000000000000000000000000000000000..5ed22b9704e8f14ceb4274f279eb5e1a5160ac75 GIT binary patch literal 3974 zcmV;14|(v3P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^01nhiL_t(|+U;FCvlYh?{ss;pA(e0f zfdl=3ONawg3Iq{Kt*T3=P!L#|1Bc)r;0y&oNCs7Q;=qb@6{ti)=6ipDLMsv2vUo}B zV7K?|%+5^r%s$SZ?fI%G&hFjE%zQhK?&$|mur8S1nd;w_^*3{g&WD~+1)fzQ4fg%? z-jQ%>)Tb>NK1R8FQkfcFCSWkbiWw#JnRWXj$E<-2<2;99Tn(ce!8Ou8>1R6B(%UbF z8?CufUBq}{Gy=E94Rh>=%QVk$5`!)ZqpA4(i$4JXzP2fWnehkJeV9L0?CEtoZrO%7&lu9(p+ynT`8 z%ZFb+!psPb5up{6bzB%-3{pqmzm**9ifa1R zFuJCSR)|PeYpQ4zrJ`%YK33EqLnhwGie@2MdO1NopSkntR5)nI(M#6*Q=x{@l!`{@ zsii{=qs!MY$Ppch3!@$^Q=c0GNjpVT&tR_kGZ#0m-Ua}C_1%5zd|@<%kG}W}zufJIV(W z&Az?89o{nBDZMi3C3!b3{S6~YJG^aR)Fx03qbbtMR9+IyTg6tMQ4~faNNZ6?cf;BX zg|CzCbO)e@(G=gb+?g`e;?hxl6bo?0jJlB9*6+6Lh0z*g+SG^sKGah<^ql6bY~`hf zQTgg6)mtI*q(NoLTstdbl#^Dt7Ic_C#5wQ(Pw>k7|MqRu?&+vvbR4-Y}NTkrb|{?}Ys;xJ^vWUPFm^J0ie{-HI~hd5_|@%yk!MqNmKs=Z&reY|e~;1=HX z-gJc50D$XwUeyn|*u1Rm!}0efGOUPE0q(TkbtsQF2r> z+MW^KE7Fv+$Q}I)qc$WuqofwjwL|LI;pWZfMZ-{|uVH9f=CFDWz_UVO`ewFg)0Ri6 zHn2p$@gdk6kE@pefJ2t7ect%1q?ggE>J54p zbFMtOebTgyevJzNfNMA#U5OP&-4h)~y`x&F#ioX*T;95OllnNN)McsGE9&Yx6f-9EJuR&3@88 zYhiS8XvT({-1OR-4H^uM8hYglzSsld@ep3Pc9fOZ?rv7`Q|8+GDY8W+ls{aB2 z?&3YGrBZb=Q^VENyNq_q>n*1qMnf&NbVfrs!fOKn*YVssuZGdys2kG3&>l?B*KA=p z!kcYXnvw#F7&Vn=i`%-Ozr#Ig#<~!seKb^FHH@-aK#v{mu6NhGn);w^MRT1hMx%Qf zk(RPBbsPqozdQC%0DuSh*>sOXx+67=8g32gyT?8nIO-<)ypfbb@@VT-VJ<}P)5j>S zd}w9ik>Gpx%HAOMZIgN-X6?l5VYGK9J^sNke^CBC-1`cnU5t?lF9{y+!lBPEjCPTd zBe?xb;rgzIYz&tv8KygZQshhC zY8j<*kAx_Ua^P(5+ZW8F2jRu>Uv;aF>3`)21$V3d`y^61k7rfT)1O*=@w z%=m)b=UW-wRWa&iGSZ@)Z#UQC(!US&M77GPhS6ZFN%uND&q|dqQ@@C;xDaX>ox%cp z>ZMSYc2W(aMzG>YTKQbgB=i`A=gs<{crtCl$%~UpCkDZ_t!Omo%AtzUP)qsuOPiLv z@%ukaS}=M~g47a)Dn_%SrG9wj{rbn#*~%L2t1k0;Z2{@W&^QNEBT_!EG^Li&O@iFH zREWx_htbaONwj%Ofl5Zb*wrXIHVUHzcT}F+lgWb;harX(>1C&#RUpljtk1w6#$n)4 zbVe92d&i=ohf&XHwkWA3)mFdK?mxO2OUt$Zl&sId9{PCaLKUMStV0lOpoY;?sF@S9 zcZ@2wm$_J|VbpLjuMv<-7p$>|uY774jg7jC(lAI@aGzZL)O%hHqb9*ZY^i*pM8(_q4*=i+UQQKrEG;iM^Mw^gDcU*31Pet{md5s+vaA8r$WO@{&9YVpgoYr z2xCja&W~2PM0M$)Fbb#Tq&e+#V_~y)z2luaePaGU=kvtO#lt-Ji_tRH%y0i07@FLPitk(Op51 z`@*Y*RKw{0%%cH#G7L4fu)jQ&j1tyj?P)Wme~k;?oQ8zL=u$zM31|<9 za1CecAKJBmL#$GEf@8b|0Nlh20NZ)Amrb)Rz1EdcXob;cn4`R8JDz1}kLP2YF->_Z z064(uZB@`zr2~D8x*&#WlzXzH0`}+ay3c*%^u-hW68+ZnGV1QNxbxKlA+i)#!>G8T zRaK1^>vj~FOG(;}!e|E-c0PN~Q_)pm@1&O&MN{ub*Eem^KHfb@cfhqtFQuYu!)hv8 z;bPQoaWxg?uz&MtGun1Cw0kdWH6zV&VbsMDUe`Zp{@U?ADeZK-{W7E(QNyTsWz^9Q zdUupVHh?EcTazBZ{!)5-JIxn$A9Z$;TXg}L&!IrK(>0Vg;%IRxjO;HYrj)l5rpz3=Mx^n5nh}6|5|G5 z`Hai`U36z=&zVO>E2LazNh+Z}{X_FQvH|QcE%i18P#Eoik8)$3zk-bcfIm0#;l<{% z>v+!Tc$k9LOp^^@M?=r8q;z>3j=9#gtty>SG89FJKsx~(^Tg}{P8+~$1L*bjR>Ww) zVtLyh0~rxy>sZUyxoayeNa0vO&kiMCA$8O?<$O^@U8b)JTpQYpoY<4A0*YJ~I&JFPylIc|K~nAqvi)0190m@07^OZ*n(z+1T#cPYD;FL8u1GFb!)RO4@9`_X z$FIE$j4{@~rGfK~=v8#>*tj-*xqBmXgZid4s=6LVJ8^TZ(dz+zu7C7&O7nV0^x`n^ zwHD)r>A0 z9Sbr5avhf%M$4wh(F{$R~~Tzyq>Gr+RCMG#`c0Aefa*LIkO%0P$F6p7&Ow>m8_J zv|w#8k$8YnD^8Do)qCMwwnF|qRJusb zw{87B^abTIt%gw}9X&nZ_ESeMt91}!Hn4J2!)R>pMXIwInzvN?MOg1~`>=;$o!*8U z${=^Gk^HaWY$(&Y6jLvSq+W(PJ()J!*kI?0QEA^C)r+EI5jJcTFFGS<-sxxrM15f@ z>BO@#N|LhN`_(YIA^X-A-~BCm1GOBhhILLrGN>2wTd09VbnzCtEdiXZX{TBdZC8VScEFV@|;HF@P3IZ8TDd` zUcf?>dDIJcRCeXf9mHV}t&l#s`YC|zUW^(>jUex6do8egMkDiSRPU>X(KS^xnw@%0 z6^+8To3>~#iCpMm)FbaLDr3)Bw)%P)l~1Gl4LyuvA$@UbsA4pPy%j`#P{Zgc)Xa(5 zJ4V&r%iJ5NVKhari|+Xa>UWDg3dBd<+)MU6BhljGEj?6>~#S&Zv!r8b;T& z){WZzs$$e?fe!q+3rDt$o)9{ByvMMqxB9}^5tTD`0+h$@bWbGM;6z)2S;jHH;Rl4gUwCIYvb#%rd3`000tnMObu2SV=}Y gPjYExZggREX>V=-F@#v`?*IS*07*qoM6N<$f;@J%x&QzG literal 0 HcmV?d00001 From 1c199085140edeb560887fb0ab1e181d13032f63 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 19:04:02 -0400 Subject: [PATCH 010/137] buffed tundra flame blossom staff --- Items/Weapons/Summon/TundraFlameBlossomsStaff.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index c631c0eaa3..ec545e62b5 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 39; + item.damage = 45; item.mana = 10; item.width = 52; item.height = 60; From 72d4013d1da47129490ae922de740df5d48194fc Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 26 Apr 2020 19:34:51 -0500 Subject: [PATCH 011/137] Cal Clone telegraphs her charge for an extra 15 frames. --- NPCs/CalamityAI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 673dca2a6e..74c02fbd53 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1727,7 +1727,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= 30f) + if (npc.ai[2] >= 45f) { npc.TargetClosest(true); npc.ai[1] = 2f; From ce41e753a500fdec705da4e25dee4f2d4d317bb5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 26 Apr 2020 23:19:47 -0400 Subject: [PATCH 012/137] feather knife and eclipse stealth proj refactoring --- Projectiles/Rogue/EclipsesStealth.cs | 134 ++------------------ Projectiles/Rogue/FeatherKnifeProjectile.cs | 10 +- 2 files changed, 16 insertions(+), 128 deletions(-) diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 924dcfb246..4cfa10ab98 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class EclipsesStealth : ModProjectile { - private int deadinside = 0; //used to know when to drop spears from the sky + private bool changedTimeLeft = false; public override void SetStaticDefaults() { @@ -34,11 +34,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - deadinside++; //congrats Pinkie - if (deadinside >= 5) //every 5 ticks + if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks { - deadinside = 0; - if (Main.rand.Next(2) == 0) + if (Main.rand.NextBool(2)) { int spearAmt = Main.rand.Next(1, 4); //1 to 3 spears for (int n = 0; n < spearAmt; n++) @@ -54,136 +52,30 @@ namespace CalamityMod.Projectiles.Rogue num16 = (float)num15 / num16; num13 *= num16; num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.08 * Main.rand.Next(4, 7)), (int)((double)projectile.knockBack * 0.1 * Main.rand.Next(7, 10)), projectile.owner, 0f, 0f); + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.32f, 0.56f)), projectile.knockBack * Main.rand.NextFloat(0.32f, 0.56f), 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(8) == 0) //dust + if (Main.rand.NextBool(8)) //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 - { - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 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 (projectile.ai[0] == 1f && !changedTimeLeft) + { + projectile.timeLeft = 900; + changedTimeLeft = true; + } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile, 15); } - #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) { - 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.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; - projectile.StatusNPC(i); - //projectile.damage = 0; //aaaaaaa - int num28 = 1; - 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(); - } - } - } - } - } - } + CalamityUtils.ModifyHitNPCSticky(projectile, 1, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 33fe5ad8c2..8c088e0300 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Projectiles.Rogue { public class FeatherKnifeProjectile : ModProjectile { - private int featherTimer = 35; - public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); @@ -36,21 +34,19 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (featherTimer == 0) + if (projectile.timeLeft % 35 == 0) { if (projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack, projectile.owner); Main.projectile[proj].Calamity().forceRogue = true; } - featherTimer = 35; } - featherTimer--; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.69), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(projectile.position, new Vector2(projectile.velocity.X / 20, 2), ModContent.ProjectileType(), (int)(projectile.damage * 0.69), projectile.knockBack, projectile.owner); Main.projectile[proj].Calamity().forceRogue = true; } From 65d9a5ef1ab5449e79321c94b723150ea82ec0aa Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 27 Apr 2020 10:38:55 -0400 Subject: [PATCH 013/137] Temporal Floe Sword buff/rework. npc alert sheeting fix --- ExtraTextures/UI/NPCAlertDisplay.png | Bin 334 -> 334 bytes Items/Weapons/Melee/TemporalFloeSword.cs | 5 +- Projectiles/Melee/TemporalFloeNumberTwo.cs | 82 ++++++++++++++++++ .../Melee/TemporalFloeSwordProjectile.cs | 62 ++++++++++--- 4 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 Projectiles/Melee/TemporalFloeNumberTwo.cs diff --git a/ExtraTextures/UI/NPCAlertDisplay.png b/ExtraTextures/UI/NPCAlertDisplay.png index 45f8ee35bd59cfaea1c6e6eaa498f8ba45ae03ab..fae5814dc7b6b42bb8106ede6bfce082fe5ef28f 100644 GIT binary patch delta 246 zcmV0;U`+-qm zp*atJMqJq*@g47VOyh|!jLu!J?AgZ3$kviN#%@WJb19x8rPOgVQ3u`=Y8ASjdSym5 wX;)JY@A;jy4e5zzs%GXJ`G0ZN`QjJn0O^bkfe8)ua{vGU07*qoM6N<$f*$vC2mk;8 delta 246 zcmV?!^i+En!?Md{G`|4m?QE$XMgzJk(i0uWlr~W<1g;Akl zIWK-jJhK?_iX-73PyAx^?7r%w2^p`&_a^j6qFP(?6ltwDi-p>*-cVR2aS;pfh9)KKL7v#07*qoM6N<$f(B}G_y7O^ diff --git a/Items/Weapons/Melee/TemporalFloeSword.cs b/Items/Weapons/Melee/TemporalFloeSword.cs index e9af5c160b..157e672d3e 100644 --- a/Items/Weapons/Melee/TemporalFloeSword.cs +++ b/Items/Weapons/Melee/TemporalFloeSword.cs @@ -14,13 +14,14 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Temporal Floe Sword"); Tooltip.SetDefault("The iceman cometh...\n" + - "Fires a frozen sword beam"); + "Fires a frozen sword beam that splits into two more beams\n" + + "The direction of the beams depends on in game time"); } public override void SetDefaults() { item.width = 52; - item.damage = 85; + item.damage = 95; item.melee = true; item.useAnimation = 16; item.useStyle = 1; diff --git a/Projectiles/Melee/TemporalFloeNumberTwo.cs b/Projectiles/Melee/TemporalFloeNumberTwo.cs new file mode 100644 index 0000000000..e8b33c63c5 --- /dev/null +++ b/Projectiles/Melee/TemporalFloeNumberTwo.cs @@ -0,0 +1,82 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class TemporalFloeNumberTwo : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Melee/TemporalFloeSwordProjectile"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Floe"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.coldDamage = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.tileCollide = false; + } + + public override void AI() + { + 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); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 595) + 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); + for (int num795 = 0; num795 < 27; num795++) + { + 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); + Dust dust = Main.dust[num798]; + dust.noGravity = true; + 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.velocity *= 0.05f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(3)) + { + target.AddBuff(ModContent.BuffType(), 120); + } + target.AddBuff(BuffID.Frostburn, 240); + } + } +} diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index 8a88e757d3..b294a15995 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,17 +53,56 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item10, projectile.position); - for (int num795 = 0; num795 < 27; num795++) - { - 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); - Dust dust = Main.dust[num798]; - dust.noGravity = true; - 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.velocity *= 0.05f; - } + + // Get Terraria's current strange time variable + double time = Main.time; + + // Correct for night time (which for some reason isn't just a different number) by adding 54000. + if (!Main.dayTime) + time += 54000D; + + // Divide by seconds in an hour + time /= 3600D; + + // Terraria night starts at 7:30 PM, so offset accordingly + time -= 19.5; + + // Offset time to ensure it is not negative, then change to PM if necessary + if (time < 0D) + time += 24D; + + // Get the decimal (smaller than hours, so minutes) component of time. + int intTime = (int)time; + double deltaTime = time - intTime; + + // Convert decimal time into an exact number of minutes. + deltaTime = (int)(deltaTime * 60D); + + // Convert from 24 to 12 hour time + if (intTime > 12) + intTime -= 12; + // 12 AM is actually hour zero in 24 hour time + if (intTime == 0) + intTime = 12; + + float projSpeed = 8f; + + float hour = (float)intTime; + float hourAngle = MathHelper.PiOver2 - (MathHelper.TwoPi / 12f) * hour; + hourAngle *= -1f; //correction because lol + Vector2 hourVector = hourAngle.ToRotationVector2() * projSpeed; + + float minute = (float)deltaTime; + float minuteAngle = MathHelper.PiOver2 - (MathHelper.TwoPi / 60f) * minute; + minuteAngle *= -1f; //correction because pain + Vector2 minuteVector = minuteAngle.ToRotationVector2() * projSpeed; + + int projType = ModContent.ProjectileType(); + int dmg = projectile.damage / 2; + float kback = projectile.knockBack * 0.5f; + + Projectile.NewProjectile(projectile.Center, hourVector, projType, dmg, kback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, minuteVector, projType, dmg, kback, projectile.owner, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) From 42b6a71aa50a0fb914125193581ae48386d91741 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 27 Apr 2020 10:47:05 -0400 Subject: [PATCH 014/137] removed some unnecessary stuff from floe sword code --- Projectiles/Melee/TemporalFloeSwordProjectile.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index b294a15995..7c2997f2e3 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee // Terraria night starts at 7:30 PM, so offset accordingly time -= 19.5; - // Offset time to ensure it is not negative, then change to PM if necessary + // Offset time to ensure it is not negative if (time < 0D) time += 24D; @@ -81,9 +81,6 @@ namespace CalamityMod.Projectiles.Melee // Convert from 24 to 12 hour time if (intTime > 12) intTime -= 12; - // 12 AM is actually hour zero in 24 hour time - if (intTime == 0) - intTime = 12; float projSpeed = 8f; From cc787dd71b147c5141c8a1d07b8b2285abce74b1 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 27 Apr 2020 10:55:56 -0400 Subject: [PATCH 015/137] resprites --- Buffs/Placeables/ChaosCandleBuff.png | Bin 627 -> 528 bytes Buffs/Placeables/TranquilityCandleBuff.png | Bin 540 -> 535 bytes Items/Accessories/EtherealTalisman.png | Bin 927 -> 1268 bytes Projectiles/Melee/TemporalFloeNumberTwo.cs | 3 --- 4 files changed, 3 deletions(-) diff --git a/Buffs/Placeables/ChaosCandleBuff.png b/Buffs/Placeables/ChaosCandleBuff.png index f5271e8717b512630b72a33949b2447f047484ed..eb9db97d85dc2d20aa097acec720eb2e296556c0 100644 GIT binary patch delta 503 zcmVPx$%1J~)R9J=8mrW={Q51l`Co+Z!HPfUN zBRgSbLHUU$Rx(Q)B3s$|*|Ww@vmvEy{H&A}3zM;!WQ|c%hy{s=jK$2MduN^*shK<9 z=JoD7@4kD!ci+A5Sd~r>0FN(sadJqd(_;Y?Nk0eDZImxQhX*qU$y z*_$xefWE@XQGdSoO)dVty$1L(kuByL5bW0azL6aO{CzC|Opp2i2n6qyc)MLuFyDY6 znViHz05o{L%5`7=3IJ`j?Mi$m%rkKJd<&%RT9WzvKm`E7hq%zk@93*9RR}%32+nfVl_woIp!G1#AW0PfUzaN z(jE(60MIk;R^qZH?*>xp0zqc&cVKcZWQ+dpJ>}}UVN6}{JqILX8L2*E!LD)=^jWT> to6Wlc%TekA;Pve(r`55e)MZ9>`~~Rzn(mr56374m002ovPDHLkV1gD2^xpsg delta 603 zcmV-h0;K(r1oH%tBYy%pNkl9YSsYfGz&Nv;*Rfv**Fo zx35Wn zfTsyq$f2bnSbuqeI}Hq!1OB5~3@fovlQ;tdJnmz4!BS85-N7CbP>pc)u#ym#`f-&5 za0{VDCjA_MRu`b>cl5ZIaZ*9e?*u{uUY-zJ7Yw)q;AsF_(yd#38SGL(NeaCNY9 z0hSwx4FUQ)fW%w?^C2uDV3Y^wsTZw0z*!p-n+vG!0DpL8gccI!OD}=l)KjbhrfsFo z!F1(@Ehv6$5AXr=4?jH#rb~Knfa#ObdMN5hE(z)H0BC!_{0}6bU*3a!2&5UiEa-J83(+6bsy}rOGmB`ObAfT0T{I*v;_l;ifkuH{eS%r7ns(w(L_lD zun^E>`BVlLpSlmyPB;mTdj?`##c)&U?f|sf5SCwItz=k8IN1r~4S{`!-lF&%mg*&7 pPx$(Md!>R9J=8mrE!_Q5eU67Yj8TW5EW~ zWU|m)Q4{BH2hv$yg|PY=mq?QDZ?Vv9!QO%|>H!=cs$; z-Wih`Xa1XW?>XOje82Phj;6bu07RbOV`Nae%c%k6WU^B$X@5WrV7}J}Kp;?LY3S{2 zORM3#-9yX#{ry(}W;U+@l?X((+f4;xq|@vDNgG%g*hp$8%4M>8_W__Hfpk4@$v*?& zB-)s?o=id+0(t3HkUjsavWI}3=T*K3BV{daHv*(yLqgd@KvwPSYy8W&OQOf`08G`V zM?zf!;w%?;fPe60VZhk$wd|Pe^IOd%ek*ke2$d9vEb}Xx&ozLKmIhNCv21FwzF$jmO2E4$6};* zBcAa7twWjYzZ1~h1r7k7K0Y)0I(8R0)Oa0#14Y@Cf*63i1^@s607*qoM6N<$f9YSsYfGs}z_8-_CXWv4c zld#=;P3V__yR4GMw5;ec7UARzz) zs~)1pNGan1tUePlgoFevv=A6@2QYQt0)IQ+$v_!QcN#%ljP5g7 zT*G{h9xUkUVR2r54icjKF5Csv|4P+R)4-r}0D7Fke1h)dH|HU#pHPUv(iG7lFklXV z^bX_pu4mjcsN%iP)5A(U7=y$OE zrq`TAg#;`O5FG+^cK~`WAmo5%EoZRLPru$mR7jAV3+V0uSY-q&h=_FnEVb8O+lw_V zkX;fEm;+$#0jVr=thoT@<77V3})_03dh56!xP34FCWD07*qoM6N<$ Ff&fO`*_{9Y diff --git a/Items/Accessories/EtherealTalisman.png b/Items/Accessories/EtherealTalisman.png index a6ba2417cfe26587852ad3e95bc3e2410b1d7fe8..4cd07f2b43201f07770f0857101c7978a3961051 100644 GIT binary patch literal 1268 zcmVPx(u1Q2eRA_gy+pL%|p|lVxC?;j4jgSO| zf(UydRD?xPVK9kUW$i_RFM1Ja3QCSzTA3QIoZ6;t%eh)jXWNr*PcP2CJUeISZnhD` zUEep)bN<|O&pn@ee!t)O-GCA5(ekperlha3zWJv7;lJ&$tm? z^&eE)NH2`fTLnP-q4&K6o?daiQ)9}TYfb=A-+b1+E*R-t;C~`1&3$~Yw|;+JIRMYR zz5sv~59|Zr);Z(*f2RZR(VkyMI|U#@Ld1$SfD{QyB=U1J0)Uo|?td`t!PYG@M26ZU-WA?`WCsAREPuE_)Gx)uk1~SrZ^dsOt+q!TZWy1K`ewrU3BewqF4& z2DAFRer96)9`Cr3B4Vxdv{}UgK+~Zu09;D6B>^6O!L0DJ8Kb-5OFL{*A|%PWNwQXH z>3IP_!MrB`IMaC0ns@Yw-20TVGTYxZRwW}d2msofKDVAc%z8-;73aP6gnq-vfGcT`LyZLBo!{QBxD05)tj{loUk$E#Yb@`j~FK#J_fN;~VK`<+Ud zviz6&Yrd_G2Y@IM(Vx~9W0myIyB;`wQak|ITyr7`Q1eNtX{b(E{bZHg>s`4~vtlo0 zTXa7X=A^3eG{4%0D(&5f?UAsC+6MFPPtD8<0Agt-21XUqrydU_fF$h+cr5(ejVKdXHnfQfe%S@mJ(k+6Pl6s+?}+h4QI8xbo6 zptHNxn=_6ikuZ5rhVmnlR?y7_YsFm>%0Rk=*H`E z-$UMf&JgXn-JDyLc~tZ)5{l^*qkZ~;sduAW#e}tAz3rWE^odAeWF)Pq)a=hbR eE&*4OA@VnJh}lAMaQ5v00000QiE3L>OMQsO!&$VCM=7%+6_eKARW>B3u?y7#J0UD@AY7PvmQXOs|fdYKD1k8OJzQPWZdpIj^4LXnZ~XgL$POEntW;dpa#~-2 zpKRta!@3PS2P?*wB24zrGb33`>0ad@Jl0_#lGUgaPdCp6u>&)z z6#))rQ6gl$eb+|K&V-{Zyq#61@!VEBXHrJW#9(wz#B4S#}c@AX(1876; zqY=4Qt*BbCd;KO``ed>$5Cbqp%$M~;v3E!dsWNjex5B1S&BP9so%%qZqRdd?u?u6& z6MOVsS{^i(PG_eoGKGEj)Q7E>IEOTL6d~;-sVg9+eU&n%457(9K)qO6FhhxPXm?97 zyWM(S%x)Sxoc5>|gaKj&*ViFPn(Dx z@3e@mzi5UM=a6bRR4<(=$m_YBGQ~RWT%*qW)P7kf>wLX%>ri4H(ingtI#%s0HT!u= zL}Mn(uG;a=)FT;6j6)u>dcs+))~Z%3Mt$AT_pJI0Ug8`A5wDYtsuRkP*JoABOr)0c zwp?NzQlvcv5fzL2{YX2~C}96MhSUIx;(u}IC*$NBHC$cj7XSbN07*qoM6N<$f&l8v BxIO>? diff --git a/Projectiles/Melee/TemporalFloeNumberTwo.cs b/Projectiles/Melee/TemporalFloeNumberTwo.cs index e8b33c63c5..08a0926a8c 100644 --- a/Projectiles/Melee/TemporalFloeNumberTwo.cs +++ b/Projectiles/Melee/TemporalFloeNumberTwo.cs @@ -41,9 +41,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - 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; From 105c04b7aba1d12b3f42df12cb92621b959105f5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 27 Apr 2020 11:13:01 -0400 Subject: [PATCH 016/137] merchant now sells angel statues if bandit is alive --- NPCs/CalamityGlobalNPC.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 134eedf46e..f7bb0ade77 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4946,7 +4946,7 @@ namespace CalamityMod.NPCs int fapsol = NPC.FindFirstNPC(ModContent.NPCType()); int permadong = NPC.FindFirstNPC(ModContent.NPCType()); int seahorse = NPC.FindFirstNPC(ModContent.NPCType()); - //int thief = NPC.FindFirstNPC(ModContent.NPCType()); + int thief = NPC.FindFirstNPC(ModContent.NPCType()); int angelstatue = NPC.FindFirstNPC(NPCID.Merchant); switch (npc.type) @@ -5199,11 +5199,9 @@ namespace CalamityMod.NPCs break; case NPCID.GoblinTinkerer: - int banditIndex = NPC.FindFirstNPC(ModContent.NPCType()); - if (Main.rand.NextBool(3) && banditIndex != -1 && Main.LocalPlayer.Calamity().reforges >= 10) + if (Main.rand.NextBool(3) && thief != -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?"; + chat = $"Hey, is it just me or have my pockets gotten lighter ever since " + Main.npc[thief].GivenName + " arrived?"; } if (Main.rand.NextBool(10) && NPC.downedMoonlord) { @@ -5241,6 +5239,11 @@ namespace CalamityMod.NPCs chat = "If this acid rain keeps up, there'll be a shortage of Dirt Blocks soon enough!"; } + if (Main.rand.NextBool(7) && thief != -1) + { + chat = "I happen to have several Angel Statues at the moment, a truely rare commodity. Want one?"; + } + break; case NPCID.Mechanic: @@ -5489,6 +5492,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Vilethorn : ItemID.CrimsonRod, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); + SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(ModContent.NPCType()) != -1, Item.buyPrice(0, 5)); } if (type == NPCID.ArmsDealer) From 6c90f82346faa39a3f16af9e35240c408eba9b31 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 27 Apr 2020 14:06:06 -0400 Subject: [PATCH 017/137] brimstone fireball sprites and circlet cooldown --- CalPlayer/CalamityPlayer.cs | 5 +- CalPlayer/CalamityPlayerMiscEffects.cs | 2 + Items/Weapons/Melee/ExoGladius.cs | 4 +- Projectiles/Boss/BrimstoneHellfireball.cs | 2 +- Projectiles/Magic/Ancient.cs | 50 +++++++--------- Projectiles/Magic/Ancient2.cs | 40 ++++++------- Projectiles/Magic/BloodBlast.cs | 13 ++-- .../Magic/BrimstoneHellfireballFriendly.cs | 46 +++++++++++--- .../Magic/BrimstoneHellfireballFriendly.png | Bin 139 -> 3433 bytes Projectiles/Magic/GranitePulse.cs | 7 +-- Projectiles/Magic/PhantasmalFuryProj.cs | 6 +- Projectiles/Magic/PlasmaRay.cs | 4 +- .../Magic/SupremeDustFlakProjectile.cs | 42 ++++++------- Projectiles/Magic/SupremeDustProjectile.cs | 56 ++++++++---------- Projectiles/Magic/WaterStream.cs | 6 +- Projectiles/Magic/WaterStream2.cs | 18 +++--- Projectiles/Summon/BrimstoneFireballMinion.cs | 47 ++++++++++++--- .../Summon/BrimstoneFireballMinion.png | Bin 139 -> 3433 bytes 18 files changed, 186 insertions(+), 162 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index eb8167edcc..a645537abe 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -522,6 +522,7 @@ namespace CalamityMod.CalPlayer public bool snowRuffianSet = false; public bool forbiddenCirclet = false; public int forbiddenCooldown = 0; + public int tornadoCooldown = 0; public bool eskimoSet = false; //vanilla armor public bool meteorSet = false; //vanilla armor, for space gun nerf public bool victideSet = false; @@ -1870,6 +1871,7 @@ namespace CalamityMod.CalPlayer doubledHorror = false; sulphurBubbleCooldown = 0; forbiddenCooldown = 0; + tornadoCooldown = 0; ladHearts = 0; alcoholPoisoning = false; @@ -2646,8 +2648,9 @@ namespace CalamityMod.CalPlayer } if (plagueReaper && plagueReaperCooldown <= 0) plagueReaperCooldown = 1800; - if (forbiddenCirclet) + if (forbiddenCirclet && forbiddenCooldown <= 0) { + forbiddenCooldown = 20; int stormMana = (int)(ForbiddenCirclet.manaCost * player.manaCost); if (player.statMana < stormMana) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2bc798757e..ef0984de9b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -914,6 +914,8 @@ namespace CalamityMod.CalPlayer modPlayer.sulphurBubbleCooldown--; if (modPlayer.forbiddenCooldown > 0) modPlayer.forbiddenCooldown--; + if (modPlayer.tornadoCooldown > 0) + modPlayer.tornadoCooldown--; if (modPlayer.ladHearts > 0) modPlayer.ladHearts--; if (modPlayer.titanBoost > 0) diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index 2410ebe1e9..ae76d02137 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Items.Weapons.Melee num16 *= num18; if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 15f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 15f, player.whoAmI, 0f, 0f); } } @@ -144,7 +144,7 @@ namespace CalamityMod.Items.Weapons.Melee num16 *= num18; if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 15f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 15f, player.whoAmI, 0f, 0f); } } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index a20804c4b0..300a6ab167 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (projectile.frame >= 6) { projectile.frame = 0; } diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index e4b374321d..85686900da 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -5,8 +5,6 @@ namespace CalamityMod.Projectiles.Magic { public class Ancient : ModProjectile { - public int addDustTimer = 0; - public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient"); @@ -30,8 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.6f, 0.5f, 0f); - addDustTimer++; - if (addDustTimer >= 30) + if (projectile.timeLeft % 30 == 0) { int numProj = 2; int randomSpread = Main.rand.Next(3, 19); @@ -41,10 +38,9 @@ namespace CalamityMod.Projectiles.Magic 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, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); } } - addDustTimer = 0; } if (projectile.timeLeft > 151) { @@ -70,46 +66,40 @@ namespace CalamityMod.Projectiles.Magic 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); + Dust dust = Main.dust[num299]; 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; + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 6f; + dust.velocity.Y *= 6f; } else { - Main.dust[num299].scale *= 1.5f; + dust.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; + dust.velocity.X *= 3f; + dust.velocity.Y *= 3f; + dust.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); + Dust dust = Main.dust[num299]; 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; + dust.noGravity = true; + dust.scale *= 4f; + dust.velocity.X *= 4f; + dust.velocity.Y *= 4f; } else { - Main.dust[num299].scale *= 2.5f; + dust.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; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + dust.scale *= num296; } } else diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index 59242d4a26..ac3cbc2292 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -51,42 +51,36 @@ namespace CalamityMod.Projectiles.Magic 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); + Dust dust = Main.dust[num299]; 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.noGravity = true; + dust.scale *= 1.5f; + dust.velocity.X *= 3f; + dust.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; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + dust.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); + Dust dust = Main.dust[num299]; 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; + dust.noGravity = true; + dust.scale *= 3f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; } else { - Main.dust[num299].scale *= 2f; + dust.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; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= num296; } } else diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 54f577681c..61ccc5e742 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -33,13 +33,12 @@ namespace CalamityMod.Projectiles.Magic 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; + Dust dust = Main.dust[num96]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num93; + dust.position.Y -= num94; } if (Main.rand.NextBool(5)) { diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 23721e7d31..2a104cafb5 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,9 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Hellfire"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -29,19 +33,39 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + + //Fade in + if (projectile.alpha > 5) + projectile.alpha -= 15; + if (projectile.alpha < 5) + projectile.alpha = 5; + + //Rotation + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * projectile.direction; + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.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.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, (int)CalamityDusts.Brimstone, 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) @@ -56,5 +80,11 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(ModContent.BuffType(), 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/Magic/BrimstoneHellfireballFriendly.png b/Projectiles/Magic/BrimstoneHellfireballFriendly.png index 831f72cfc80987b6ddfa4b4dabe47b7c4bef64f6..71720f8c11a56296dc7fb27b19426b7227ae7af1 100644 GIT binary patch literal 3433 zcmV-v4VLnWP)1^@s6x6*&I00001b5ch_0Itp) z=>Px?BS}O-RCt{2ojq@3#}$U(yZn$TS@K%Q?#7T~z=4VcL6F8U;=)B-Y!L+5B0tBq ze~t?SK@hk|3Kt2CZHyFgu}A=KguuIwVy_}GA|)}!&`><23L_pRR8PZ zduSRWYb8N4Lu7Hc5j`(&kBqcAeO7Jji$Gh%6(VGpNJvDCdSYjjn^4=NB2*p`>S2-2 z=dJAC@XibXK0g^Jos-CzA+pj#JKC?`8V%}eJRJ4-cV+;vH*DX-Tdxf&0Ql;=skT4U zB4dXL{qIl5*8qSgr;`}~yn8g_f9s8>AHLe30l;wHi+_H81pxT&GFYkrSRz6s4o5wS z1eet2w2niu@XtR!X?;JUrUhV(h_e)&j<2<)$SL|>gUk#7j`sV;OO5nFDv8i>UR>7o79TIM zOGHb8N(=v;mmaQzou2X5m--)fU+H<3kv6_ujzty*Ix93(2Lb@l5NiN2J)0C=CAmFX#K7Sg}=)M2|d& z;(AhA6uuJv^hah4vc5481( zr~a`0?7MPxq1O1phwrNn{PjnldC$pbLCp~Hl^SQP(4A60g|{i8eupG8M8vD~)U?{R z$a!q@{*mPQ8m+V*0W(Cl;>zwrBW=!1c&r@$*0SB3>+l$pNBUiA4BYv&ak)@&D^tBN6l#{R!eh?9H^3ujEYNJ| z)1$g~|KxN6VCl?hNLBCHClZQsB7ylG-``uzl2$;AOkp0QTnC~V?t`6Pi^zC-Q~OY^ zYA}u%0#Gs$?K3dBuNqFAc4>Ls{`+!>@EY-N&o2Q0KfSl3^|8*_YoYas)E}YMBHUH= z^ZPp$uylRK${rD38psRurnj+%V`J}#M?tkafma3B%Q}5??iBPoP+pVMg zwd?xzkU4xK+7w#t>ir`-M2GS9d8ln&lh4uo#rzD` ziVHj=36g4UxG5r?6zg9-9bdP`OU$jos-%&gP^?Ify%3p3KgFoWDE12*?|DvMDUd41 zDiZ*fh)_R68p$E8%kxa>M*AbwoBrbAZvbRj*Q*lMsK5BM9zn80gnnqOk_WJC3vzp&sUO10+a*HcqXd$V zl}qxq@*WvKpFJWCwdxa2W^t$U*HBNaxV!e7puIeWRx5Q(lwB4)lT0600j za(-S;pEb6Il?X|>u6Q;vb1R^OE^xZ?(L6;}BcrufoJgo1vQLB*8ky$DBLCXIFX~tF z7#PM zwH?v=ysN{P%M=ms z3IQ#dR1&b(AE^|(PDZWqBx$|QBs)Z;4FuJ`s}E#VHXg&SR9E zS5e{OEYrOi?Pn#?etWr|ne7s3$lI4aJ{+n>3$-eOh*MHq!$+<+(!HtOy(LQqTQfw| ztuK`Ql7IYXQtxJap=)(X_KA?VXR%R#00{R<$s-`;F)}yr+hq+_i_DYL3Hd~{eO#j> z&!Ioi&h^ncKFUEuG398TotY=gA<~eyhNU~E`XYALv`8Y7TG1at!e*(-v42ektgiLu zHE`&hW{3o1#Nj7t-4V|YNHr@F@~qJ+ydL3w(1jOixmv^-JG4ft(dHE9F^U!Kn2h-y z4(2Jr`?YD)HA-OHho-Jaq~{dH40>5v1Y=f{grv=c4WKZO5r8CTUg*iN@Lb>xc}s(* zEsB~eEQ*Ng4nwVUNM?v=YSvEUAH|J4rw~axb}>18#Zp6k(YvqoXx&{b8E-yTE;B^L z^}dY^l$~<>HlBA{>ul_=fR;uPb7d!$Jc{<*o2lceu?o!tn;|0ZvXDD-ts_%y;m^KY zsd=6ynIW>0FFrNnHCIFiYygIcsAFVZS&d0%h%90xx7V2~3?pGG>Tu zFNAA*AzXc$mqkbKb85zGI=>kr)n9(~YXHE>*_E?~mFkn&T;P(c(;SgL%`VWB*yktX z7MXQX^ETZ+xISPqehjByo^o^jF)kJk1NB$XCtO-$KH zd3{qfk*F-_wBza9uMfQh%ORquKb-R~vGqzLC9#HgCkB;`iad;LB^^ZudE3F%X zdlsc^#w0UDg5Cgy|EwkIr<`5h0074GM`vlimt=-W_8h+CTW$DP+teSszifuc%kV0; z&ULH2iU5G~NnKjF--LW5v^N@;86qhzZ~#lk4bPCjJE$RFOxq#D$L6@oAtJ4X81yP< zE6hn?9*5H20wgm;)EV@pwGi6;0OhXJ(>iR3#O|Pu6&@SKjw(j4faWpLl?2HQ5nqhN z&hdHMt&J!(Ysp4xzR&8r5LFJ&caKIPU(yT;x@L$Z`{FqTX^(iV%n$YfoOc?&dG1h;$;sl}g4wk*-d?STbgaY%hdM?eJY=###V| zi1cYUm9xoB?yTr4(fQ2~S@_VTUE$X4@TL7N%n<35t4hit6H-^NBAwq3k<>3{%vcMc zWFogGV{K^nx7@PZ)M64LAS?LGLoPzv&lQ>1^qx>Xhh^Y6S;Evvqq@2F| z+(r0DoUyXFvw$mHvF6IQH(=%JLUVYd`>z53277g0)}6a`O?>%nT~kia>rya&_FwOD z%JT+<=i15K;F>Jh8(|S=sK*96q#)y(Xz>B3`dzYA)aMhqHTV@ zCYyhR$A)7>+dGqGhKM>wr14RD4)XZcR5fpTL>g+{87IYa(KKSk8;?a32|fR)vh;A7 zArjqUYS(0i{Ht8$5+Oxo`Ps0%iXjo1{b7AiG^WqV&IZt?qYd*aHWan4hHE2SSEM8o#d;Nk8R9hGZK`;$V#==Aonk?fX(Cb5 z<`XEd9$ABHbLAXOnSJ(s8AQZ$0tTIVo%fPYkkj94hDgrVH|gBwVkD-A#?_USO(L58 z^tiH+;Ic;~wX~$VzsqsB4dw8*UYrBGFy)<>&pIsjh#<|)!>CKNT-CSi(`n!`Q$(U|JyTbHgq<+7_3TM blEJ|6HG)~R_srXBpc)2GS3j3^P6(), 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++) diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index cac4ab9437..9855922413 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -66,8 +66,8 @@ namespace CalamityMod.Projectiles.Magic 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), ModContent.ProjectileType(), (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), ModContent.ProjectileType(), (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), ModContent.ProjectileType(), (int)(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), ModContent.ProjectileType(), (int)(projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); } } projectile.penetrate--; diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 12bb4bfb0b..a45db701e3 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -46,46 +46,40 @@ namespace CalamityMod.Projectiles.Magic 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); + Dust dust = Main.dust[num299]; 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; + dust.noGravity = false; + dust.scale *= 1f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; } else { - Main.dust[num299].scale *= 0.5f; + dust.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; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.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); + Dust dust = Main.dust[num299]; 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; + dust.noGravity = false; + dust.scale *= 1.5f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; } else { - Main.dust[num299].scale *= 0.25f; + dust.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; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= num296; } } else diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 0e0ac64c3d..6ecf7f4eb9 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -43,44 +43,38 @@ namespace CalamityMod.Projectiles.Magic } 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 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); + Dust dust = Main.dust[num299]; + if (Main.rand.NextBool(2)) + { + dust.noGravity = true; + dust.scale *= 4f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 2.5f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.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); + Dust dust2 = Main.dust[num399]; 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; + dust2.noGravity = true; + dust2.scale *= 6f; + dust2.velocity.X *= 2f; + dust2.velocity.Y *= 2f; } else { - Main.dust[num399].scale *= 2.5f; + dust2.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; + dust2.velocity.X *= 1.2f; + dust2.velocity.Y *= 1.2f; + dust2.scale *= num296; } else { diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index 25067cab4d..9173858a11 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -5,8 +5,6 @@ namespace CalamityMod.Projectiles.Magic { public class WaterStream : ModProjectile { - public int addSprayTimer = 20; - public override void SetStaticDefaults() { DisplayName.SetDefault("Stream"); @@ -31,14 +29,12 @@ namespace CalamityMod.Projectiles.Magic { projectile.tileCollide = true; } - addSprayTimer--; - if (addSprayTimer <= 0) + if (projectile.timeLeft % 20 == 0) { if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), 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; diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index 4c5e5e9d2b..0e58e022fe 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -41,22 +41,20 @@ namespace CalamityMod.Projectiles.Magic 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; + 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); + Dust dust = Main.dust[num155]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.5f; + dust.position.X -= num152; + dust.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); + 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; - return; } } } diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 0d33e06164..7faee65129 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Brimfire"); ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -26,23 +30,44 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.alpha = 255; } public override void AI() { - Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + + //Fade in + if (projectile.alpha > 5) + projectile.alpha -= 15; + if (projectile.alpha < 5) + projectile.alpha = 5; + + //Rotation + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90) * projectile.direction; + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.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.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, (int)CalamityDusts.Brimstone, 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) @@ -57,5 +82,11 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(ModContent.BuffType(), 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/Summon/BrimstoneFireballMinion.png b/Projectiles/Summon/BrimstoneFireballMinion.png index 831f72cfc80987b6ddfa4b4dabe47b7c4bef64f6..71720f8c11a56296dc7fb27b19426b7227ae7af1 100644 GIT binary patch literal 3433 zcmV-v4VLnWP)1^@s6x6*&I00001b5ch_0Itp) z=>Px?BS}O-RCt{2ojq@3#}$U(yZn$TS@K%Q?#7T~z=4VcL6F8U;=)B-Y!L+5B0tBq ze~t?SK@hk|3Kt2CZHyFgu}A=KguuIwVy_}GA|)}!&`><23L_pRR8PZ zduSRWYb8N4Lu7Hc5j`(&kBqcAeO7Jji$Gh%6(VGpNJvDCdSYjjn^4=NB2*p`>S2-2 z=dJAC@XibXK0g^Jos-CzA+pj#JKC?`8V%}eJRJ4-cV+;vH*DX-Tdxf&0Ql;=skT4U zB4dXL{qIl5*8qSgr;`}~yn8g_f9s8>AHLe30l;wHi+_H81pxT&GFYkrSRz6s4o5wS z1eet2w2niu@XtR!X?;JUrUhV(h_e)&j<2<)$SL|>gUk#7j`sV;OO5nFDv8i>UR>7o79TIM zOGHb8N(=v;mmaQzou2X5m--)fU+H<3kv6_ujzty*Ix93(2Lb@l5NiN2J)0C=CAmFX#K7Sg}=)M2|d& z;(AhA6uuJv^hah4vc5481( zr~a`0?7MPxq1O1phwrNn{PjnldC$pbLCp~Hl^SQP(4A60g|{i8eupG8M8vD~)U?{R z$a!q@{*mPQ8m+V*0W(Cl;>zwrBW=!1c&r@$*0SB3>+l$pNBUiA4BYv&ak)@&D^tBN6l#{R!eh?9H^3ujEYNJ| z)1$g~|KxN6VCl?hNLBCHClZQsB7ylG-``uzl2$;AOkp0QTnC~V?t`6Pi^zC-Q~OY^ zYA}u%0#Gs$?K3dBuNqFAc4>Ls{`+!>@EY-N&o2Q0KfSl3^|8*_YoYas)E}YMBHUH= z^ZPp$uylRK${rD38psRurnj+%V`J}#M?tkafma3B%Q}5??iBPoP+pVMg zwd?xzkU4xK+7w#t>ir`-M2GS9d8ln&lh4uo#rzD` ziVHj=36g4UxG5r?6zg9-9bdP`OU$jos-%&gP^?Ify%3p3KgFoWDE12*?|DvMDUd41 zDiZ*fh)_R68p$E8%kxa>M*AbwoBrbAZvbRj*Q*lMsK5BM9zn80gnnqOk_WJC3vzp&sUO10+a*HcqXd$V zl}qxq@*WvKpFJWCwdxa2W^t$U*HBNaxV!e7puIeWRx5Q(lwB4)lT0600j za(-S;pEb6Il?X|>u6Q;vb1R^OE^xZ?(L6;}BcrufoJgo1vQLB*8ky$DBLCXIFX~tF z7#PM zwH?v=ysN{P%M=ms z3IQ#dR1&b(AE^|(PDZWqBx$|QBs)Z;4FuJ`s}E#VHXg&SR9E zS5e{OEYrOi?Pn#?etWr|ne7s3$lI4aJ{+n>3$-eOh*MHq!$+<+(!HtOy(LQqTQfw| ztuK`Ql7IYXQtxJap=)(X_KA?VXR%R#00{R<$s-`;F)}yr+hq+_i_DYL3Hd~{eO#j> z&!Ioi&h^ncKFUEuG398TotY=gA<~eyhNU~E`XYALv`8Y7TG1at!e*(-v42ektgiLu zHE`&hW{3o1#Nj7t-4V|YNHr@F@~qJ+ydL3w(1jOixmv^-JG4ft(dHE9F^U!Kn2h-y z4(2Jr`?YD)HA-OHho-Jaq~{dH40>5v1Y=f{grv=c4WKZO5r8CTUg*iN@Lb>xc}s(* zEsB~eEQ*Ng4nwVUNM?v=YSvEUAH|J4rw~axb}>18#Zp6k(YvqoXx&{b8E-yTE;B^L z^}dY^l$~<>HlBA{>ul_=fR;uPb7d!$Jc{<*o2lceu?o!tn;|0ZvXDD-ts_%y;m^KY zsd=6ynIW>0FFrNnHCIFiYygIcsAFVZS&d0%h%90xx7V2~3?pGG>Tu zFNAA*AzXc$mqkbKb85zGI=>kr)n9(~YXHE>*_E?~mFkn&T;P(c(;SgL%`VWB*yktX z7MXQX^ETZ+xISPqehjByo^o^jF)kJk1NB$XCtO-$KH zd3{qfk*F-_wBza9uMfQh%ORquKb-R~vGqzLC9#HgCkB;`iad;LB^^ZudE3F%X zdlsc^#w0UDg5Cgy|EwkIr<`5h0074GM`vlimt=-W_8h+CTW$DP+teSszifuc%kV0; z&ULH2iU5G~NnKjF--LW5v^N@;86qhzZ~#lk4bPCjJE$RFOxq#D$L6@oAtJ4X81yP< zE6hn?9*5H20wgm;)EV@pwGi6;0OhXJ(>iR3#O|Pu6&@SKjw(j4faWpLl?2HQ5nqhN z&hdHMt&J!(Ysp4xzR&8r5LFJ&caKIPU(yT;x@L$Z`{FqTX^(iV%n$YfoOc?&dG1h;$;sl}g4wk*-d?STbgaY%hdM?eJY=###V| zi1cYUm9xoB?yTr4(fQ2~S@_VTUE$X4@TL7N%n<35t4hit6H-^NBAwq3k<>3{%vcMc zWFogGV{K^nx7@PZ)M64LAS?LGLoPzv&lQ>1^qx>Xhh^Y6S;Evvqq@2F| z+(r0DoUyXFvw$mHvF6IQH(=%JLUVYd`>z53277g0)}6a`O?>%nT~kia>rya&_FwOD z%JT+<=i15K;F>Jh8(|S=sK*96q#)y(Xz>B3`dzYA)aMhqHTV@ zCYyhR$A)7>+dGqGhKM>wr14RD4)XZcR5fpTL>g+{87IYa(KKSk8;?a32|fR)vh;A7 zArjqUYS(0i{Ht8$5+Oxo`Ps0%iXjo1{b7AiG^WqV&IZt?qYd*aHWan4hHE2SSEM8o#d;Nk8R9hGZK`;$V#==Aonk?fX(Cb5 z<`XEd9$ABHbLAXOnSJ(s8AQZ$0tTIVo%fPYkkj94hDgrVH|gBwVkD-A#?_USO(L58 z^tiH+;Ic;~wX~$VzsqsB4dw8*UYrBGFy)<>&pIsjh#<|)!>CKNT-CSi(`n!`Q$(U|JyTbHgq<+7_3TM blEJ|6HG)~R_srXBpc)2GS3j3^P6 Date: Mon, 27 Apr 2020 21:02:35 -0400 Subject: [PATCH 018/137] Deus and DoG bags now have force-into-world --- Items/TreasureBags/AstrumDeusBag.cs | 2 ++ Items/TreasureBags/DevourerofGodsBag.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 162485bbd1..3e9f3440f4 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -38,6 +38,8 @@ namespace CalamityMod.Items.TreasureBags return true; } + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void OpenBossBag(Player player) { player.TryGettingDevArmor(); diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 0373012409..d81ea77596 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -49,6 +49,8 @@ namespace CalamityMod.Items.TreasureBags return true; } + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + public override void OpenBossBag(Player player) { player.TryGettingDevArmor(); From 7c7f36d77d05ef1142296a1f6f91dcaad4903c75 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 27 Apr 2020 23:41:27 -0400 Subject: [PATCH 019/137] Added Valkyrie Ray (no idea if balanced) --- Items/Weapons/Magic/ValkyrieRay.cs | 129 +++++++++++++++ Items/Weapons/Magic/ValkyrieRay.png | Bin 0 -> 1095 bytes Projectiles/Magic/ValkyrieRayBeam.cs | 227 ++++++++++++++++++++++++++ Projectiles/Magic/ValkyrieRaybeam.png | Bin 0 -> 526 bytes 4 files changed, 356 insertions(+) create mode 100644 Items/Weapons/Magic/ValkyrieRay.cs create mode 100644 Items/Weapons/Magic/ValkyrieRay.png create mode 100644 Projectiles/Magic/ValkyrieRayBeam.cs create mode 100644 Projectiles/Magic/ValkyrieRaybeam.png diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs new file mode 100644 index 0000000000..3a74bfd60f --- /dev/null +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -0,0 +1,129 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class ValkyrieRay : ModItem + { + public static readonly Color LightColor = new Color(235, 40, 121); + private const float GemDistance = 18f; + private const int ReuseCount = 14; + private int useCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valkyrie Ray"); + Tooltip.SetDefault("Casts a devastating ray of holy power"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.width = 54; + item.height = 52; + item.damage = 73; + item.knockBack = 8.5f; + item.magic = true; + item.mana = 26; + item.useTime = 2; + item.useAnimation = item.useTime * ReuseCount; + item.useStyle = 5; + item.UseSound = SoundID.NPCDeath7; + item.useTurn = false; + item.noMelee = true; + item.value = Item.buyPrice(gold: 16); + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 25f; + } + + public override Vector2? HoldoutOrigin() => new Vector2(10, 10); + + // The weapon functions as a fake Clockwork Assault Rifle where only one the many shots actually fires something. + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + useCounter++; + + // Compute the gem position, which is needed for both charging and firing + float angle = new Vector2(speedX, speedY).ToRotation(); + Vector2 gemOffset = Vector2.One * GemDistance * 1.4142f; // distance to gem on staff + Vector2 gemPos = position + gemOffset.RotatedBy(angle - MathHelper.PiOver4); + + // Actually fire the weapon if it's the final reuse + if (useCounter == ReuseCount) + { + // Produce firing dust and play sound + if (Main.netMode != NetmodeID.Server) + { + SpawnFiringDust(gemPos); + Main.PlaySound(SoundID.Item28, gemPos); + Main.PlaySound(SoundID.Item60, gemPos); + } + useCounter = 0; + + // Change the projectile's spawning position to the gem position + position = gemPos; + + // Manually set the player's item times to longer when the weapon is fired so the staff sticks around a little longer + player.itemTime = 19; + player.itemAnimation = 19; + player.itemAnimationMax = 19; + return true; + } + + // Otherwise, produce small amounts of charging dust and light which scales with the charge. + else if (Main.netMode != NetmodeID.Server) + { + SpawnChargeDust(gemPos); + float brightness = (float)useCounter / ReuseCount; + Lighting.AddLight(gemPos, LightColor.ToVector3() * brightness); + } + return false; + } + + private void SpawnFiringDust(Vector2 center) + { + int numDust = 36; + int dustID = 73; + for(int i = 0; i < numDust; ++i) + { + Dust d = Dust.NewDustDirect(center, 0, 0, dustID, 0f, 0f); + d.velocity = (i * MathHelper.TwoPi / numDust).ToRotationVector2() * 2.2f; + d.scale = 1.4f; + d.noGravity = true; + } + } + + private void SpawnChargeDust(Vector2 center) + { + int numDust = 2; + int dustID = 73; + float incomingRadius = 9f; + for(int i = 0; i < numDust; ++i) + { + Vector2 offsetUnit = Main.rand.NextVector2Unit(); + Vector2 dustPos = center + offsetUnit * incomingRadius; + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f); + d.velocity = offsetUnit * -Main.rand.NextFloat(2f, 3.5f); + d.scale = Main.rand.NextFloat(0.4f, 1f); + d.noGravity = true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 12); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.SoulofSight, 10); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Magic/ValkyrieRay.png b/Items/Weapons/Magic/ValkyrieRay.png new file mode 100644 index 0000000000000000000000000000000000000000..18ec195aa0f50f4959122b73dc463d40b2cb50bb GIT binary patch literal 1095 zcmV-N1i1T&P)Px(0ZBwbRA_h2#maR1lY5yC427ph{0dd;1CV<0{TiYHL+w2__d=e z3)j|62kYM1hCDVla;O(DV^Y~ajvxG`4cuLO3n-r)n>u{a2i$(ojbKMzT^829eHW;&JAzznl~;_9C>ZNMX+!hoPXRydOrAUIUt0*4 ztf~V=Ba0)r_r7J|i%nazklFtQ*zo3ypl0D@u=3GQ!=nnuE{NWCx87pt%Woe`%)4R1 zTVUR-DG`jFFcmcI?Mj$Rvv|R+pz^BH2%7e_Bae*@#5tBQ)42Z_axoNGxokUVXxag; zu9_Ob>C>ginOgtx{otA94}%q}YryomD-zEOrasARM!{I$NgI0kjgyJ%S+grZLsNWx zusJq6Zq$SKhP%w6}c=n~k;Ju|Y!3*!VpBahIxln&?{pt{M=UHFLTVof!9t&Ci z<>TYt#LvISIo~S}R)fzsC+9z29-CUzb_!HPqaygLyc`@p)S0fV0}+K7>p#I%ZFQWT zXByhG@MKL@V&2Vhvq|O7WbPPf&Hf3x4t0iG{ra!UTVn%JLC1B}ne4uzHs0l0GrN)7 z70eMbOeRunn@jHP-Jx zTRNr!=hRn;`IRMcpRlPT&gOf|DK8cUV}W3*th5BQwRa?T!B9_)E*cZjJ>~}5RN((( z?0oO5(xyUBW5dQxJwAJ|45i6iV`tB?V5+ht?j|*LbbDU~+S)tN-Bjptgz=#!Z;hRe zvGlnVvhqbsCnmlSI=bPUx?;-Y2oATzZx)9trqblCv0ihTzF%(~IC=uZ-&7!PjYTsimG#zXMeYq{rXlXJ7mN)te*()) + { + projectile.Kill(); + return; + } + + // On frame 1, set the beam vector and rotation, but set the real velocity to zero. + if(projectile.velocity != Vector2.Zero) + { + beamVector = Vector2.Normalize(projectile.velocity); + projectile.rotation = projectile.velocity.ToRotation(); + projectile.velocity = Vector2.Zero; + } + + // Reduce the "power" and thus scale of the projectile over its lifetime. + float power = (float)projectile.timeLeft / Lifetime; + projectile.scale = MaxBeamScale * power; + + // Perform a laser scan to calculate the correct length of the beam. + float[] laserScanResults = new float[NumSamplePoints]; + + // A minimum width is forced for the beam scan to prevent massive lag when fired into open areas. + float scanWidth = projectile.scale < 1f ? 1f : projectile.scale; + Collision.LaserScan(projectile.Center, beamVector, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults); + float avg = 0f; + for (int i = 0; i < laserScanResults.Length; ++i) + avg += laserScanResults[i]; + avg /= NumSamplePoints; + projectile.ai[0] = MathHelper.Lerp(projectile.ai[0], avg, BeamLengthChangeFactor); + + // X = beam length. Y = beam width. + Vector2 beamDims = new Vector2(beamVector.Length() * projectile.ai[0], projectile.width * projectile.scale); + + Color beamColor = GetBeamColor(); + ProduceBeamDust(beamColor); + + // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. + if (Main.netMode != NetmodeID.Server) + { + WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); + // A universal time-based sinusoid which updates extremely rapidly. GlobalTime is 0 to 3600, measured in seconds. + float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTime * 20f); + Vector2 ripplePos = projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(projectile.rotation); + // WaveData is encoded as a Color. Not sure why, considering Vector3 exists. + Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine); + wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, projectile.rotation); + } + + // Make the beam cast light along its length. + // v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight + DelegateMethods.v3_1 = beamColor.ToVector3() * power * MaxBeamBrightness; + Utils.PlotTileLine(projectile.Center, projectile.Center + beamVector * projectile.ai[0], beamDims.Y, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + // Determines whether the specified target hitbox is intersecting with the beam. + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough. + if (projHitbox.Intersects(targetHitbox)) + return true; + // Otherwise, perform an AABB line collision check to check the whole beam. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + beamVector * projectile.ai[0], BeamHitboxCollisionWidth * projectile.scale, ref _); + } + + private Color GetBeamColor() + { + Color c = ValkyrieRay.LightColor; + c.A = 64; + return c; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // If the beam doesn't have a defined projection vector, don't draw anything. + if (beamVector == Vector2.Zero) + return false; + + Texture2D tex = Main.projectileTexture[projectile.type]; + float beamLength = projectile.ai[0]; + Vector2 centerFloored = projectile.Center.Floor() + beamVector * projectile.scale * BeamRenderTileOffset; + Vector2 scaleVec = new Vector2(projectile.scale); + + // Reduce the beam length proportional to its square area to reduce block penetration. + beamLength -= BeamLengthReductionFactor * projectile.scale * projectile.scale; + + DelegateMethods.f_1 = 1f; // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1. + Vector2 beamStartPos = centerFloored - Main.screenPosition; + Vector2 beamEndPos = beamStartPos + beamVector * beamLength; + Utils.LaserLineFraming llf = new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw); + + // Draw the outermost beam + // c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw + Color beamColor = GetBeamColor(); + DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + + // Draw the inner beams, each with reduced size and whiter color + for (int i = 0; i < 5; ++i) + { + beamColor = Color.Lerp(beamColor, Color.White, 0.4f); + scaleVec *= 0.85f; + DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + } + return false; + } + + private void ProduceBeamDust(Color beamColor) + { + // Create a few dust per frame a small distance from where the beam ends. + Vector2 laserEndPos = projectile.Center + beamVector * (projectile.ai[0] - MainDustBeamEndOffset * projectile.scale); + for (int i = 0; i < 2; ++i) + { + // 50% chance for the dust to come off on either side of the beam. + float dustAngle = projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; + float dustStartDist = Main.rand.NextFloat(1f, 1.8f); + Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; + int d = Dust.NewDust(laserEndPos, 0, 0, BeamDustID, dustVel.X, dustVel.Y, 0, beamColor); + Main.dust[d].color = beamColor; + Main.dust[d].noGravity = true; + Main.dust[d].scale = 0.7f; + + // Scale up dust with the projectile if it's large. + if (projectile.scale > 1f) + { + Main.dust[d].velocity *= projectile.scale; + Main.dust[d].scale *= projectile.scale; + } + + // If the beam isn't at max scale, then make additional smaller dust. + if (projectile.scale != MaxBeamScale) + { + Dust smallDust = Dust.CloneDust(d); + smallDust.scale /= 2f; + } + } + + // Low chance every frame to spawn a large "directly sideways" dust which doesn't move. + if (Main.rand.NextBool(5)) + { + // Velocity, flipped sideways, times -50% to 50% of beam width. + Vector2 dustOffset = beamVector.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * projectile.width; + Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset; + int d = Dust.NewDust(dustPos, 8, 8, BeamDustID, 0f, 0f, 100, beamColor, 1.2f); + Main.dust[d].velocity *= 0.5f; + + // Force the dust to always move downwards, never upwards. + Main.dust[d].velocity.Y = -Math.Abs(Main.dust[d].velocity.Y); + } + } + + // Automatically iterates through every tile the laser is overlapping to cut grass at all those locations. + public override void CutTiles() + { + // tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile). + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Utils.PerLinePoint cut = new Utils.PerLinePoint(DelegateMethods.CutTiles); + Vector2 beamStartPos = projectile.Center; + Vector2 beamEndPos = beamStartPos + beamVector * projectile.ai[0]; + Utils.PlotTileLine(beamStartPos, beamEndPos, projectile.width * projectile.scale, cut); + } + } +} diff --git a/Projectiles/Magic/ValkyrieRaybeam.png b/Projectiles/Magic/ValkyrieRaybeam.png new file mode 100644 index 0000000000000000000000000000000000000000..4bcb09bbf2c79b9a78f509ae232c0a8a5706bcdd GIT binary patch literal 526 zcmV+p0`dKcP)Px#1ZP1_K>z@;j|==^1poj55>QN3MF0Q*(9qD>*x2IY;_&eB`1tt1S?)Xl00Ejw zL_t(&L+zO{Z-X!pg-IvGz`%eQ85#Nizk-pG5iu|@AhuR_%8S%fPiJUqo64VLog5sW zAJ5pqd1Q_Z!|+Kl&vULH$HB4hd#64=p7GByM*}5QRdKy6OOD&Naa`AxqopjoB29_( z$W@s)MQS1%ITcbu1$AIumxS|3dQ;amM~h`yIBH&n_Xzji6{~%CMeinjB6{Mf&lpl-rio*`t2eM_lXV?IwGu6O#d8R7+^QP$KQBf590nT$!KYOMszmK|q zj{uE?isg;OYVXgZXMD}~v))LgS9m`Cdt{xRo<;WO-y;C8nx^5pcJe5}=;wLnDA!K^ z9s%52?5y%$OI+KB^9X4F@k#J|BAW9$RS}TNB$g5ok0JnN5=#m2q$tb20Jho;&0V$G QTmS$707*qoM6N<$f>n6 Date: Mon, 27 Apr 2020 23:55:14 -0500 Subject: [PATCH 020/137] Melee speed cap removed. Astrum Deus swarm spreads out more. Multiple refactors. --- CalPlayer/CalamityPlayer.cs | 16 +- CalPlayer/CalamityPlayerMiscEffects.cs | 8 +- NPCs/CalamityAI.cs | 680 +++++++++++++------------ Projectiles/Boss/DarkOrb.cs | 28 +- 4 files changed, 379 insertions(+), 353 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index eb8167edcc..08db03605f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3210,7 +3210,21 @@ namespace CalamityMod.CalPlayer { meleeSpeedMult += 0.1f; } - if (CalamityMod.CalamityConfig.ProficiencyEnabled) + if (bloodyWormTooth) + { + if (player.statLife < (int)(player.statLifeMax2 * 0.5)) + meleeSpeedMult += 0.1f; + else + meleeSpeedMult += 0.05f; + } + if (aquaticScourgeLore) + { + if (player.wellFed) + meleeSpeedMult += 0.025f; + else + meleeSpeedMult -= 0.025f; + } + if (CalamityMod.CalamityConfig.ProficiencyEnabled) { meleeSpeedMult += GetMeleeSpeedBonus(); } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2bc798757e..d29c4be511 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1405,7 +1405,6 @@ namespace CalamityMod.CalPlayer player.statDefense += 1; player.allDamage += 0.025f; modPlayer.AllCritBoost(1); - player.meleeSpeed += 0.025f; player.minionKB += 0.25f; player.moveSpeed += 0.1f; } @@ -1414,7 +1413,6 @@ namespace CalamityMod.CalPlayer player.statDefense -= 1; player.allDamage -= 0.025f; modPlayer.AllCritBoost(-1); - player.meleeSpeed -= 0.025f; player.minionKB -= 0.25f; player.moveSpeed -= 0.1f; } @@ -2948,13 +2946,11 @@ namespace CalamityMod.CalPlayer if (player.statLife < (int)(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; } } @@ -3472,8 +3468,8 @@ namespace CalamityMod.CalPlayer } } - if (player.meleeSpeed < 0.5f) - player.meleeSpeed = 0.5f; + /*if (player.meleeSpeed < 0.5f) + player.meleeSpeed = 0.5f;*/ // 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% if (player.endurance > 0f) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 74c02fbd53..b443233979 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -37,8 +37,8 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Adjust hostility and stats - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive || - (double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99) + if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || CalamityWorld.bossRushActive || + Main.npc[(int)npc.ai[1]].life <= Main.npc[(int)npc.ai[1]].lifeMax * 0.99) { calamityGlobalNPC.newAI[0] = 1f; npc.damage = npc.defDamage; @@ -72,8 +72,8 @@ namespace CalamityMod.NPCs doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= ai3; if (doSpiral) { - int npcPosX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcPosY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int npcPosX = (int)(npc.position.X + (npc.width / 2)) / 16; + int npcPosY = (int)(npc.position.Y + (npc.height / 2)) / 16; // Barf out enemies int variable = 10; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); - Vector2 spawnPosition = new Vector2((float)(npcPosX * 16), (float)(npcPosY * 16)); + Vector2 spawnPosition = new Vector2(npcPosX * 16, npcPosY * 16); if (Main.tile[npcPosX, npcPosY] != null) { @@ -106,8 +106,8 @@ namespace CalamityMod.NPCs // Spin velocity float velocity = (float)(Math.PI * 2D) / 120f; - npc.velocity = npc.velocity.RotatedBy((double)(-(double)velocity * npc.localAI[1])); - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; // Reset and charge at target if (calamityGlobalNPC.newAI[3] >= ai3 + 180f) @@ -145,9 +145,9 @@ namespace CalamityMod.NPCs lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } @@ -163,8 +163,8 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 300f : (revenge ? 360f : 420f))) { - int npcPosX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcPosY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int npcPosX = (int)(npc.position.X + (npc.width / 2)) / 16; + int npcPosY = (int)(npc.position.Y + (npc.height / 2)) / 16; if (npcPosX < 0) npcPosX = 0; @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs 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); + Vector2 valueBoom = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 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; @@ -213,12 +213,12 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + vector15 *= Main.rand.Next(50, 401) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); if (death) vector15 *= 1.1f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); num3 = num321; } } @@ -235,18 +235,18 @@ namespace CalamityMod.NPCs if (npc.type == ModContent.NPCType()) { 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] += Main.rand.Next(num); + if (npc.localAI[0] >= Main.rand.Next(700, 10000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.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 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); int damage = Main.expertMode ? 25 : 30; float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; @@ -262,17 +262,17 @@ namespace CalamityMod.NPCs } else if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) + npc.localAI[0] += Main.rand.Next(4); + if (npc.localAI[0] >= Main.rand.Next(700, 10000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - 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 num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); int damage = Main.expertMode ? 23 : 28; float num941 = CalamityWorld.bossRushActive ? 12f : 8f; @@ -317,8 +317,8 @@ namespace CalamityMod.NPCs // Despawn bool notOcean = player.position.Y < 800f || - (double)player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); if (player.dead || (notOcean && !CalamityWorld.bossRushActive && !player.Calamity().ZoneSulphur)) { @@ -326,10 +326,10 @@ namespace CalamityMod.NPCs npc.TargetClosest(false); npc.velocity.Y += 2f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) npc.velocity.Y += 2f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) { for (int a = 0; a < Main.npc.Length; a++) { @@ -362,9 +362,9 @@ namespace CalamityMod.NPCs // Velocity and movement float num188 = 5f; float num189 = 0.08f; - 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); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); int num42 = -1; int num43 = (int)(player.Center.X / 16f); int num44 = (int)(player.Center.Y / 16f); @@ -388,7 +388,7 @@ namespace CalamityMod.NPCs if (num42 > 0) { num42 *= 16; - float num47 = (float)(num42 + (notOcean ? 800 : 400)); //800 + float num47 = num42 + (notOcean ? 800 : 400); //800 if (calamityGlobalNPC.newAI[0] != 1f) { num192 = num47; @@ -444,68 +444,33 @@ namespace CalamityMod.NPCs npc.velocity *= num49; } } - - if (calamityGlobalNPC.newAI[0] != 1f) - { - for (int num51 = 0; num51 < Main.maxNPCs; 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 < Main.maxNPCs; 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 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); if (!head) { - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (npc.ai[1] > 0f && npc.ai[1] < 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; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (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)); + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; @@ -523,8 +488,8 @@ namespace CalamityMod.NPCs } else if (!doSpiral) { - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; @@ -549,14 +514,14 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > num192) 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 (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189 * 2f; else 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 (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += num189 * 2f; @@ -573,7 +538,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num191) 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189; @@ -588,7 +553,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.Y > num192) 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num189; @@ -597,7 +562,7 @@ namespace CalamityMod.NPCs } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; } } #endregion @@ -611,7 +576,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.2f, 0f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); // Center Vector2 vectorCenter = npc.Center; @@ -660,7 +625,7 @@ namespace CalamityMod.NPCs npc.defense = npc.defDefense; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Variables for buffing the AI bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; @@ -679,7 +644,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(3) < dustAmt) { - int dust = Dust.NewDust(vectorCenter - new Vector2((float)size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int dust = Dust.NewDust(vectorCenter - new Vector2(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; @@ -703,7 +668,7 @@ namespace CalamityMod.NPCs // Variables for target location relative to npc location float xDistance = player.Center.X - vectorCenter.X; float yDistance = player.Center.Y - vectorCenter.Y; - float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); + float totalDistance = (float)Math.Sqrt(xDistance * xDistance + yDistance * yDistance); // Static movement towards target if (npc.ai[0] <= 2f || npc.ai[0] == 5f) @@ -762,8 +727,8 @@ namespace CalamityMod.NPCs return; } npc.ai[0] = 1f; - npc.ai[1] = (float)playerPosX; - npc.ai[2] = (float)playerPosY; + npc.ai[1] = playerPosX; + npc.ai[2] = playerPosY; npc.netUpdate = true; } } @@ -773,7 +738,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 1f) { npc.chaseable = true; - Vector2 position = new Vector2(npc.ai[1] * 16f - (float)(npc.width / 2), npc.ai[2] * 16f - (float)(npc.height / 2)); + Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); for (int m = 0; m < 5; m++) { int dust = Dust.NewDust(position, npc.width, npc.height, 235, 0f, -1f, 90, default, 2f); @@ -853,9 +818,9 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { float num742 = CalamityWorld.bossRushActive ? 6f : 4f; - float num743 = player.position.X + (float)player.width * 0.5f - vectorCenter.X; - float num744 = player.position.Y + (float)player.height * 0.5f - vectorCenter.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + float num743 = player.position.X + player.width * 0.5f - vectorCenter.X; + float num744 = player.position.Y + player.height * 0.5f - vectorCenter.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -869,7 +834,7 @@ namespace CalamityMod.NPCs 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 deltaAngle = rotation / numProj; double offsetAngle; for (int i = 0; i < numProj; i++) @@ -889,9 +854,9 @@ namespace CalamityMod.NPCs projectileSpeed += projectileSpeedBoost; vectorCenter = npc.Center; - float relativeSpeedX = player.position.X + (float)player.width * 0.5f - vectorCenter.X; - float relativeSpeedY = player.position.Y + (float)player.height * 0.5f - vectorCenter.Y; - float totalRelativeSpeed = (float)Math.Sqrt((double)(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY)); + float relativeSpeedX = player.position.X + player.width * 0.5f - vectorCenter.X; + float relativeSpeedY = player.position.Y + player.height * 0.5f - vectorCenter.Y; + float totalRelativeSpeed = (float)Math.Sqrt(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY); totalRelativeSpeed = projectileSpeed / totalRelativeSpeed; relativeSpeedX *= totalRelativeSpeed; relativeSpeedY *= totalRelativeSpeed; @@ -924,7 +889,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 150f) //100 { if (npc.velocity.X > 0f) npc.velocity.X *= 0.985f; @@ -934,7 +899,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 150f) //100 { if (npc.velocity.X < 0f) npc.velocity.X *= 0.985f; @@ -978,10 +943,10 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) projectileSpeed = 12f; - float num180 = player.position.X + (float)player.width * 0.5f - vectorCenter.X; + float num180 = player.position.X + player.width * 0.5f - vectorCenter.X; float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - vectorCenter.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float num182 = player.position.Y + player.height * 0.5f - vectorCenter.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = projectileSpeed / num183; num180 *= num183; @@ -994,12 +959,12 @@ namespace CalamityMod.NPCs for (int num186 = 0; num186 < 6; num186++) { - num180 = player.position.X + (float)player.width * 0.5f - vectorCenter.X; - num182 = player.position.Y + (float)player.height * 0.5f - vectorCenter.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num180 = player.position.X + player.width * 0.5f - vectorCenter.X; + num182 = player.position.Y + player.height * 0.5f - vectorCenter.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = projectileSpeed / num183; - num180 += (float)Main.rand.Next(-80, 81); - num182 += (float)Main.rand.Next(-80, 81); + num180 += Main.rand.Next(-80, 81); + num182 += Main.rand.Next(-80, 81); num180 *= num183; num182 *= num183; int projectile = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); @@ -1011,7 +976,7 @@ namespace CalamityMod.NPCs 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 deltaAngle = spread / totalProjectiles; // Angle between each projectile, 0.04363325 double offsetAngle; float velocity = CalamityWorld.bossRushActive ? 9f : 6f; @@ -1107,7 +1072,7 @@ namespace CalamityMod.NPCs Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 104); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); - Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), 40 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), 40 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); } } } @@ -1138,7 +1103,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) { - Projectile.NewProjectile(source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + Projectile.NewProjectile(source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); calamityGlobalNPC.newAI[0] = 1f; } else @@ -1147,7 +1112,7 @@ namespace CalamityMod.NPCs { npc.localAI[0] = laserVelocity.X; npc.localAI[1] = laserVelocity.Y; - Projectile.NewProjectile(source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); + Projectile.NewProjectile(source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); } } } @@ -1162,10 +1127,10 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Spawn phase 2 Cal if (lifeRatio <= 0.75f && Main.netMode != NetmodeID.MultiplayerClient && !phase2) @@ -1227,16 +1192,16 @@ namespace CalamityMod.NPCs // Spawn brothers if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = (float)npc.lifeMax; + calamityGlobalNPC.newAI[0] = 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) < calamityGlobalNPC.newAI[0]) + int num660 = (int)(npc.lifeMax * 0.3); //70%, 40%, and 10% + if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) { - calamityGlobalNPC.newAI[0] = (float)npc.life; + calamityGlobalNPC.newAI[0] = npc.life; if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) { NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); @@ -1294,25 +1259,25 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; // Rotation - 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; + float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; if (num803 < 0f) - num803 += 6.283f; - else if ((double)num803 > 6.283) - num803 -= 6.283f; + num803 += MathHelper.TwoPi; + else if (num803 > MathHelper.TwoPi) + num803 -= MathHelper.TwoPi; float num804 = 0.1f; if (npc.rotation < num803) { - if ((double)(num803 - npc.rotation) > 3.1415) + if ((num803 - npc.rotation) > MathHelper.Pi) npc.rotation -= num804; else npc.rotation += num804; } else if (npc.rotation > num803) { - if ((double)(npc.rotation - num803) > 3.1415) + if ((npc.rotation - num803) > MathHelper.Pi) npc.rotation += num804; else npc.rotation -= num804; @@ -1321,9 +1286,9 @@ namespace CalamityMod.NPCs 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; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) npc.rotation = num803; @@ -1381,10 +1346,10 @@ namespace CalamityMod.NPCs 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) + (phase2 ? 60f : 0f)) - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num825 = player.position.X + (player.width / 2) - vector82.X; + float num826 = player.position.Y + (player.height / 2) - ((CalamityWorld.bossRushActive ? 400f : 300f) + (phase2 ? 60f : 0f)) - vector82.Y; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; num826 *= num827; @@ -1423,8 +1388,8 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + num825 = player.position.X + (player.width / 2) - vector82.X; + num826 = player.position.Y + (player.height / 2) - vector82.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1448,7 +1413,7 @@ namespace CalamityMod.NPCs int num829 = expertMode ? 34 : 42; int num830 = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1474,7 +1439,7 @@ namespace CalamityMod.NPCs float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 13f : 10.5f); int num829 = expertMode ? 28 : 35; int num830 = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; num825 *= num827; num826 *= num827; @@ -1490,7 +1455,7 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 1f) { int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num831 = -1; float num832 = expertMode ? 9.5f : 8f; @@ -1516,10 +1481,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num834 = player.position.X + (player.width / 2) + (num831 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; + float num835 = player.position.Y + (player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num832 / num836; num834 *= num836; num835 *= num836; @@ -1549,8 +1514,8 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num833; } - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + num834 = player.position.X + (player.width / 2) - vector83.X; + num835 = player.position.Y + (player.height / 2) - vector83.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1573,7 +1538,7 @@ namespace CalamityMod.NPCs float num837 = CalamityWorld.bossRushActive ? 15f : 11f; int num838 = brotherAlive ? (expertMode ? 34 : 42) : (expertMode ? 28 : 35); int num839 = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; num834 *= num836; num835 *= num836; @@ -1599,7 +1564,7 @@ namespace CalamityMod.NPCs float num837 = CalamityWorld.bossRushActive ? 14f : 10.5f; int num838 = expertMode ? 20 : 24; int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; num834 *= num836; num835 *= num836; @@ -1647,13 +1612,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= chargeTime) { npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= chargeTime + 15f) { @@ -1689,13 +1654,13 @@ namespace CalamityMod.NPCs } int num408 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + 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)); + Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num62 * num408) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector11.Y; + float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); num67 = num63 / num67; num65 *= num67; @@ -1742,7 +1707,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); CalamityGlobalNPC.cataclysm = npc.whoAmI; @@ -1757,25 +1722,25 @@ namespace CalamityMod.NPCs 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; + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; if (num842 < 0f) - num842 += 6.283f; - else if ((double)num842 > 6.283) - num842 -= 6.283f; + num842 += MathHelper.TwoPi; + else if (num842 > MathHelper.TwoPi) + num842 -= MathHelper.TwoPi; float num843 = 0.15f; if (npc.rotation < num842) { - if ((double)(num842 - npc.rotation) > 3.1415) + if ((num842 - npc.rotation) > MathHelper.Pi) npc.rotation -= num843; else npc.rotation += num843; } else if (npc.rotation > num842) { - if ((double)(npc.rotation - num842) > 3.1415) + if ((npc.rotation - num842) > MathHelper.Pi) npc.rotation += num843; else npc.rotation -= num843; @@ -1784,9 +1749,9 @@ namespace CalamityMod.NPCs 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; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; @@ -1836,13 +1801,13 @@ namespace CalamityMod.NPCs } int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + 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)); + Vector2 vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num864 = player.position.X + (player.width / 2) + (num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; + float num865 = player.position.Y + (player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); if (expertMode || provy) { @@ -1899,7 +1864,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) { npc.localAI[2] += 1f; @@ -1921,10 +1886,10 @@ namespace CalamityMod.NPCs float num867 = CalamityWorld.bossRushActive ? 9f : 6f; int num868 = expertMode ? 30 : 38; int num869 = ModContent.ProjectileType(); - 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)); + vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num864 = player.position.X + (player.width / 2) - vector86.X; + num865 = player.position.Y + (player.height / 2) - vector86.Y; + num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); num866 = num867 / num866; num864 *= num866; num865 *= num866; @@ -1958,10 +1923,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector87 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num871 = player.position.X + (player.width / 2) - vector87.X; + float num872 = player.position.Y + (player.height / 2) - vector87.Y; + float num873 = (float)Math.Sqrt(num871 * num871 + num872 * num872); num873 = num870 / num873; npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; @@ -1984,13 +1949,13 @@ namespace CalamityMod.NPCs npc.velocity.X *= 0.93f; npc.velocity.Y *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= 105f) { @@ -2015,7 +1980,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); CalamityGlobalNPC.catastrophe = npc.whoAmI; @@ -2030,25 +1995,25 @@ namespace CalamityMod.NPCs 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; + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); + float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; if (num842 < 0f) - num842 += 6.283f; - else if ((double)num842 > 6.283) - num842 -= 6.283f; + num842 += MathHelper.TwoPi; + else if (num842 > MathHelper.TwoPi) + num842 -= MathHelper.TwoPi; float num843 = 0.15f; if (npc.rotation < num842) { - if ((double)(num842 - npc.rotation) > 3.1415) + if ((num842 - npc.rotation) > MathHelper.Pi) npc.rotation -= num843; else npc.rotation += num843; } else if (npc.rotation > num842) { - if ((double)(npc.rotation - num842) > 3.1415) + if ((npc.rotation - num842) > MathHelper.Pi) npc.rotation += num843; else npc.rotation -= num843; @@ -2057,9 +2022,9 @@ namespace CalamityMod.NPCs 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; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; @@ -2109,13 +2074,13 @@ namespace CalamityMod.NPCs } int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + 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)); + Vector2 vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num864 = player.position.X + (player.width / 2) + (num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; + float num865 = player.position.Y + (player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); if (expertMode || provy) { @@ -2172,7 +2137,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) { npc.localAI[2] += 1f; @@ -2194,10 +2159,10 @@ namespace CalamityMod.NPCs float num867 = CalamityWorld.bossRushActive ? 18f : 12f; int num868 = expertMode ? 29 : 36; int num869 = ModContent.ProjectileType(); - 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)); + vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num864 = player.position.X + (player.width / 2) - vector86.X; + num865 = player.position.Y + (player.height / 2) - vector86.Y; + num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); num866 = num867 / num866; num864 *= num866; num865 *= num866; @@ -2231,10 +2196,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector87 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num871 = player.position.X + (player.width / 2) - vector87.X; + float num872 = player.position.Y + (player.height / 2) - vector87.Y; + float num873 = (float)Math.Sqrt(num871 * num871 + num872 * num872); num873 = num870 / num873; npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; @@ -2257,13 +2222,13 @@ namespace CalamityMod.NPCs npc.velocity.X *= 0.93f; npc.velocity.Y *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= 90f) //80 { @@ -2292,14 +2257,14 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / npc.lifeMax; // Variables bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; int shootBuff = death ? 1 : (int)(2f * (1f - lifeRatio)); - float shootTimer = 1f + ((float)shootBuff); + float shootTimer = 1f + shootBuff; bool dayTime = Main.dayTime; // Get a target @@ -2349,7 +2314,7 @@ namespace CalamityMod.NPCs // 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), 1.3f, 0.5f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 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) || @@ -2369,7 +2334,7 @@ namespace CalamityMod.NPCs // Fire astral flames while teleporting if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + Vector2 shootFromVector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 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; @@ -2390,11 +2355,11 @@ namespace CalamityMod.NPCs 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + 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)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -2404,12 +2369,12 @@ namespace CalamityMod.NPCs 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)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); + num180 += Main.rand.Next(-60, 61); + num182 += Main.rand.Next(-60, 61); num180 *= num183; num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); @@ -2473,7 +2438,7 @@ namespace CalamityMod.NPCs 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) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; } else @@ -2490,10 +2455,10 @@ namespace CalamityMod.NPCs // 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); + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - 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) + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) flag52 = true; if (flag52) @@ -2503,7 +2468,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 0f) npc.velocity.Y = 0f; - if ((double)npc.velocity.Y > -0.2) + if (npc.velocity.Y > -0.2) npc.velocity.Y -= 0.025f; else npc.velocity.Y -= 0.2f; @@ -2516,7 +2481,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < 0f) npc.velocity.Y = 0f; - if ((double)npc.velocity.Y < 0.1) + if (npc.velocity.Y < 0.1) npc.velocity.Y += 0.025f; else npc.velocity.Y += 0.5f; @@ -2560,11 +2525,11 @@ namespace CalamityMod.NPCs // Set jump velocity, reset and set AI to next phase (Stomp) float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + velocityBoost; - npc.velocity.X = velocityX * (float)npc.direction; + npc.velocity.X = velocityX * npc.direction; if (revenge) { - if (player.position.Y < npc.position.Y + (float)npc.height) + if (player.position.Y < npc.position.Y + npc.height) npc.velocity.Y = -14.5f; else npc.velocity.Y = 1f; @@ -2604,7 +2569,7 @@ namespace CalamityMod.NPCs { 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, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); Main.dust[num624].velocity *= 0.2f; } } @@ -2613,16 +2578,16 @@ namespace CalamityMod.NPCs { // Set velocities while falling, this happens before the stomp // 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))) + if (npc.target >= 0 && revenge && ((player.position.Y > npc.position.Y + npc.height && npc.velocity.Y > 0f) || (player.position.Y < npc.position.Y + 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) + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) { npc.velocity.X *= 0.9f; - if (player.position.Y > npc.position.Y + (float)npc.height) + if (player.position.Y > npc.position.Y + npc.height) { float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); float fallSpeed = 0.8f + fallSpeedBoost; @@ -2683,7 +2648,7 @@ namespace CalamityMod.NPCs 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)) + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2(num1250 * 16, num1251 * 16), 1, 1, player.position, player.width, player.height)) break; if (num1249 > 100) @@ -2692,8 +2657,8 @@ namespace CalamityMod.NPCs // 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.ai[2] = num1250; + npc.ai[3] = num1251; npc.netUpdate = true; Block: ; @@ -2713,8 +2678,8 @@ namespace CalamityMod.NPCs 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); + npc.position.X = npc.ai[2] * 16f - (npc.width / 2); + npc.position.Y = npc.ai[3] * 16f - (npc.height / 2); // Reset alpha and set AI to next phase (End of teleport) npc.alpha = 255; @@ -2795,9 +2760,10 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive); // Emit 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); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Dust and alpha effects if (head || Main.npc[(int)npc.ai[1]].alpha < 128) @@ -2887,9 +2853,9 @@ namespace CalamityMod.NPCs 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; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } @@ -2933,7 +2899,7 @@ namespace CalamityMod.NPCs // Calculate phases based on worm HP int astrumDeusTotalHP = 0; - double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; + double mainDeusHPRatio = npc.life / npc.lifeMax; if (calamityGlobalNPC.newAI[0] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) @@ -2944,12 +2910,12 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[2] < 10f) { calamityGlobalNPC.newAI[2] += 1f; - calamityGlobalNPC.newAI[3] += (float)Main.npc[i].lifeMax; + calamityGlobalNPC.newAI[3] += Main.npc[i].lifeMax; } } } - double astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)calamityGlobalNPC.newAI[3]; + double astrumDeusHPRatio = astrumDeusTotalHP / calamityGlobalNPC.newAI[3]; if (astrumDeusHPRatio < 0.33) { if (mainDeusHPRatio > 0.33) @@ -2988,9 +2954,9 @@ namespace CalamityMod.NPCs float num188 = 10f + speedBoost; float num189 = 0.2f + turnSpeedBoost; - 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); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); int num42 = -1; int num43 = (int)(player.Center.X / 16f); @@ -3027,30 +2993,15 @@ namespace CalamityMod.NPCs } } - for (int num52 = 0; num52 < Main.maxNPCs; 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 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (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 num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; @@ -3077,7 +3028,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189 * 2f; @@ -3085,7 +3036,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += num189 * 2f; @@ -3102,7 +3053,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num191) 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189; @@ -3117,7 +3068,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.Y > num192) 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num189; @@ -3126,7 +3077,7 @@ namespace CalamityMod.NPCs } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; } // Only the main worm body and tail use this code @@ -3143,16 +3094,16 @@ namespace CalamityMod.NPCs if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) { int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.65 || death || player.gravDir == -1f) + if (npc.life <= npc.lifeMax * 0.65 || death || player.gravDir == -1f) { shootTime += death ? 4 : 2; } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || death || player.gravDir == -1f) + if (npc.life <= npc.lifeMax * 0.3 || death || player.gravDir == -1f) { shootTime += death ? 6 : 2; } - npc.localAI[0] += (float)Main.rand.Next(shootTime); - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) + npc.localAI[0] += Main.rand.Next(shootTime); + if (npc.localAI[0] >= Main.rand.Next(1400, 20000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); @@ -3171,10 +3122,10 @@ namespace CalamityMod.NPCs { num941 *= 2f; } - 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 num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -3189,33 +3140,33 @@ namespace CalamityMod.NPCs } // Follow the head - 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); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (npc.ai[1] > 0f && npc.ai[1] < 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; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (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)); + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; @@ -3244,7 +3195,7 @@ namespace CalamityMod.NPCs } // Life remaining - float deusHPRatio = (float)npc.life / (float)npc.lifeMax; + float deusHPRatio = npc.life / npc.lifeMax; // Only the smaller worm heads use this code if (head) @@ -3294,9 +3245,9 @@ namespace CalamityMod.NPCs // Movement variables int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num180 < 0) num180 = 0; @@ -3314,12 +3265,12 @@ namespace CalamityMod.NPCs { 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)) + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[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) + vector105.X = num952 * 16; + vector105.Y = num953 * 16; + if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) { flies = true; break; @@ -3333,8 +3284,15 @@ namespace CalamityMod.NPCs { 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 = (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200; + + int rectX = (int)(600f * deusHPRatio); + if (rectX < 200) + rectX = 200; + + int rectY = (int)(enraged ? 200f : 400f * deusHPRatio); + if (rectY < (enraged ? 75 : 150)) + rectY = enraged ? 75 : 150; + bool flag95 = true; if (npc.position.Y > player.position.Y) { @@ -3360,16 +3318,33 @@ namespace CalamityMod.NPCs // Velocity 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 = 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); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); + + // Spread the worms out based on proximity to other worms + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && i != npc.whoAmI) + { + Vector2 vector = Main.npc[i].Center - npc.Center; + if (vector.Length() < 60f) + { + vector.Normalize(); + vector *= 200f; + num191 -= vector.X; + num192 -= vector.Y; + } + } + } + + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); if (!flies) { @@ -3379,7 +3354,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < maxSpeed * 0.4) { if (npc.velocity.X < 0f) npc.velocity.X -= num188 * 1.1f; @@ -3415,9 +3390,9 @@ namespace CalamityMod.NPCs 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); + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = maxSpeed / num193; num191 *= num198; num192 *= num198; @@ -3457,7 +3432,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num192) < maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += num188 * 2f; @@ -3465,7 +3440,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num191) < maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += num188 * 2f; @@ -3482,7 +3457,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num191) 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < maxSpeed * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num188; @@ -3497,7 +3472,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.Y > num192) 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 ((Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < maxSpeed * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num188; @@ -3507,7 +3482,7 @@ namespace CalamityMod.NPCs } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (flies) { @@ -5896,6 +5871,37 @@ namespace CalamityMod.NPCs int totalProjectiles = 0; int chains = 0; + // Parabolic Arcs + if (npc.localAI[0] % 60f == 0f) + { + radialOffset = 0.1f; + float diameter = 90f; + + // Offset the arc so the central projectile(s) point towards the target + targetVector.Y -= Math.Abs(targetVector.X) * radialOffset; + + // Velocity of the arc moving towards the target + targetVector = Vector2.Normalize(targetVector) * projectileSpeed; + + // Offset the arc + Vector2 velocity = targetVector; + velocity.Normalize(); + velocity *= diameter; + + totalProjectiles = 16; + int half = totalProjectiles / 2; + float scalar = 0.2f; + float velocityMult = (totalProjectiles - 1f) / 2f; + offsetAngle = (float)Math.PI * radialOffset; + + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - velocityMult; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians, default); + int proj = Projectile.NewProjectile(vectorCenter + offset, targetVector * (1f - (Math.Abs(radians) / half * scalar)), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -1f, 0f); + } + } + // Arcs /*if (npc.localAI[0] % 60f == 0f) { @@ -5916,7 +5922,7 @@ namespace CalamityMod.NPCs { float radians = j - (totalProjectiles - 1f) / 2f; Vector2 offset = velocity.RotatedBy(offsetAngle * radians, default); - int proj = Projectile.NewProjectile(vectorCenter + offset, targetVector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 11, 0f); + int proj = Projectile.NewProjectile(vectorCenter + offset, targetVector, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -1f, 0f); } } @@ -5972,7 +5978,7 @@ namespace CalamityMod.NPCs else npc.ai[2] = 0f;*/ - if (npc.localAI[0] % 180f == 0f) + /*if (npc.localAI[0] % 180f == 0f) { totalProjectiles = 12; offsetAngle = 360 / totalProjectiles; @@ -5980,9 +5986,9 @@ namespace CalamityMod.NPCs for (int i = 0; i < totalProjectiles; i++) { Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, i * offsetAngle); - //Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, Main.rand.Next(12, 14), i * offsetAngle); + Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 12f, i * offsetAngle); } - } + }*/ } if (npc.velocity.Length() > 0f) diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index bd52c57328..d8d9d314dc 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -409,7 +409,7 @@ namespace CalamityMod.Projectiles.Boss float wavyVelocity = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; } private void LurchForward(float frequncy, float deceleration, float acceleration) @@ -439,20 +439,30 @@ namespace CalamityMod.Projectiles.Boss private void OscillationMotion(float frequncy, bool useSin) { + projectile.ai[1] += frequncy; + + float oscillation = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); + if (start) { velocity = projectile.velocity; start = false; } + else if (oscillation == 0f) + { + Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; + Vector2 vector = target.Center + target.velocity * 20f - projectile.Center; + vector.Normalize(); + vector *= velocity.Length(); + projectile.velocity = vector; + } + else + { + float amplitude = velocity.Length(); - projectile.ai[1] += frequncy; - - float amplitude = velocity.Length(); - - float oscillation = useSin ? (float)Math.Sin(projectile.ai[1]) : (float)Math.Cos(projectile.ai[1]); - - projectile.velocity.Normalize(); - projectile.velocity *= amplitude * oscillation; + projectile.velocity.Normalize(); + projectile.velocity *= amplitude * oscillation; + } } public override Color? GetAlpha(Color lightColor) From ebf31c7781d9d52d7436faa64f33d3814e9f2cd1 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Tue, 28 Apr 2020 09:35:07 -0400 Subject: [PATCH 021/137] Changed Valkyrie Ray recipe --- Items/Weapons/Magic/ValkyrieRay.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 3a74bfd60f..9cf46d8acb 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -118,9 +118,11 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HallowedBar, 12); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ItemID.Ruby); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofFright); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); From fbfefba6398a11da55e93cd71b0139f11636b7cc Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Tue, 28 Apr 2020 18:22:19 +0100 Subject: [PATCH 022/137] Why git needed this splitting i'll never know --- Projectiles/Magic/ValkyrieRaybeam.png | Bin 526 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Projectiles/Magic/ValkyrieRaybeam.png diff --git a/Projectiles/Magic/ValkyrieRaybeam.png b/Projectiles/Magic/ValkyrieRaybeam.png deleted file mode 100644 index 4bcb09bbf2c79b9a78f509ae232c0a8a5706bcdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 526 zcmV+p0`dKcP)Px#1ZP1_K>z@;j|==^1poj55>QN3MF0Q*(9qD>*x2IY;_&eB`1tt1S?)Xl00Ejw zL_t(&L+zO{Z-X!pg-IvGz`%eQ85#Nizk-pG5iu|@AhuR_%8S%fPiJUqo64VLog5sW zAJ5pqd1Q_Z!|+Kl&vULH$HB4hd#64=p7GByM*}5QRdKy6OOD&Naa`AxqopjoB29_( z$W@s)MQS1%ITcbu1$AIumxS|3dQ;amM~h`yIBH&n_Xzji6{~%CMeinjB6{Mf&lpl-rio*`t2eM_lXV?IwGu6O#d8R7+^QP$KQBf590nT$!KYOMszmK|q zj{uE?isg;OYVXgZXMD}~v))LgS9m`Cdt{xRo<;WO-y;C8nx^5pcJe5}=;wLnDA!K^ z9s%52?5y%$OI+KB^9X4F@k#J|BAW9$RS}TNB$g5ok0JnN5=#m2q$tb20Jho;&0V$G QTmS$707*qoM6N<$f>n6 Date: Tue, 28 Apr 2020 18:22:45 +0100 Subject: [PATCH 023/137] last commit x2 --- Projectiles/Magic/ValkyrieRayBeam.png | Bin 0 -> 526 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Projectiles/Magic/ValkyrieRayBeam.png diff --git a/Projectiles/Magic/ValkyrieRayBeam.png b/Projectiles/Magic/ValkyrieRayBeam.png new file mode 100644 index 0000000000000000000000000000000000000000..4bcb09bbf2c79b9a78f509ae232c0a8a5706bcdd GIT binary patch literal 526 zcmV+p0`dKcP)Px#1ZP1_K>z@;j|==^1poj55>QN3MF0Q*(9qD>*x2IY;_&eB`1tt1S?)Xl00Ejw zL_t(&L+zO{Z-X!pg-IvGz`%eQ85#Nizk-pG5iu|@AhuR_%8S%fPiJUqo64VLog5sW zAJ5pqd1Q_Z!|+Kl&vULH$HB4hd#64=p7GByM*}5QRdKy6OOD&Naa`AxqopjoB29_( z$W@s)MQS1%ITcbu1$AIumxS|3dQ;amM~h`yIBH&n_Xzji6{~%CMeinjB6{Mf&lpl-rio*`t2eM_lXV?IwGu6O#d8R7+^QP$KQBf590nT$!KYOMszmK|q zj{uE?isg;OYVXgZXMD}~v))LgS9m`Cdt{xRo<;WO-y;C8nx^5pcJe5}=;wLnDA!K^ z9s%52?5y%$OI+KB^9X4F@k#J|BAW9$RS}TNB$g5ok0JnN5=#m2q$tb20Jho;&0V$G QTmS$707*qoM6N<$f>n6 Date: Tue, 28 Apr 2020 16:06:30 -0500 Subject: [PATCH 024/137] Various fountains --- CalPlayer/CalamityPlayer.cs | 6 -- .../Furniture/Fountains/AbyssFountainItem.cs | 30 +++++++ .../Furniture/Fountains/AbyssFountainItem.png | Bin 0 -> 777 bytes .../Furniture/Fountains/AstralFountainItem.cs | 30 +++++++ .../Fountains/AstralFountainItem.png | Bin 0 -> 548 bytes .../Fountains/SulphurousFountainItem.cs | 30 +++++++ .../Fountains/SulphurousFountainItem.png | Bin 0 -> 321 bytes NPCs/CalamityGlobalNPC.cs | 3 + Tiles/CalamityGlobalTile.cs | 3 + .../Furniture/Fountains/AbyssFountainTile.cs | 82 +++++++++++++++++ .../Furniture/Fountains/AbyssFountainTile.png | Bin 0 -> 3268 bytes .../Fountains/AbyssFountainTile_Highlight.png | Bin 0 -> 2050 bytes .../Furniture/Fountains/AstralFountainTile.cs | 83 ++++++++++++++++++ .../Fountains/AstralFountainTile.png | Bin 0 -> 2627 bytes .../AstralFountainTile_Highlight.png | Bin 0 -> 2017 bytes .../Fountains/SulphurousFountainTile.cs | 82 +++++++++++++++++ .../Fountains/SulphurousFountainTile.png | Bin 0 -> 3585 bytes .../SulphurousFountainTile_Highlight.png | Bin 0 -> 1802 bytes .../Fountains/SunkenSeaFountainTile.cs | 21 ++--- Waters/AbyssWater.cs | 2 +- Waters/AstralWater.cs | 2 +- Waters/SulphuricWater.cs | 2 +- Waters/SunkenSeaWater.cs | 2 +- 23 files changed, 355 insertions(+), 23 deletions(-) create mode 100644 Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs create mode 100644 Items/Placeables/Furniture/Fountains/AbyssFountainItem.png create mode 100644 Items/Placeables/Furniture/Fountains/AstralFountainItem.cs create mode 100644 Items/Placeables/Furniture/Fountains/AstralFountainItem.png create mode 100644 Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs create mode 100644 Items/Placeables/Furniture/Fountains/SulphurousFountainItem.png create mode 100644 Tiles/Furniture/Fountains/AbyssFountainTile.cs create mode 100644 Tiles/Furniture/Fountains/AbyssFountainTile.png create mode 100644 Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png create mode 100644 Tiles/Furniture/Fountains/AstralFountainTile.cs create mode 100644 Tiles/Furniture/Fountains/AstralFountainTile.png create mode 100644 Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png create mode 100644 Tiles/Furniture/Fountains/SulphurousFountainTile.cs create mode 100644 Tiles/Furniture/Fountains/SulphurousFountainTile.png create mode 100644 Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2abf4401af..4d9aeaa1d2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -840,10 +840,6 @@ namespace CalamityMod.CalPlayer public bool tundraFlameBlossom = false; #endregion - #region Fountains - public int fountain = 0; - #endregion - #region Biome public bool ZoneCalamity = false; public bool ZoneAstral = false; @@ -1255,8 +1251,6 @@ namespace CalamityMod.CalPlayer externalColdImmunity = externalHeatImmunity = false; alcoholPoisonLevel = 0; - fountain = 0; - thirdSage = false; if (player.immuneTime <= 0) thirdSageH = false; diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs new file mode 100644 index 0000000000..c20189457b --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class AbyssFountainItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Fountain"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 42; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 0; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.png b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.png new file mode 100644 index 0000000000000000000000000000000000000000..2b82813299bf160d29e7b2a5a85ff52b37d703c2 GIT binary patch literal 777 zcmV+k1NQuhP)>5Gh}vj0tt^5>VPUPH2r}r@!K9#Tmu?+rEC9Q9dcps~XD*nG>w^IR3c0+-{Mh-Jwr^@|+y>ZF-(UgYxq_fS z1VCND55Q`E#Re$k^1yb+zrM`_(0U{SKx1l%E911y1*Hs;ujE06s065s)1Gw2Gh@HL)xG@PwLRG4Rmcz}K!$^yPS-EB`f(=0n zU?!`tdzVF9Oq`xnQ>(h_pLNw$%bmR_si{>HZDDCvyY9V${@7&zKL1e6iar&lY-aAC zN>&Sb3t+9V40t$`w-gBT&gfA9QpvA2xZSc`{}&|^i`K>_3!tmL1E@wF2=n_-Zv$>6 z50Adm_L7i?%9RDpvAc z@_cG+Tw522^OJp|NGe%S`AWWcrWb(3rJiw-<`2Dr+Ow|V4?te`(s zvQi~mOo)=#FCPQj=Y{kj`P%eOK{*F!p1pZp7?*S56<6>VZ5|+KVJvr300000NkvXX Hu0mjfU@C8R literal 0 HcmV?d00001 diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs new file mode 100644 index 0000000000..bad8e6b893 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class AstralFountainItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Fountain"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 42; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 0; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.png b/Items/Placeables/Furniture/Fountains/AstralFountainItem.png new file mode 100644 index 0000000000000000000000000000000000000000..b206cf12fb7f550e92b40eaa2c686b6aad5d9f46 GIT binary patch literal 548 zcmV+<0^9wGP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0l7&;K~z{r&6Yb$ z15pr#6B~=@njl6aN@Af_K0pPr6%kTe1uewRpI|Be06SajRF;-0MNkVLjSnzEiJ(Yu z@ljYrJe#k`U_iuV@7J76v0={KnYlMwtyUxdf!ERh;~%xvv}yd=!C>!1-G?u4PtvYf zkCfPb2MI5s7%F~6>Yjr}T|&*%18J%6`_kgWmDD{4nbe44@H|gix-Utoz5iN{eye+3 zgp={nX~onWC+?mB*lrr0&DMSee3ovc?m7UR*xdu}b`jXKnA*!rPnL30aJP%>4*EzW zrS5f+y}8I3Z06vegS+iX#f9B>>FPz0q3wU$P2oAP-NN0=)};1ueYjuy6%hU;i2lgzu!E!@^)AhchG_!XgZM_4V@#*5QbfFxV!sGdo)SZ_dU1Q%p zXPdR%v$7^B%@t`OOY4oq=TL4);aj?tJ&^*`(5~RVD~>6CC6r@z$B9?;3&K~AOkW7GHrBLb`GdScwIyd mfsDYOiG3GQfhIeMM7{t`fD$)Qhi^In0000(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.png b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.png new file mode 100644 index 0000000000000000000000000000000000000000..138609c23949615fee8b6af693ea7f6dc1e3a0b0 GIT binary patch literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^VnD3L!3-oDE=Au5QpN#3A+A8$(jd6E(pO1V;q1=d z6_Y{=qukAQ)}%W+ME&1vb7#_z|GA88{6@1feXOj3ivR!rAHa5I8jvMe666;Q;-dfo zQHO;<$u*uXjv*Qor%t@h)oQ@Qa(1cfhA02+zgxIDKG|}uR-;60QqCrwu9+uz%vOi0G#MGsc%bxp-E6}HtKLZ%OC;aU_}yo`=l8C2 z36FLdryR*;jGe=t<}mS^+l`(JEKKfu9)@VH+Pdl9;TI2d4lAy6Qoa+l?MTwb=N-&3 z+8s&~wRg&%7E1C}_i&yuXPUgdKl7wlG2`|Z|3C0^ck%j4GUY!6x|_k%)z4*}Q$iB} DMWu;f literal 0 HcmV?d00001 diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6f7de6cd9b..49e257c2e8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5605,6 +5605,9 @@ namespace CalamityMod.NPCs if (type == NPCID.WitchDoctor) { SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); SetShopItem(ref shop, ref nextSlot, ItemID.Abeemination, CalamityMod.CalamityConfig.SellBossSummons, price: Item.buyPrice(0, 8)); SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), NPC.downedPlantBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.SolarTablet, NPC.downedGolemBoss, Item.buyPrice(0, 25)); diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 2e164cbcd1..b92fa96ba2 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -10,6 +10,8 @@ using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +20,7 @@ namespace CalamityMod.Tiles { public class CalamityGlobalTile : GlobalTile { + public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); public static ushort[] PlantTypes = new ushort[] { TileID.Plants, diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs new file mode 100644 index 0000000000..7b9e479ea7 --- /dev/null +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class AbyssFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Fountain"); + AddMapEntry(new Color(71, 93, 107), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AbyssWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AbyssWater").Type; + } + } + } + + public override bool HasSmartInteract() + { + return 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(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 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 AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool NewRightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = ModContent.ItemType(); + } + } +} \ No newline at end of file diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.png b/Tiles/Furniture/Fountains/AbyssFountainTile.png new file mode 100644 index 0000000000000000000000000000000000000000..68927bab257573bafc111d636657a0f2191435c7 GIT binary patch literal 3268 zcmZ`+d00~E8b4%7tK?)lmg3l^Wm#$FhFEDbrn!{nzNDqOBqa%$OHST06E(FoH_Xf} zT(Z<$0AosAQFF}&Awh9NaL@gM-R9{&GxHZb?>XOjzu)ryzH`FOOb|P^?%4_ezz)OT z^)Cs24FCZ2+h$S0zb!MHFaWSU!chOL1vZ77+JLn0kgd^GR}HRWeFHPM6mU$6ogo2$fw=IG#UROAOeEHytr_!@c5wD3`%JdIj+an`7kXk$=?hJ3cP;89rmD7<4SZ*>p&H+k!Bhf&abF-BaikyRe zdJ_8b0_4uIw$695A&H+SWzM)eAvc~_=pK}jc>jczn&2qW>BGM-(0#J!)&?q<5ON3s@e_l@sAlbM8rLPju|!ZFun6+0*+#PGR@35dD4CLx!II zne6GyuKVZo$Perr%De(*=Pk2rg`2=4G7IQvgXEqb&<$^ocOoj&z|rQWp6P|I+3{kv zhI4M95bsV~U8|0@1z;q7dtMFiUstw zd>IV}n9C#gKyNZoh>dRwD;2=}q1-q?rhE+aqGf4~jX1ql#);7bwy&`CfYomUN)!7F zwY6^Efz|&C>4#@kbrp<|N!lPRkCZMWaTkR+QYiz%nOd)~(iQL`Od4Z#AG)s>xkA1M zR4tDbx)yy~d|pCD(O?G^q1SO?FX7aDo2Z#?wYshdvhD zbtiNC+-%`t{Ix8LJ<%#uy=qk_r)}yb-GMG1!SZu~DxvtmMd=qOv@{myCmsU^O%H;+ z%sgNs7&=6v)8ZLbpn}=jcco_yYcZZZY@sYf^fm~m9hYitRC4Fed9$1X46hq}Cdiejm6n3=j<^Ka+i)RWkaA^~YFsJk;Ir3+PK4#B0y{ASU|Mx9|Bqzx=4KNs31N?JoF@9) zNx&eBYi!!sqvr3?e#G{<`zMLC?6*zx8t` z_j8m70rK=WbpU(Xd~$JYuO2|09MT01m#;*Pkr|}-Vzy2#ZC5*%mrZitaTtY)%oc3@ z*9hTI4*25;k%#1}0v5NM5#QBWJ*&zxNEWFzjz;VxD-^b30|{fk!a3O36&PnZtE3uH z#JUTH^h|$*h}>c-X}i{F7kE(AxN(zIRW-XQth#48J#}y$LuqWX`m5fXx?H6~5;WPc z!qN*dHn*8Mo{iEBp=2OHwI-hsiEa1p?NywJ=!0rVMHEKop2AZJM&ci;o2f2UrV~4l zO9|ODmt#>U=ap%oH@^Ly5?m6-_E<^vmCOPcbnkwKh%NU z6>Tl|hJQQQFQt^8m|L-E4U^ST78#HV?WK<-gA@b=|E^#~@ZrWZm<$1BsslcgX+lb83{D7YLQj%9hTLO2UhNg85 zZo5X~q66LP`*oAoQmPMoO%4UNZ4dIyc&?7e(M;nLyy--u25)ua5|TWcR`5>tir)^& zGpOupdJlc~y2BP*bim`;>CwJs!z-6N0prMS%x8y{({T$b!E@(VpmB)>Lhg z=+vmw!Lku)G-2Fd^&3jIzggk`M`c3G%2Jcu>MzzS)1NqKe$ZXf%q5xADVnQ0dde;zupSi7yp)Ny_mGx1IbNmE+z|J`MlxPCCaa`NZ; zy?FC+I7yr2QsxM=G2%8cNM8vQ_}T!&rCEV@K2XaZxa2^}H=yHB zao~!1u|_Pxupw1P{KB1N-yYlx=!Ym_Pr|Cty=3@dTR^2R@E_9l)1q zg6@MjMhY4`&WC8`RbZ;^OrXR)!gF5(n%T%Le(N1nTUty9b75H5k8&Ci$Biv0euJjs zGQ+oE`zO<$uK;*9HkPs+Zvo_Q!!&@4H zUpmwx59yb@-hk!9Wfp67lx3q~SUZs)du-+$c7^>Dr3wNu1xR4RWczX5!yWr?#Q%#P zKgxJv3=@MIZAmCYHidAKIP~ej6m!cNAxY2<2M3;O=l_HRmags)g1<8VAH491Q;K}OG;wZq5k|*QGplU-@7q;dj!j-^zQkA!5?nAzV`pc5qA8J z^vAQmU)TQl@h1rdcm0#He=onDpacwub3$CcyRFL;{pvV!Y3oc=d8Mh$6tm-3%Dny| z!@C@rIxi=I{sJh1b~zQ`<^|VSxRXEMbE7}MxK|#>ygR05835R7jXQoU&kcXB8aOjU zC}K&fw24dbUf3QV9GIlJ)(cI z-*(h4um0ZcgWwa`8AYHw{F~x_fkAhUQ&17D;W2TVA#_Y2t#5lT@^Q%%!I)goD!29X zf~0|w9hsW9*tq?j?%qb-nhrL_#trt; zQ2<(wxHm-cX2RW8?XGSQLU&fJEw&>RGa_-zLE!UEkp9xA+vsq2bnArHZ75Ok@xGA$ zWTf3?VK`Bs#PL>3fU5ij<}6s!L`0<$1arkpfnn7*|K+jf%T(+?sbwmB#1zwCkk^~d ccdvqNV&cV5Qr46NUnhX!c@zDDbI$kw3;U~o#{d8T literal 0 HcmV?d00001 diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png b/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..1d1e01fe1a0e07df5e61fbf689cdcfc58e9c1844 GIT binary patch literal 2050 zcmeAS@N?(olHy`uVBq!ia0vp^ZVU{J3LMNpmYvpDS0Ke$9OUlAu&n@m4*1Hk ztvq}{?KEq(oaK}A=a1e0-y?kJRY=;OsT-|KC8O_ni#hqZs>O8}-v~^9#9pz{Z^z=Z zZ(h$m^YY}G&u4xPkW*5`mr1ic&GgIBUvCr(YSZvyU-{<${%7m&3^W2_4_x+hC zm-bp)?($Llsa9@f^x3AoL{ja{?8%oWe!P3~VyeiM)DQCSP7E}3yjx+s zy9F5f&A(&jcM5e$+*oSro(xPiI=JEQ o&7Xhw%O5KnNzv4(^7->;{?jV$KE{q(CZHnP)78&qol`;+0G!A0M*si- literal 0 HcmV?d00001 diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs new file mode 100644 index 0000000000..1b683385ca --- /dev/null +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -0,0 +1,83 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class AstralFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Fountain"); + AddMapEntry(new Color(59, 50, 77), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AstralWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AstralWater").Type; + } + } + } + + public override bool HasSmartInteract() + { + return true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType()); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType()); + return false; + } + + 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 >= 6) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool NewRightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = ModContent.ItemType(); + } + } +} \ No newline at end of file diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.png b/Tiles/Furniture/Fountains/AstralFountainTile.png new file mode 100644 index 0000000000000000000000000000000000000000..126498ac4dffdf97aba682a26641f3cada55e546 GIT binary patch literal 2627 zcmeHI{WsHl9RJEgiIwQowiLM;6>2sml045g(xyxD&_--S+U2Vd1Ft;jsgaF@(O zd5DO)71J0~b2IXED-Y`y#Zg(IIPTZI=iGCg5}g`x{=TF4bO3Q#5LleZZNG7EdAS8l z{%T(l_%9()Fj$TN-w6;y@FXt(zYQSHtu_W{t9b@sxZ-!+Jh9&LYd+eB1mt25`lr039Sy=+zN&s+SW8VPTq9#s+FSuE!2du z255`)xvq8j;plJFV%s{I}j7@E55 zBd)lJi?^X8gI}jgvJWW+DDG5hZMhoFe-d?o_wW?dB6q=RL|zYV3~ioXCG>A@8MqD> zP9R&8+m%a;i%YnwekH6-LplfD{tAU-8x$FBx|FgQGf8ja*kF=gde+MHBl# z;pt!{hP?KUqH>6w0C)4}i4!@O+<vH>Wp>){YF{*O3t00X$Q~!Qa{AB+fC?aTmf#ynbl*8%=?>nVkF{ zt^Etfhk3J}s}Bi^Zy%5esg!IhPEou)3|_b~WpVQJ6Y%(HndZzC?TYc&?7}QBpDXt1w1&`x$z~|?JFz+VYJ`PgT~oF(r|78Ib9vD)hjBvOz0y28 zja9B0;a={6X@5a6Mbh=nFfd<1`wJ@cCzD&+$EZjc{EkiB7ijS)sOhq^v|2KRi>?S5rrw z@7mpbTH@hUQJJSL`z(DtA+UZC0I{w6OG8fd(qhbrs0Ch}&Wff;s*p=gb{w!4MH`k0 zZR}PUN2Y+y{{TwFbp@e;N00u*_L+_Pu;f@*M+)nG)EEFnp{F9?%)AG{xp~?rMvW)lylF^t2aLI37z#>e$3g!*tk~8c1LAbCy>Wx ze$?ez3tP8Rv0Jmt#Fv+ACj0f?FZvfW@#PhsjG8a!D}a*PD)THCPE44Z{>$X^#%Hrm zd@v2Nm7f(ZaCzazgR1KkpOu~UyD=+gccG}U{aMSi^E%d^{KueDCu$ty8|Uq|IcbIz zPfy<2JF9QyxmshWl*Km7w*`aGGw|iI5_?dYw^P5YK?>BaZkE>@q%=#2% zG)wgGm4t+n>}PRj>msCX>fGC4W_tK?g2SRNpyPAc0(3_6Ir~F^{$!St|7#44l7n2G>3$h1 z5l?5@ovm53Q_ZNRH{^W#Gtna@894==*&RD$Hw$l5yPX$v^o)P8-)8ls>`nFzo$*I` z!Y5y!ba9QuGB)PL(Z=7iz8$`FBJE?_)|KF(4-Mh*Pd4tzdc)STeBx=Y%j=RVX7SHT zHOX#Uez3vic2{ENwFa)NXMVlDvtM36!M~tRHr2{B%B$D3P2%$EjSpp2X3g~LZJ&^q z_RFNI;IoJ@kjI@KSIqTU4_l|w<>f!s=1T2<`e!N7pOP1TyqFJ+65cQmn_?&B zgIedmWIjtiYdY~^_L3?)ll2PAoRgcqW1P>toi%rZ>CLjoT4{B&if7phMo<3B=a!tj55)~muoKQ zERHm`;bl{~6~^PenJpy1xI8Q87LV)as=v$|7*FgyH_2oXs08+O^>bP0l+XkKFs8f$ literal 0 HcmV?d00001 diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs new file mode 100644 index 0000000000..c849322ad6 --- /dev/null +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class SulphurousFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sulphuric Fountain"); + AddMapEntry(new Color(104, 195, 255), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "SulphuricWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SulphuricWater").Type; + } + } + } + + public override bool HasSmartInteract() + { + return 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(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 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 AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool NewRightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = ModContent.ItemType(); + } + } +} \ No newline at end of file diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.png b/Tiles/Furniture/Fountains/SulphurousFountainTile.png new file mode 100644 index 0000000000000000000000000000000000000000..9dfcecd6e67659a9b8c9df043d35e419148b6335 GIT binary patch literal 3585 zcma)9XH*m079NZk0VP+YC@8_FfKm)y3?vsU6cHkzaOtQ-nn)9gmu{{ih#*2J(v&7D zkSo0j2^~V0UP3SsKo9~^LL|bQcwKL;x7Pdde$C98Gw1BHzq0p4T`@D?*zW`2ZH16#uxOj;?lol*xk0b7JJk{pJ>i(_7!P+q-+&JPg z*_N&yq{hemnve!*Lws`-sEccv%N$NZh0NSWuVIh&l4wH@nr}w?KKoWMI54n_M8}|@ zq;+gRQ#OKoJ-;6p%Ki8|p9({^F?m)r?o_M(xRWodXac}hVPye$0GqGxijx4zGZKA? zQ~iF)k0?SKelP&_q3xE--AfXf6ni?Dkaq1jo9cW)BPxZmvwajW$mBo)l>F=_UTS!k56Sup zwk7x_Gu201`dVxI!u_bWRXeRB+nI*m)4YA8L~|NuvpqV5z8e}?hWZ42L;|OSi%p8R z(#j?y5?mu1ziFnnmgX|TfPJ#Fo_iwaaI58ZT-==w1@LQ#EBxc{YA?cFvR)O4^kg9+ zdOxsl!U~Z)_Ou#xJExO>JWFkcWT!+69xi%5Vmv=UZ8-66RlP;KY6kr=NHWao`{>5R zu6aA1TT`iuBoZqbH&B+{1<@YTj8Bn#ogLy_ zgS)IMTvFWTrdgkdJp)9-j_}bSJ9Qf%v+II4kKV?GFuk zBQBC4{N%gQYXG`5Pdc2fBkSbuZUZ4rKpC9m4pxRqtv4I+n8e%ld0oQ2T+rH zNlc@_;`g^id%4k`z~Ht0LBK(}U+~>?pHdDbuf|zn;NY4Oma3-j<^-l2CJ^#K{U*~E z_{=!d!5^9xy4H0T_Hw3b(3raOB{|&18a_6`M-pqmmOZZsC8YOiWOZm{MhJ=YelBq7 ze6jY~-oxcGL8Nf`A&(6{3XDNc1Sz3Dr|3Lz`|H8p^O3@QDjFiG8$xC5-oOfn0^HTJ zDj_^#9(JuC;Rfs587#(_gv_RgA>y)XcI#cUgs22;*!^L@mcAC3wN5wgA)H_h1MlJ)+x9IPf}s)T+TXw9ld`8e1USOdbq>6J+-?S{?%A|QRc zdn|D}%}WH3*)H&Pw7o_niSYb`?A z(t6X+M4yl@6%GebD{J;G~ zLDs*%QHE_~-!siAYes}2@GW?l(V0AdiIDt4qI?ZrF-`PZPvgaa!~96gwcG-JNd6)D zHwLnR)u6|!GG-%bgn~?rsN$}#mCz7VWfm)6)DDXt+Nh27m&mi7F1>RKc)vAE&8!T; z+dCq?TEG)eDW$m7SmTz#i+L}$9Y^wZlSbg9l2y!M2Fjzf*RNi|qW=+W|D;Yv^FAMm*v|_|b)DvJI zj_xsMS`Hb6iK8ZXg$E3M){MRT#QeU~jSaz|^}?K&Ys!4Ir+tR5mMb)b8fQR#kY!;( z6+H5#TAukpyBluwzxt~eo?l)!tL_VyrQ@ER_8A$%$C<; zhL`tqYVCCpoeS}gDQndtpoysLyD8q@GNg1odch;<0K>yd#?M!i(jHj+xXXyAaRz># zBuXa*Gmn75rNA;FAb(k8f9GglXEaV2OhXs6Hv%kgR5VVBl_jtx)!PLnHg}9ciQ9oC zj)AkV9ln?IK0Z^092()|*)7^)y@z))PH`Vx90p~P6@C3S$d;d>Scf|a99oE)3S8Ha zw<|xJoVEvi%`doum!MjEp>eVX3*)!@MBjB-EU+(qGUBoI;E1LrWr z`2Lxx(CWJREi$J(*5JE_{tss2sE&l%Q`H>YMq&I&Y|lFB{>U=2&ij9i!5^O zclS4GiK`+zwX#lo|1>kD_t^G<5g{GPqWoGt^xas!QH;FFIs z@DgCXN&u6n4zF7V^9n{J3 zaHYS`v26|IEq;R3MOTH_Wk0KgIgT}DiMVEspf4}N)v=NF;PhP#yek?vX6^&8W7d0s z5UUD;N89Sug2}vhT3H)cO{IK&0dsUWSAo~HQw&7_-|61Uo*kVZzjGzPbIRg5v{abm zJy9yud&gX+nm8WJycBboMb=qVgzjw4z24yOc?Xl;>dEIivdC#U+78``KJWwg4g^(B zvjC)>qUFj-O9b>A_3DjP`)AzwJH|2t)i1D;7{k|xTJNSSVf6e&1$&FjiTxp$o=99k zh1VZDC7$+EDRCSc)~G*(x!w}Yyp;-)fg%p>a9p$-O58EC5fH0&TKQ72v#g_~;9qoC zxQ~H9V|X$XMs>=&J-BI(kfl{$v{>A&zR$<{$9+}!z=H8l)~=&*uRx&P{{#OoF8tIOi1}l%qXDH2 z@&L4f6`r7PU-kPhUH^g_TmbsN%>Z8)!hHLJdvtjFQQ$8;RPPkL*> z>oNmO_#RKmvp4F#NX>rt-~@plkZ?s8UN;hAxFFwrz?PuKy;RGgOo9D^~jayWjSAy2qP2C(o!Wm90uY)|EP;SnsgYiHqrF7t&qYC#75~ zlsR;6vQZ(2^{t-&7x$jrY*cqlru3M%U9)U%ns}+2y~ykg<2ZwBn#K2g>LV|tFUrn~ zS$^kY+8aqj^E)f&I9@V6ER&ihp9@r2K1EVRBKi2-S&}ttrM8`wja{~%Icixw!>Tl+ zmAS^xt!HjLEfec@aQ49~=eO)vFS|OSSj~8T$BmWqB(`}grsI4;S+7Zv z$AJ#=KXpX$O@{G5_wQ=wPyLWAz9Omrlc#LU%-Ab4{{-YLI$LotV)>a$mvN!EO}VEfDe=G_Q&J~#7BjZ)I`sN;Evv zWREMpvC$N6->~@X5Ba;ZZL}Y!p9xIg^ThbZ#k8`(^iR$kJIx-mCeJl`e)h|B)>^e) z&yJOzlFdCfPq6s#+*6V&vBqZt)4p9y`{Z2cKGU(uuGZ#}u_DK5t_4!?$6wYgzZuGgcWA3Y&8#qQHzzHgZJ uQodo;OrNaVXMXyny)km19;k4##;*SSgr(9GijKvCiYiZ6KbLh*2~7Y style.Name == "SunkenSeaWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SunkenSeaWater").Type; + } + } } public override bool HasSmartInteract() diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index d20ca43865..76bc725e05 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneAbyss && modPlayer.fountain == 0) || modPlayer.fountain == 2; + return modPlayer.ZoneAbyss; } public override int ChooseWaterfallStyle() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index ab7c1b88bc..82d110d09d 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneAstral && modPlayer.fountain == 0) || modPlayer.fountain == 4; + return modPlayer.ZoneAstral; } public override int ChooseWaterfallStyle() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 144eebd262..61d90d8335 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); bool greenWater = (inXZone && inYZone) || modPlayer.ZoneSulphur; - return (greenWater && modPlayer.fountain == 0) || modPlayer.fountain == 3; + return greenWater; } public override int ChooseWaterfallStyle() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 4bb6903bf0..e8cb9e7ff5 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneSunkenSea && modPlayer.fountain == 0) || modPlayer.fountain == 1; + return modPlayer.ZoneSunkenSea; } public override int ChooseWaterfallStyle() From 4df022e1d2181ca805a13ffbd8d95bcd74374660 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:17:08 -0400 Subject: [PATCH 025/137] renamed some fountains for vanilla consistency purposes --- .../Furniture/Fountains/AbyssFountainItem.cs | 2 +- .../Furniture/Fountains/AstralFountainItem.cs | 2 +- .../Furniture/Fountains/SulphurousFountainItem.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 13 +++++++------ Tiles/Furniture/Fountains/AbyssFountainTile.cs | 2 +- Tiles/Furniture/Fountains/AstralFountainTile.cs | 2 +- Tiles/Furniture/Fountains/SulphurousFountainTile.cs | 2 +- Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs index c20189457b..f1f018affe 100644 --- a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains { public override void SetStaticDefaults() { - DisplayName.SetDefault("Abyss Fountain"); + DisplayName.SetDefault("Abyss Water Fountain"); } public override void SetDefaults() diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs index bad8e6b893..7891da5667 100644 --- a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains { public override void SetStaticDefaults() { - DisplayName.SetDefault("Astral Fountain"); + DisplayName.SetDefault("Astral Water Fountain"); } public override void SetDefaults() diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs index 0e39da0063..78316ac7b4 100644 --- a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains { public override void SetStaticDefaults() { - DisplayName.SetDefault("Sulphuric Fountain"); + DisplayName.SetDefault("Sulphuric Water Fountain"); } public override void SetDefaults() diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index fa6bc322ff..c703b8ec88 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.value = Item.buyPrice(10, 0, 0, 0); npc.LifeMaxNERB(5000000, 5500000, 2100000); double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -232,6 +232,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive); Vector2 vectorCenter = npc.Center; // Get a target @@ -449,7 +450,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) + if (bulletHellCounter > (enraged ? 4 : 6)) { bulletHellCounter = 0; int damage = expertMode ? 200 : 250; //800 500 @@ -548,7 +549,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 7 : 9)) + if (bulletHellCounter > (enraged ? 7 : 9)) { bulletHellCounter = 0; if (bulletHellCounter2 < 1200) //blasts from below @@ -612,7 +613,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 1f, 0f); } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) + if (bulletHellCounter > (enraged ? 9 : 11)) { bulletHellCounter = 0; if (bulletHellCounter2 < 2100) //blasts from above @@ -686,7 +687,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas passedVar += 1f; } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : 12)) + if (bulletHellCounter > (enraged ? 10 : 12)) { bulletHellCounter = 0; if (bulletHellCounter2 < 3000) //blasts from below @@ -759,7 +760,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; - if (bulletHellCounter > ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 12 : 14)) + if (bulletHellCounter > (enraged ? 12 : 14)) { bulletHellCounter = 0; if (bulletHellCounter2 < 3900) //blasts from above diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index 7b9e479ea7..b2349ad313 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { this.SetUpFountain(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyss Fountain"); + name.SetDefault("Abyss Water Fountain"); AddMapEntry(new Color(71, 93, 107), name); animationFrameHeight = 72; } diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs index 1b683385ca..a3745c8a22 100644 --- a/Tiles/Furniture/Fountains/AstralFountainTile.cs +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { this.SetUpFountain(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Fountain"); + name.SetDefault("Astral Water Fountain"); AddMapEntry(new Color(59, 50, 77), name); animationFrameHeight = 72; } diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index c849322ad6..ad393f4ca1 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { this.SetUpFountain(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sulphuric Fountain"); + name.SetDefault("Sulphuric Water Fountain"); AddMapEntry(new Color(104, 195, 255), name); animationFrameHeight = 72; } diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 320c833be8..0f10a9c4db 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains { this.SetUpFountain(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sunken Sea Fountain"); + name.SetDefault("Sunken Water Fountain"); AddMapEntry(new Color(104, 195, 255), name); animationFrameHeight = 72; } From 5017666a2f131e0e9549515da5c72af854fd56a5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:47:13 -0400 Subject: [PATCH 026/137] fargo fountain support, moved 3 guns post golem clock gatlignum now uses life alloy instead of hallowed bars lead wizard now drops from Golem instead of Armored Diggers Barracuda Gun now requires a life alloy --- CalPlayer/CalamityPlayer.cs | 20 ++++++++++++++++++++ Items/CalamityGlobalItem.cs | 23 +++++++++++++++++++++++ Items/Weapons/Ranged/BarracudaGun.cs | 1 + Items/Weapons/Ranged/ClockGatlignum.cs | 3 ++- NPCs/CalamityGlobalNPCLoot.cs | 1 + NPCs/NormalNPCs/ArmoredDiggerHead.cs | 1 - 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 14b82c958e..24d584e853 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -35,6 +35,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.Environment; +using CalamityMod.Tiles; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -42,6 +43,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.IO; +using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.GameInput; @@ -2274,6 +2276,24 @@ namespace CalamityMod.CalPlayer (double)point.Y > (Main.rockLayer + y * 0.26); ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + + Mod fargos = ModLoader.GetMod("Fargowiltas"); + if (fargos != null) + { + //Fargo's fountain effects + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SunkenSeaWater").Type) + { + ZoneSunkenSea = true; + } + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SulphuricWater").Type) + { + ZoneSulphur = true; + } + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AstralWater").Type) + { + ZoneAstral = true; + } + } } public override bool CustomBiomesMatch(Player other) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index d9b4b6f305..048b6dd902 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Magic; @@ -2497,6 +2498,27 @@ Provides heat and cold protection in Death Mode"; } } } + + Mod fargos = ModLoader.GetMod("Fargowiltas"); + if (fargos != null) + { + //Fargo's fountain effects + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Sunken Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Sulphurous Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Astral upon activation"); + tooltips.Add(line); + } + } } #endregion @@ -2616,6 +2638,7 @@ Provides heat and cold protection in Death Mode"; float aegisChance = DropHelper.LegendaryDropRateFloat; DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, aegisChance); DropHelper.DropItem(player, ModContent.ItemType(), 8, 13); + DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); break; // Duke Fishron diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 3d2a370d39..057bd01801 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -58,6 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.PiranhaGun); recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.SharkFin, 2); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 609b3ee952..92693f929d 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -60,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Gatligator); recipe.AddIngredient(ItemID.VenusMagnum); - recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ItemID.Ectoplasm, 5); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 58127d890d..55666aee33 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -272,6 +272,7 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Golem) { DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 10); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.RareVariantDropRateFloat); DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !NPC.downedGolemBoss); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedGolemBoss); DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index e2764b7929..f429aa09a3 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -423,7 +423,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); DropHelper.DropItem(npc, ModContent.ItemType(), 2, 4); } From 5e4db5930b0bdd1cf959a6c01e38de585e2ec63c Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:47:36 -0400 Subject: [PATCH 027/137] removed an unneeded using directive --- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index f429aa09a3..fbd2da14f3 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; using System; From 80ebcddb202f2c9920ef662e0cadd5029499a311 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 18:23:51 -0400 Subject: [PATCH 028/137] weapon balancing :flushed: --- CalamityMod.cs | 13 +++++++------ Items/CalamityGlobalItem.cs | 4 ++-- Items/Weapons/Magic/ApoctosisArray.cs | 10 ++++++---- Items/Weapons/Magic/Effervescence.cs | 4 ++-- Items/Weapons/Magic/PrimordialEarth.cs | 2 +- Items/Weapons/Magic/ShiftingSands.cs | 1 + Items/Weapons/Magic/TearsofHeaven.cs | 2 +- Items/Weapons/Magic/TerraRay.cs | 6 +++--- Items/Weapons/Magic/Wingman.cs | 4 ++-- Items/Weapons/Ranged/BladedgeGreatbow.cs | 2 +- Items/Weapons/Ranged/CosmicBolter.cs | 6 +++--- Items/Weapons/Ranged/TerraFlameburster.cs | 2 +- Items/Weapons/Summon/SandSharknadoStaff.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 4 ++-- Projectiles/Magic/ShiftingSandsProj.cs | 7 ++----- Projectiles/Rogue/BrackishFlaskProj.cs | 4 ++-- Projectiles/Summon/SandnadoMinion.cs | 2 +- 17 files changed, 38 insertions(+), 37 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index a19e84b63c..6e091fcc02 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1245,7 +1245,8 @@ namespace CalamityMod ItemID.BreakerBlade, ItemID.MonkStaffT2, ItemID.ProximityMineLauncher, - ItemID.FireworksLauncher + ItemID.FireworksLauncher, + ItemID.ShadowbeamStaff }; sixtySixDamageBuffList = new List() @@ -1337,19 +1338,19 @@ namespace CalamityMod tenDamageNerfList = new List() { - ItemID.Razorpine, - ItemID.Phantasm, - ItemID.PossessedHatchet, - ItemID.Xenopopper + ItemID.Phantasm }; quarterDamageNerfList = new List() { + ItemID.Razorpine, ItemID.DaedalusStormbow, ItemID.PhoenixBlaster, ItemID.DD2BetsyBow, ItemID.InfluxWaver, - ItemID.LaserMachinegun + ItemID.LaserMachinegun, + ItemID.Xenopopper, + ItemID.ElectrosphereLauncher }; pumpkinMoonBuffList = new List() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 048b6dd902..b72d2c1480 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Items if (item.type == ItemID.PsychoKnife || item.type == ItemID.TaxCollectorsStickOfDoom) item.damage *= 4; - else if (item.type == ItemID.SpectreStaff || item.type == ItemID.ShadowbeamStaff) + else if (item.type == ItemID.SpectreStaff) item.damage *= 3; else if (CalamityMod.doubleDamageBuffList?.Contains(item.type) ?? false) item.damage *= 2; @@ -114,7 +114,7 @@ namespace CalamityMod.Items item.damage = (int)(item.damage * 0.75); else if (item.type == ItemID.BlizzardStaff) item.damage = (int)(item.damage * 0.7); - else if (item.type == ItemID.StardustDragonStaff) + else if (item.type == ItemID.StardustDragonStaff || item.type == ItemID.LaserMachinegun) item.damage = (int)(item.damage * 0.5); if (item.type == ItemID.BookStaff) diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index 73720a1bcd..12c8980faf 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -12,15 +12,16 @@ namespace CalamityMod.Items.Weapons.Magic { 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"); + "The higher your mana the more damage they will do\n" + + "Astral steroids can inhibit the potential of this weapon"); } public override void SetDefaults() { item.width = 98; - item.damage = 58; + item.damage = 45; item.magic = true; - item.mana = 12; + item.mana = 14; item.useAnimation = 7; item.useTime = 7; item.useStyle = 5; @@ -45,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Magic { 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); + float injectionNerf = player.Calamity().astralInjection ? 0.6f : 1f; + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI, 0f, 0f); Main.projectile[projectile].scale = manaAmount * 0.375f; return false; } diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 5976f683fd..7ccb16dea5 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 17; item.width = 56; item.height = 26; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 15; + item.useAnimation = 15; item.useStyle = 5; item.noMelee = true; item.knockBack = 3.75f; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index cc05f17ec5..97dfe1b26a 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 69; + item.damage = 60; item.magic = true; item.mana = 19; item.width = 30; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 93fb96a13c..d5360a7bbf 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item20; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; + item.autoReuse = true; } public override void AddRecipes() diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index a7cf96e957..159714b8f7 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 65; + item.damage = 60; item.magic = true; item.mana = 18; item.width = 28; diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index c7e8c7bdb9..47767c3221 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 50; item.magic = true; item.mana = 10; item.width = 54; item.height = 54; - item.useTime = 22; - item.useAnimation = 22; + item.useTime = 24; + item.useAnimation = 24; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index ec57668e40..42bc8cd60e 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 12; item.width = 42; item.height = 22; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 15; + item.useAnimation = 15; item.useStyle = 5; item.noMelee = true; item.knockBack = 3f; diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index 2405f2697a..c783cf4763 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 22; + item.damage = 25; item.ranged = true; item.width = 74; item.height = 24; diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index b4b2dab7fc..1a3ebea417 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 45; + item.damage = 35; item.ranged = true; item.width = 40; item.height = 76; - item.useTime = 19; - item.useAnimation = 19; + item.useTime = 20; + item.useAnimation = 20; item.useStyle = 5; item.noMelee = true; item.knockBack = 2.75f; diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/TerraFlameburster.cs index 5780520b5b..e038769d50 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/TerraFlameburster.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 48; + item.damage = 43; item.ranged = true; item.width = 68; item.height = 22; diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 75abcd913e..8e82126311 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 30; + item.damage = 35; item.mana = 10; item.width = 48; item.height = 56; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 54009b1858..2c63616ed6 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3435,11 +3435,11 @@ namespace CalamityMod.NPCs if (AstrumDeusIDs.Contains(npc.type)) { - if (projectile.type == ModContent.ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + if (projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.1); } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) { damage = (int)(damage * 0.2); } diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index dc559f92c3..409ada1f6e 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 5; projectile.magic = true; projectile.extraUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -158,10 +160,5 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num228].velocity = vector7; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } } } diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index 261c882666..0864fc042e 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Rogue 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), ModContent.ProjectileType(), 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), ModContent.ProjectileType(), 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), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 58d930428c..edfc16bd79 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Summon } } Vector2 vector = projectile.position; - float num10 = 600f; + float num10 = 900f; bool flag = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { From f990840bb03d10e50bbe0ef5e3cb862088ea3c76 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:43:38 -0500 Subject: [PATCH 029/137] Artifact of Resilience rework --- Buffs/StatDebuffs/ProfanedWeakness.cs | 18 +++++++++ Buffs/StatDebuffs/ProfanedWeakness.png | Bin 0 -> 599 bytes Items/Weapons/Typeless/RelicOfResilience.cs | 38 +++--------------- NPCs/CalamityGlobalNPC.cs | 19 ++++++++- .../Damageable/ArtifactOfResilienceBulwark.cs | 6 +-- .../Typeless/ArtifactOfResilienceShards.cs | 20 ++++++++- 6 files changed, 61 insertions(+), 40 deletions(-) create mode 100644 Buffs/StatDebuffs/ProfanedWeakness.cs create mode 100644 Buffs/StatDebuffs/ProfanedWeakness.png diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs new file mode 100644 index 0000000000..6b75ba3d2e --- /dev/null +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -0,0 +1,18 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class ProfanedWeakness : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Profaned Weakness"); + Description.SetDefault("You do less damage"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + } +} diff --git a/Buffs/StatDebuffs/ProfanedWeakness.png b/Buffs/StatDebuffs/ProfanedWeakness.png new file mode 100644 index 0000000000000000000000000000000000000000..eec27cfaac214a791975f125101edff0f07a4ffe GIT binary patch literal 599 zcmV-d0;v6oP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0qjXcK~z{r<(I!p zLQxdQ@6#ocexM+cE)u#Jgo8q~Xb=QaL-Y?g7Hw@!j_pN_{sYk#2tl^gpbZ5{kVFmE zrj$WW_3E70*Yx1+$C5Ytz~%ei^}WkI-*@i0SIf3-MYvs-bMZ?&zt|S3i|=}f<+2n< zp70KFN6_bG1=U)eb$Vi)6Gio$bnFn1-&N)p$In$mu7?J^u%1(), CooldownSeconds * 60); - if (player.ownedProjectileCounts[item.shoot] > 0 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[item.shoot] > 0) { for (int i = 0; i < Main.projectile.Length; i++) { @@ -56,33 +57,6 @@ namespace CalamityMod.Items.Weapons.Typeless Main.projectile[i].Center = Main.MouseWorld; Main.projectile[i].netUpdate = true; } - else - { - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard1) - { - ((ArtifactOfResilienceShard1)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard2) - { - ((ArtifactOfResilienceShard2)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard3) - { - ((ArtifactOfResilienceShard3)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard4) - { - ((ArtifactOfResilienceShard4)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard5) - { - ((ArtifactOfResilienceShard5)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard6) - { - ((ArtifactOfResilienceShard6)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; - } - } } } else diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 54009b1858..971d2cbfad 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -70,6 +70,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Config; +using CalamityMod.Items.Weapons.Typeless; namespace CalamityMod.NPCs { @@ -143,6 +144,8 @@ namespace CalamityMod.NPCs public int clamDebuff = 0; public int sulphurPoison = 0; public int ladHearts = 0; + public int relicOfResilienceCooldown = 0; + public int relicOfResilienceWeakness = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -1367,6 +1370,12 @@ namespace CalamityMod.NPCs damage /= 2; } + if (relicOfResilienceWeakness > 0) + { + damage = (int)(damage * (1f - RelicOfResilience.WeaknessDR)); + relicOfResilienceWeakness = 0; + } + if (modTarget.beeResist) { if (CalamityMod.beeEnemyList.Contains(npc.type)) @@ -3043,7 +3052,11 @@ namespace CalamityMod.NPCs clamDebuff--; if (sulphurPoison > 0) sulphurPoison--; - if (ladHearts > 0) + if (relicOfResilienceCooldown > 0) + relicOfResilienceCooldown--; + if (relicOfResilienceWeakness > 0) + relicOfResilienceWeakness--; + if (ladHearts > 0) ladHearts--; // Bosses and any specific other NPCs are completely immune to having their movement impaired. @@ -4479,7 +4492,9 @@ namespace CalamityMod.NPCs buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/MarkedforDeath")); if (pearlAura > 0) buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/PearlAura")); - if (silvaStun > 0) + if (relicOfResilienceWeakness > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness")); + if (silvaStun > 0) buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/SilvaStun")); if (tSad > 0) buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TemporalSadness")); diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs index 341ecdcff2..dcf0fe3527 100644 --- a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs +++ b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Damageable { public int Reformations = 0; public const int MaxReformations = 3; - public override int LifeMax => 30000; + public override int LifeMax => 1; public override int MaxDamageImmunityFrames => 5; public override DamageSourceType DamageSources => DamageSourceType.FriendlyProjectiles | DamageSourceType.HostileProjectiles | DamageSourceType.HostileNPCs; public override LegacySoundStyle HitSound => SoundID.NPCHit3; @@ -38,10 +38,6 @@ namespace CalamityMod.Projectiles.Damageable dust.noGravity = true; } } - public override void HitEffectProjectile(int damage, Projectile target) - { - target.Kill(); - } public override void DamageKillEffect() { Utils.PoofOfSmoke(projectile.Center); diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index c638022950..edd9c4e2c1 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Damageable; using Microsoft.Xna.Framework; using Terraria; @@ -69,6 +70,23 @@ namespace CalamityMod.Projectiles.Typeless projectile.velocity = Utils.NextVector2Circular(Main.rand, 18f, 9f); projectile.localAI[1] = 1; } + if (projectile.modProjectile is ArtifactOfResilienceShard1) + { + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && + Main.npc[i].Distance(StartingPosition) < projectile.ai[1] && + Main.npc[i].damage > 0) + { + if (Main.npc[i].Calamity().relicOfResilienceCooldown <= 0) + { + Main.npc[i].Calamity().relicOfResilienceCooldown = 600; + Main.npc[i].Calamity().relicOfResilienceWeakness = 180; + Main.npc[i].AddBuff(ModContent.BuffType(), Main.npc[i].Calamity().relicOfResilienceWeakness); + } + } + } + } } // Falling else From 849db4bc10482f0ee0d277a033f7a91543d0f802 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 18:46:12 -0400 Subject: [PATCH 030/137] removed venom immunity on aureus for levi teeth --- NPCs/AstrumAureus/AstrumAureus.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index c94cb866e8..4299c68e61 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -64,6 +64,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.buffImmune[BuffID.DryadsWardDebuff] = false; npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[BuffID.BoneJavelin] = false; + npc.buffImmune[BuffID.Venom] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; From d3976602057bd4f17eeda87998be4641ade26b20 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:57:01 -0500 Subject: [PATCH 031/137] Serpentine UUID fix --- Projectiles/Magic/SerpentineBody.cs | 4 +++- Projectiles/Magic/SerpentineHead.cs | 3 +-- Projectiles/Magic/SerpentineTail.cs | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index 6b1265b69a..27134eaf2f 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -8,6 +9,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() @@ -35,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = 0f; projectile.netUpdate = true; } - int chase = (int)projectile.ai[0]; + int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index e9774ac928..bab40332fe 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -8,11 +8,10 @@ namespace CalamityMod.Projectiles.Magic { public class SerpentineHead : ModProjectile { - - public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index a4396b4017..011a9eb155 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -8,6 +9,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() @@ -35,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = 0f; projectile.netUpdate = true; } - int chase = (int)projectile.ai[0]; + int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); float num1064; float scaleFactor17; float scaleFactor18; From c8724b4ea4c0c005f34719e1c233a84a0a8f8dbf Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 19:03:37 -0400 Subject: [PATCH 032/137] moved crystal flare staff and lazinator rarity/sell price fixes too and Lahzar now uses Lazinator --- Items/Weapons/Magic/CrystalFlareStaff.cs | 15 ++++++++------- Items/Weapons/Magic/Lazhar.cs | 1 + Items/Weapons/Magic/ValkyrieRay.cs | 2 +- Items/Weapons/Magic/Zapper.cs | 21 ++++++++++++++++++--- Items/Weapons/Ranged/P90.cs | 4 ++-- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Items/Weapons/Magic/CrystalFlareStaff.cs b/Items/Weapons/Magic/CrystalFlareStaff.cs index f77cc32a6a..443bde8a77 100644 --- a/Items/Weapons/Magic/CrystalFlareStaff.cs +++ b/Items/Weapons/Magic/CrystalFlareStaff.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 30; + item.damage = 50; item.magic = true; item.mana = 15; item.width = 44; item.height = 46; - item.useTime = 12; - item.useAnimation = 24; + item.useTime = 10; + item.useAnimation = 20; item.useStyle = 5; item.noMelee = true; item.knockBack = 5.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -44,8 +44,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.FrostCore); recipe.AddIngredient(ItemID.FrostStaff); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index c0ccf26346..bd1c1352ae 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HeatRay); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.FragmentSolar, 10); recipe.AddIngredient(ItemID.ChlorophyteBar, 6); recipe.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 9cf46d8acb..1c75922f5e 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.NPCDeath7; item.useTurn = false; item.noMelee = true; - item.value = Item.buyPrice(gold: 16); + item.value = Item.buyPrice(gold: 36); item.rare = 5; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index 77dfe80b5f..2365324dbf 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 40; + item.damage = 50; item.magic = true; item.mana = 4; item.width = 46; @@ -26,14 +26,26 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = 5; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; item.UseSound = SoundID.Item12; item.autoReuse = true; item.shoot = ProjectileID.PurpleLaser; item.shootSpeed = 20f; } + public override bool 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(2)) + { + type = ProjectileID.GreenLaser; + } + int laser = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[laser].usesLocalNPCImmunity = true; + Main.projectile[laser].localNPCHitCooldown = 10; + return false; + } + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); @@ -45,6 +57,9 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.SpaceGun); recipe.AddIngredient(ItemID.LaserRifle); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofFright); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 71a453390c..ea248f11b0 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = 5; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = 10; From b41064161223dd4bca95b40200ebf03aa3476662 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:59:03 -0400 Subject: [PATCH 033/137] compile fixes --- Items/Weapons/Magic/Lazhar.cs | 3 ++- Items/Weapons/Magic/Zapper.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index bd1c1352ae..9e9eff4ef5 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shoot = ModContent.ProjectileType(); } - public override bool 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 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; diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index 2365324dbf..d67c18c73a 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -34,13 +34,13 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 20f; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (Main.rand.NextBool(2)) { type = ProjectileID.GreenLaser; } - int laser = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int laser = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[laser].usesLocalNPCImmunity = true; Main.projectile[laser].localNPCHitCooldown = 10; return false; From 43b29e77ed9cc4760a1c9123ead4af83ae977e59 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 23:25:54 -0400 Subject: [PATCH 034/137] improved pet AI code --- NPCs/NormalNPCs/ProfanedEnergyLantern.cs | 7 ++- Projectiles/CalamityGlobalProjectile.cs | 71 ++++++++++++------------ 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 75a87f295f..940d89409f 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -211,9 +211,10 @@ namespace CalamityMod.NPCs.NormalNPCs drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; drawPositionY -= 10f; Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Width, ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Height)), color, rotation, - new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Width * 0.5f, (float)ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); + Texture2D chain = ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/ProfanedEnergySegment"); + Main.spriteBatch.Draw(chain, new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, chain.Width, chain.Height)), color, rotation, + new Vector2((float)chain.Width * 0.5f, (float)chain.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2179561dc5..2808235b8b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2052,7 +2052,7 @@ namespace CalamityMod.Projectiles { Player player = Main.player[projectile.owner]; - //anti sticking movement as a backup + //anti sticking movement as a failsafe float SAImovement = 0.05f; for (int index = 0; index < Main.projectile.Length; index++) { @@ -2079,21 +2079,22 @@ namespace CalamityMod.Projectiles } } - float num16 = 0.5f; + float passiveMvtFloat = 0.5f; projectile.tileCollide = false; float range = 100f; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float xDist = player.position.X + (float)(player.width / 2) - vector3.X; - float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y; - yDist += (float)Main.rand.Next(-10, 21); - xDist += (float)Main.rand.Next(-10, 21); - //light pets lead the player, normal pets trail the player - xDist += (float)(60 * (lightPet ? (float)player.direction : -(float)player.direction)); + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + //Light pets lead the player, normal pets trail the player + xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); yDist -= 60f; - float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - float num21 = 18f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + float returnSpeed = 18f; - //if player is close enough, resume normal + //If player is close enough, resume normal if (playerDist < range && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) @@ -2104,7 +2105,7 @@ namespace CalamityMod.Projectiles } } - //teleport to player if too far + //Teleport to player if too far if (playerDist > 2000f) { projectile.position.X = player.Center.X - (float)(projectile.width / 2); @@ -2118,52 +2119,52 @@ namespace CalamityMod.Projectiles { projectile.velocity *= 0.99f; } - num16 = 0.01f; + passiveMvtFloat = 0.01f; } else { if (playerDist < 100f) { - num16 = 0.1f; + passiveMvtFloat = 0.1f; } if (playerDist > 300f) { - num16 = 1f; + passiveMvtFloat = 1f; } - playerDist = num21 / playerDist; - xDist *= playerDist; - yDist *= playerDist; + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; } - if (projectile.velocity.X < xDist) + if (projectile.velocity.X < playerVector.X) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += passiveMvtFloat; } } - if (projectile.velocity.X > xDist) + if (projectile.velocity.X > playerVector.X) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= passiveMvtFloat; } } - if (projectile.velocity.Y < yDist) + if (projectile.velocity.Y < playerVector.Y) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += passiveMvtFloat * 2f; } } - if (projectile.velocity.Y > yDist) + if (projectile.velocity.Y > playerVector.Y) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= passiveMvtFloat * 2f; } } if (projectile.velocity.X >= 0.25f) From c026fa6835c14bb68696425534f9899246f4fd3b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 23:38:42 -0400 Subject: [PATCH 035/137] added dyes to master branch --- CalamityMod.cs | 2 +- Effects/Dyes/AstralBlueDyeShader.xnb | Bin 0 -> 2388 bytes Effects/Dyes/AstralOrangeDyeShader.xnb | Bin 0 -> 2688 bytes Effects/Dyes/AstralSwirlDyeShader.xnb | Bin 0 -> 4224 bytes Effects/Dyes/CeaselessDyeShader.xnb | Bin 0 -> 2308 bytes Effects/Dyes/DefiledFlameDyeShader.xnb | Bin 0 -> 2880 bytes Effects/Dyes/DragonSoulDyeShader.xnb | Bin 0 -> 3128 bytes Effects/Dyes/EndothermicDyeShader.xnb | Bin 0 -> 2328 bytes Effects/Dyes/NightmareDyeShader.xnb | Bin 0 -> 2792 bytes Effects/Dyes/ReaverDyeShader.xnb | Bin 0 -> 2692 bytes Effects/Dyes/ShadowspecDyeShader.xnb | Bin 0 -> 3724 bytes Effects/Dyes/StratusDyeShader.xnb | Bin 0 -> 3620 bytes Items/Dyes/AstralBlueDye.cs | 36 ++++++++++++++++ Items/Dyes/AstralBlueDye.png | Bin 0 -> 425 bytes Items/Dyes/AstralOrangeDye.cs | 36 ++++++++++++++++ Items/Dyes/AstralOrangeDye.png | Bin 0 -> 415 bytes Items/Dyes/AstralSwirlDye.cs | 37 +++++++++++++++++ Items/Dyes/AstralSwirlDye.png | Bin 0 -> 451 bytes Items/Dyes/BaseDye.cs | 38 +++++++++++++++++ Items/Dyes/CeaselessDye.cs | 36 ++++++++++++++++ Items/Dyes/CeaselessDye.png | Bin 0 -> 345 bytes Items/Dyes/DefiledFlameDye.cs | 23 +++++++++++ Items/Dyes/DefiledFlameDye.png | Bin 0 -> 408 bytes Items/Dyes/DragonSoulDye.cs | 36 ++++++++++++++++ Items/Dyes/DragonSoulDye.png | Bin 0 -> 394 bytes Items/Dyes/EndothermicDye.cs | 37 +++++++++++++++++ Items/Dyes/EndothermicDye.png | Bin 0 -> 373 bytes Items/Dyes/{ => HairDye}/AdrenalineHairDye.cs | 2 +- .../Dyes/{ => HairDye}/AdrenalineHairDye.png | Bin Items/Dyes/{ => HairDye}/RageHairDye.cs | 2 +- Items/Dyes/{ => HairDye}/RageHairDye.png | Bin Items/Dyes/{ => HairDye}/StealthHairDye.cs | 2 +- Items/Dyes/{ => HairDye}/StealthHairDye.png | Bin Items/Dyes/{ => HairDye}/WingTimeHairDye.cs | 2 +- Items/Dyes/{ => HairDye}/WingTimeHairDye.png | Bin Items/Dyes/NightmareDye.cs | 37 +++++++++++++++++ Items/Dyes/NightmareDye.png | Bin 0 -> 374 bytes Items/Dyes/ReaverDye.cs | 36 ++++++++++++++++ Items/Dyes/ReaverDye.png | Bin 0 -> 419 bytes Items/Dyes/ShadowspecDye.cs | 37 +++++++++++++++++ Items/Dyes/ShadowspecDye.png | Bin 0 -> 395 bytes Items/Dyes/StratusDye.cs | 39 ++++++++++++++++++ Items/Dyes/StratusDye.png | Bin 0 -> 408 bytes NPCs/CalamityGlobalNPC.cs | 7 ++++ 44 files changed, 440 insertions(+), 5 deletions(-) create mode 100644 Effects/Dyes/AstralBlueDyeShader.xnb create mode 100644 Effects/Dyes/AstralOrangeDyeShader.xnb create mode 100644 Effects/Dyes/AstralSwirlDyeShader.xnb create mode 100644 Effects/Dyes/CeaselessDyeShader.xnb create mode 100644 Effects/Dyes/DefiledFlameDyeShader.xnb create mode 100644 Effects/Dyes/DragonSoulDyeShader.xnb create mode 100644 Effects/Dyes/EndothermicDyeShader.xnb create mode 100644 Effects/Dyes/NightmareDyeShader.xnb create mode 100644 Effects/Dyes/ReaverDyeShader.xnb create mode 100644 Effects/Dyes/ShadowspecDyeShader.xnb create mode 100644 Effects/Dyes/StratusDyeShader.xnb create mode 100644 Items/Dyes/AstralBlueDye.cs create mode 100644 Items/Dyes/AstralBlueDye.png create mode 100644 Items/Dyes/AstralOrangeDye.cs create mode 100644 Items/Dyes/AstralOrangeDye.png create mode 100644 Items/Dyes/AstralSwirlDye.cs create mode 100644 Items/Dyes/AstralSwirlDye.png create mode 100644 Items/Dyes/BaseDye.cs create mode 100644 Items/Dyes/CeaselessDye.cs create mode 100644 Items/Dyes/CeaselessDye.png create mode 100644 Items/Dyes/DefiledFlameDye.cs create mode 100644 Items/Dyes/DefiledFlameDye.png create mode 100644 Items/Dyes/DragonSoulDye.cs create mode 100644 Items/Dyes/DragonSoulDye.png create mode 100644 Items/Dyes/EndothermicDye.cs create mode 100644 Items/Dyes/EndothermicDye.png rename Items/Dyes/{ => HairDye}/AdrenalineHairDye.cs (93%) rename Items/Dyes/{ => HairDye}/AdrenalineHairDye.png (100%) rename Items/Dyes/{ => HairDye}/RageHairDye.cs (93%) rename Items/Dyes/{ => HairDye}/RageHairDye.png (100%) rename Items/Dyes/{ => HairDye}/StealthHairDye.cs (93%) rename Items/Dyes/{ => HairDye}/StealthHairDye.png (100%) rename Items/Dyes/{ => HairDye}/WingTimeHairDye.cs (93%) rename Items/Dyes/{ => HairDye}/WingTimeHairDye.png (100%) create mode 100644 Items/Dyes/NightmareDye.cs create mode 100644 Items/Dyes/NightmareDye.png create mode 100644 Items/Dyes/ReaverDye.cs create mode 100644 Items/Dyes/ReaverDye.png create mode 100644 Items/Dyes/ShadowspecDye.cs create mode 100644 Items/Dyes/ShadowspecDye.png create mode 100644 Items/Dyes/StratusDye.cs create mode 100644 Items/Dyes/StratusDye.png diff --git a/CalamityMod.cs b/CalamityMod.cs index 6e091fcc02..e697c98295 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -9,7 +9,7 @@ using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.Dyes; +using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; diff --git a/Effects/Dyes/AstralBlueDyeShader.xnb b/Effects/Dyes/AstralBlueDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..9757c6ec19eccf4dff608ca2a503e3cdebae2ccf GIT binary patch literal 2388 zcmcIlO>7%g5T147)Fm#C#D#+;R+W$niY&(@$Po!KaT`oO;?9mR-I_4A zg)^_8#(vu|x-HA>&Fdctr)Sxn)x}(%fAf0TYrCE!Ry)FT9iu(3SG}uk%Y0YtHSFu6 zvszp%m^;O*Vqse><(HOTBNpwa6w%+aPY&inGkR!egYiF!2tS8m8k&vF_=zy`wswtc zB2SW2if1Em#95#zxHPD%aHLOh(HR(C*>2ko#W8mk!bvflyH^*c-Ptyry(pM@ERUig zeDeOREO;s8eb6;b%iUvJ^3#$4pUO`&ziyzzhKshx{FPJq+!L>6yAk_n{q`yR8Rj>v zU4c>7_@lz*cc7TCB8l>{J;xL^oS!)MP$BcHR7}di_CB_q_IB0oSz$SGJ?Y7N=hZnz z#?5lfhUH)nEegpCV=`v{ znPV2h+__fnohp1TH}*u;==F%}Y6!E{u|D<00@3rZxn_>xt$2J9D&+#eiZn1*pe@Dj z1OK4d2f&Al{TMhUn+lu-E-H2fxTV-PfxlPmpMf7J_G93b(vvK3QL&rAu3~=!d{?nY z6U<8VP(?xfoI|A=LZ zO1fN2`qiRm@qHTF-#|1fjE^f0q^5B^Zt zpM+mK_uv;}_SfHrgIC}9>ej7g_RqjS91IRX{FB$fxb{+%LLV9KPw;I@W&HKQhoHrM~>4tCzzvsjRGEHA9&zg@~3FvzYxY~efG(i2?qa?|1#FWIS=QP xH1cPll83%vok6$`@13AC;K_N$)KAce)#v#rx4=&x<;{HNB~TA?9QC=M{{kSMGtB@1 literal 0 HcmV?d00001 diff --git a/Effects/Dyes/AstralOrangeDyeShader.xnb b/Effects/Dyes/AstralOrangeDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..c420c03742ef0c32a58abcf360ccc6e6005a0936 GIT binary patch literal 2688 zcmc&#KWrOS82|2^KMrwm5DW~FI3XdGDzY3CqeL_$jnmKw10i<6TXl6V^{I|8obS{I zF<643NDLq{G8m~t6*FWge}pQ?zyMP-FhnW?gNI7((1C@;=J&mK@A4W5s#y4}cklat z@Atj$&%JxDyt#07kXla=8J`(%xK-b4dK*Ee(y%j2zP;&O_53TDg4YO~MvytbvEfvM zRmWa;{0ZwM_G`YqRdcJ&3F{rlZ@OM%b}EzQ--J~N>p|!{vkfNG%FHrHq!Ou%K)T-`cXPZm`X^;-?e=n9ffzzhtAsc7V3W{Ie(UxhLVO7fANe{`C|1 zL(DI`n+|4G;|-0=??5wQNs)PZp+36C(-q~!^`xTr z&bzaZ@*8EJMb}3REnc0dTEl%WbS8kJ%^rUJk^l|9Znq7om)9h=|cQpGJ^aIU)06nSoWE}dmW>=sGn*9m% zo0{E?bl&n%(?5@L{t4K=hDR{GL#!?ybqo`4 zljHGS@DauihJ3$f+`F%UnKUSP-$lHi1vVhCUn4BKD>{bQQ|^nUzlpl51}Fu8{z;Lz zJY#YX^Jq;TS@B)TH5r>dx0)Ao7qb-K)7I(L7p)7$Qqd~a_zJfQ-sYBDhcc7Ny_}iJ z=Q6qJsVVC9zo(Ve^CiQqEFJF`V{yL>vhE>{?3X-~dcQbJuHgm-_wW{m>g#@l9SBU; z!)K6rkKM0h_v!KehX2wVd5?8E{8sf|2iN{fzf$N|X&I@Q^dXGBR>z|=Qak>1A zBK`04??1{ECg+c*((C7GsZuQPCuC4|Ox44m9N%3md?r{7nr}y+BHlH=dx6Tcq5i-5 z|C7a_m6)qAi4#2~7;<0UJ3(WQ#Eq84e=+L`nzvM3eJ{pTZai~74z<~gF)9OJ{l@1}p5znfm(2QGy1Byi)@!PoZaH{W)4&%E;S_3JZ?j{xuN z?(%i|1Mh)(?m0g4Fp%M1q<>1ubbEnQrZn*G9wobN^wcyc*&3v^Hu4<6nZ(-Ko$?F2|oUlV?M8$;A4IS8^WGLwA+4K#E^Ta80>?7wTHoZ0desqiWo`i xwns1&4@Dr>uGj}Yrb)wyrPhaq5A0R~7_W0JL)33`-cg<4beV^=Mcpm#|6lM|Q%?W@ literal 0 HcmV?d00001 diff --git a/Effects/Dyes/AstralSwirlDyeShader.xnb b/Effects/Dyes/AstralSwirlDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..0d70f8779629f30f5308b7c2cc73ea565f764bbc GIT binary patch literal 4224 zcmdT{OKenC82;}}A2akZ_#!1VGMbnmsgt&}q=d(ev>=V6mQJe;8!}99>4fP_oz4Vm zTwH<+Of|{9&PEaIBkQ$vDxaImjTIsz*<|EkJ~?5Z%;ir+dUM%=oh?KT zjE&i;!l0cTwexM^wX|Q!Cnv|#sj0T`n|6LGoy+d+inQ~uE!lz*x9{3U7e}1o?~{$sNLP(-MvFd)?!HHyM_nXk)%gfu)O@cPl+2a z)nK%GtBMI=D)vt#kK65{bz*Dkbci2o7DmC)(U<{AJ%nO!E|bfPXLH3+c$5uuFDC3% zE<2jcPb*{Uk?yI<{m=Luq##D|jmcyxU6`h<^&7PUFjK#g`iUeuoGhU2p8lRS^x2c* zV6LFFSNvzz(66KZP2?DIYFaTJK%M zwmL_*F86#T((mAmX`8uq+jO|OvsU)bB%a;AX?q|!H6^TT$WD!C({C5;4v}WateG|p z#kmDT(>5@Bw17E|F>c5X_)iV_I`~CHz7Ia2n+m=ae2*c=!H*mADe&hF`6~E3hI}7< z!01UU_#Q(Z0belW55QkBjer%imf9g9j3pZ{*-|`H%jL>mC8@imY4d5{(5e6OwGahO)WoL*&{zj&wR5m(SG!1MUS=YwhoTO zd$+>SlJ<@IJhNWjgQOZYVSS*a`@lKi;UfB5fVv!y(|x95$M-hLl9=aLV+t2}($x_6 z9k2Yxyd0^kbJKQaT#ad8Pd)5wRb1_hJ$TyCRrcpr#jPwGd9B@>O%M56U%fn!=*_CQ z`i$z@)?07I*Q$E8uYX!E_uaxbsy-_^7nVt$-$_2>tPs<^C9ltowzFj8n!ePYuie`x z;E%N8>;K)`M$}Thr|c(*HFBM_QtwJ{h?%`Lb@{wjKWFCt>E~MesMa<2kMT*=t=?<; zG@n^BAKLhgXT4gN>m9&G%yp>VU<}OB zt*R6UotUfe=Ohp+?RP(YLco{iB(PLMAAObtoPZ3MP;U+1jaVC=v!v|Q%kU*U=YC6k z4)lOaX+<8U3_bDT`^pK*QpKLS!w&jLn^jm4F@iEv!d;4(N>9a9JbuHJHbCbE!%rhLxyj>PZ4Xz^|RV`2Dar&ygJvmNq#6b$wCRapax<~r~SYv`@|1<;WYbj#I4(h zoR{1YgddyXIs1kkPO^!IkmmDoKH-!m4nbkU7%g5S}%5;t&^C;?jd9R!Egf61EH_w6|UFM!Mj(e7ohRFK%qub-!d= z>$W##9>>1qSz8UK-kvhwvAwqAw(>LS4F64;g`nvNo}F*mf$v$(DRVWr)^zG`*gF;X zhTY2NX0r8-+%Cxt5?#zZ*yBO>kR@rpuI(j7gKM#0La zb=}U8;+!8vrSXh2P0s-`puWaYmM!EYMnU7L)DG5J#*Y%p~t8Uv7 z49}gbbB@ZJkV~c3j(&6zrVl*I@ga ze;f8)%|960TykHtKOgq|6R`UlK7=WRDEpMytS}sem#I*>u$V&N2?rx#$RYM2<^di} zs65Na=v(j!un7LRhda-=m5T!Uz?LD;4$!VS<)x#RBsT%A8cWJcp{u_aXs( z3Q0ovHeDf#MJd^x`}M(v;&!TlFx~$B>?Ouyz(4-;<<|i%JWl?6{&8~UKI3D+53l@? zC+aLPpM~*p;J@tc<&|=r@i=hf#KUi`$?v}3?VWw?(_6RZ7@q*X+w1XF`*B!n;U&5C z9dz9v+IJ|9e1XS15vq1E2mTFks<^UY$Drz095*Q5!K@;VTZ1?u7V=xm5!gp#sPmqv z69I=hQ91ypH{?Z-Q|-i%7X$A_v9`qI+A7{dJnWuE9o%)16Gxp1D00yX*RG;=c%+7k n@fu@TLz{7%Q6n?vI>djB<@FP)_NLWaqQbkr05|oIBm^cj$7znWgzExXiU0Zd$>3Uaf z5QnYc5F`#DdMJp4k$Q-nOAZAtRh0usa3aS@g#>FCF6bX zoA14O@6GIN;hmYQU6k%6GQKe0t`t4D?w0&ip=PJ%JbT5t>Ux(`8Mo#;H9vK(RC0>` zqGK;R-ca%=_8XqPTCNo9L&^6YuU>I$Q)8)N{u@eWf~p^Q&Q#3_e9x{9B^QE=)k^U# zXD#nuc4|`-W242=#6@Rh*%==mAAgxxjGH|~zxF=3(=SZ`TrtDNedGE0ulD2*m&y7{10)mw!Jm! z%siIg=F@kqj?PA4WV_Wh26akpd?_++>Mu%-5ZSU~U9>M3H1dFaO+57RU zNAQm`KVMmK@KiP4(zv__nh8sa%*zeDqO*we)A8Na$h?)BNeS4&2d-CLUU2IbQBJ3x zzG&Y$I{PR;9AXM)D<0P1@;mFyYJ8P9`zkpBCCFATmHnJZl74^lisF5w`5w$s)FsYW zuJR$ynDW_rY@ZR4JJ-s+(}mCF?3%M+*XzV}<(*==R=E;5BSa@*bIt6-OY!p*hLY1z z&ME`XEJj(gL+IaV_8sWEntdO-rJ4$T5c-5>XQ7uh`x^8cntdDkj%MG7ZfQLkgg&9! z1?awJe+GR+v-cvML+)z&mr>3?0^8Q`2&Ohf>3Kf9X1m>L=O~kZeP$5mGaL|D7anXw zlKsF!C?>kf)9V;FF*Y#d{+hG}on;#%29`m`>1PHY+(#2O`|e?|??Zug35t{3k`?BgpbFT%Jc6+uZk&$6LIEa!%IB5m)OMMlTFg=T1+aUVJHe zKAX!Xb7j8nlNonqwNiyLnHqg1H90<-8l4y$qgMMTT39@nGt9zVt9`!H+dmPLF+Q83 zw+1EufL_Jmt>QZPp8W*l1_o!z*sTb=Eil=a?Ficun5>8U%)XD^#{+lo!M+Fo(i?f_ zZEmXFR(s%I`!D_KL%(wKNWCN6BPA-fjPDoo-;PY8yL%dunB z|H!)0wD@kb9;0+pt*ggkOy$N;&L^hj$hAC)!E%tx-+~8_1cYy$_lUaUlxX0VNPqnI z^RHog`s=Troo3tuelPJ$`d(swyHt7+z1tReH*n*`&Ube2_djel&%FBS`uZgEdw_2? zn|w{*B?`IM)6dBiLS(oV>7SF8Xeix)KEvr#0-U`q!`c(J5!nPA^`HzhJWfju)Qf); z+$CIZOJNr+eT#b${sIF|f^U))qGvikG^rgT)+1OPG2_&1JQc0MF|{>9^tNGv^8(hz z8_ny6-L%)}!B9LThqam_4(Do89BZlhlfuWO0mL0>fE(j^qJitNh!gR#Rhc(fpSuPy>cOaES4sxr$?Rqf_2Sy=F=Iw>{?|veSUVP&jrr_`oQ`*gVMbXL%tfntqByTQN+1>IjdloXY$Un zoXk3IzsQ$(a(wRGn$W$s7W0LoyUbYW6G{M1*JBeABaaH_U6j49KYN0nYvN7Vu2diS zFP)%oVEtrq!J?yef2nDC4>SlQo6O7hoPsrh^HZ<$o+jq4)F35+y?1PUWl?w5?CauC;x%jSUbrH1z^O|`MhvN6s=&GH8 zaaIAmv*>dg_F=DUcnkKPh7VxJRZ(HL!|u~?7WSNmmtf!2@Yk^KYWM(lT&qbt>^==o z!*(@%9rkSv?}s+K+|%q&!kl-&ZEJi;Q-G%IEMHnP2o8e*%1pjG+z$8y4}#-;V~m#i z9*=2sxtAtghRtme-9)81hZXee=<9-u2#)VRbLx8&r385XlTGsSoEY$Kz?&KiCH0pl zkD<6LQY+)KV6k$k`%)*>zrCq56ECDLWOLb6ZjL|8sf@j_SS-QlPj|nZ?(gkRclY)5 z&|&aCjZd7<8RqopVbEEx!AJ1P9G6ejz@XF`>=AU%kaHYIzl<(xAkW@X$UQ1oNRBo6 z?bz7h>gu&|mmX(539KhKrU&3XQ%%)Y=MIBsD3cwVOeoR+cu)TN)vcXW(~xx09=?wp z9tNjrbUK^i_y%>JQu%P5`6zNzciy1!YIuB6^P|Rd;vr-$_eW{@_ktVic;0=qBpTm> zw~1mgN>(qn?GAnL;Pg2R58~DgG2a0GUUGNnUUF<3{1A~p$b2Js;85!`zs-DH@;)$M zp>0eNe3Rh)!GquD2X}tVz`u;!EP43x?|lB*gF4>=o^`uFT{!pY&8Iky$TI={uRm7? z*Ka*5w2E&9Z?xY1Cg1YycN?`AU-@utt)KI01HVzLZ9#X3bH{t|IX=DsIBT1seS_l3 z>ae)lN$~rd6yL9+#->4WKT1B=jaV`7zqB>v_zC z9s!SWG5Cy8t@@;hA$_PAJO{t0)dpyuN8AXRB1S9xwrRc*lYdTl?6H009zWDK`)xpe zSf{V&h4Wc$L|z!j+GSpxuUrS?<9hZ1ZWZ56)GsPx;eU&2vsgd-keora&N<|D=}v*LZKjJZiwfDr1w9Vl0k&^IXOz?TgO2 zMW~VIt+rsi1-Tq?Q>zJZ5onn+g|4>R^e-+DI`+xAm^f$htZ*!4%UmKNcHpaA7_)yB zBZ?UKmK@7Pax#}_m<#6|A(_i@PUgb?o@Oi@ IiTQi-H%u+fQ~&?~ literal 0 HcmV?d00001 diff --git a/Effects/Dyes/EndothermicDyeShader.xnb b/Effects/Dyes/EndothermicDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..3477734ded5849d43467bffad13b8f29018b2bc9 GIT binary patch literal 2328 zcmbVNF^n5k5S?Ay#32SBU5b;kWsoe(XYPSQ-8`;$@-`*FuJ^yC4>5T$03aXd;ec=RcVebjQVx7c( z+qcI9*O^qT4~0K*z0vw=wZ@-{)eMJ0=!^A{2m{|9R;-=y`p|XW5eHrGrWma^R_ji` zab2wJiM86=+H1sOjEh9Soq7ClDKX`jaXMc7V@muY9(m}pG_!A{QMkQt-w-uYoJ(0$ zf+w66%E4to1C676nu|`s2%Fx}^T|{3`x-&{G#7F2VMjRLXwUW!WHR$u{*;g8o7ZP$ z!J$z2{@8Zh;DBw#FDU|iI={sHj*SW10mh#3FP^~XnS^aGknAV*hbQn~V1C!#7xY!E z_V}&Fyh z&Zg^Q4c>mX&Zfp!eRHmomjJ?+dt(rEk|yczprCl4YPrXIO!k%Bua5f(?wHD%J$KGZ z(mU^!XQvC_%gqC^V^1c;`|1j3Fmi8&Vuk2s*t}=X;idR_7OLbtz(r-?*@6xEyJkNEE^0Gb25x9}4>-{5&w=l2_B_R0 z@<_v9rak`x-_M#qbyEycxRMMjju-J2YIfh+SVrJ44w`YyA+{mb9A87Ii4U*G?}E>u z_n`88&1`nx!)Idp%=;0_yk8SvF7f@5`qFpB0|OPLBJdPZ@2WhNz~he;>6dp*=F8qV z8pprw8TnbH5)$$IvO1yJX*8DElI)nk&za zea}6cWAD!6vwYSZf;<0b1|`g(vyB!rNv~L9tFzI4i`b-QYrD&YMSPC7dab6sGqok1 z&%bAuynNtREd3{*x|9DI#yPrVsdf0jM+y5>4SupdhLjn+H}g+2s*Qn8EBYl?jZ`gO&=1$|GkA3)D2JsE;Nsn`|h zo??Fh{ib4fVx2?oEBeQA&EEstQScb15F+(I($MrUJP6NGVdcfSA(+4NBrxtD+YqCJ zzdDAF-Q;|H7rcjY9YgG|p7ibuU^=BE-nTLDPK2c*?57xu?}{xgiYek^>Te?NsuT^t zpMOFGF3y;Up&!nPBOAR}Vou~{&yD8!vGXI8+|$OXD@z~CO5aI@wzhaz)n0p7{!70G(67=WN>7B(iWIqzDs~W_ zrb2OX<#9>+-=CTMaV2oA3zcGl_g$lrLAf4&<@oMm;W-wKmV)?I#9rgQk5F+ouU(sB zyif4?>imvl<2m~jA8#0_d^^@Zq)axL&UxFTRo}zvoaDKdPEQ6H ztxB}!9$*x4G+=04lnePemtwcU3sIx2C2V2817UNFPBKp<>7%g5T4!qc$2twB@Q5ngoT7uP-HoOC=m?_aTs>WL z94x^h2o4}P6vV-mI7H4Rh`&pOa_9vKi5`QRqmMoGfDl}~eDmJ!=Cx`N>R7WoKi|xo znfLa2?XATd1N6}_k@mUvrd@HJrc?DYYYj8A?3x?a4adEn$vF+rYIvE8)v8tTRxNYg za>vrAp&&6-_lj-}tR+@|d`=B6@P{*9$`e%^}(gpu&-LAZ0ZI_(u zR%32vYNAq|xoVBCThrO;=}BVJj)#bTAGv>UPN?#s4F$bFbt$8G>IaWXHGUe9{FM#! znw6ypvk-fwaDo}9KA1GHr(hzRVxj~TKj+jPm*SXR1@NdCuH7$M6{oRoy4y0CaZJbZ zC7!%KGZWe-|Lsk)Vtd=HNBCp}fKA0G8DBIpVbjCdWBi3v@H`WL)$t_yB!B%B{2=2? z_J)Ob)Z@1bmiItWp-GZ;Ilf!5R&jpf*dqnZTdAm&g6_ZTxb^jd)3il9aX-m$-#I(S zL~$b=vt+wigWHeSSyJ#(-5eXy83=yfzE<;!qDW2{;XY7eAFfgKCC*pTejjHnirN3) zG2^0k?v-b!5}(VZZL455o5X#UtV*q6zvo-yL}#IM&m6-`@%t%oMCTz~h!ni@;F_Yh zAb+Fi2at~x{T^f^8Y<*b$TNzbhg?(iEy!Og`VWxrDEd9fhBA{;$TNz*2H8{ePa*Fr zdN-6g<&h$P5!QSgwnN1pnkfK9^34HAdJy!2OOz|Ux;P3o#R*|!7we!j_uYb^cPwmu55)33b?g%7`y0%-@c!7-kX15_kD%!O>Zc@d z{F5Z@^4!UISucAZzGr-Sti`t{v9cD%ZZ~%)gSYdli$x*tAh)$3%mjQ-PErOcT+2e_;R>@fggfh zJ9FnpbL6L=_c|}W{PE7tEaw@P`452mCBi=|k3kFjxF5=&k&$XIicc;Ddv~9VZW}%8 z8X2ttDz{O4KlU8H^1envtDnlZ@E!ND4LH~-#OtlW7_SSTMrD4tF*oFsc>K4;vdqoc zGGaUJK?>SW2*0$ce$2CNApi5I2X}^u8KQ1`7>wDY9=)X_kAXaDeVkkBvL;?5>WS+& zD7eKjGDko6^Ieofrv%pNwED1y%yCw%tJ5=KPS(3E^e6m`M?C(PBwof7>gr-{JjaBP z6X-)j4!Nd*m@>yHdIx!fa1BGqn44IGbMTrceqNLHuE101PoO8>N9?cg^SS#M66kmP literal 0 HcmV?d00001 diff --git a/Effects/Dyes/ShadowspecDyeShader.xnb b/Effects/Dyes/ShadowspecDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..2abbdb9b90a7c7c3fff5dc33fe5c0f0a47f009b3 GIT binary patch literal 3724 zcmd5;J#1T56h6;RTIbi5=#bJ#mE;KQ}jY%I%wV2YUwx4+@8~-XZc++oM~%l&U|R7JuXSh?ZON z)r8rt)$lV0sXD%pJ?-|2!HkBhT4-SUBnp#*S+Ow2W|?FslxnI}D3vAjxoQEn@?q}P zw3{mxXS3yH?MxiUFZxS;GCn6q3ug7*#cVELS*Bv}?FN8#8{bZRI*SfxD`0|ub=rfitBL>S4-AC9RSaryTlz zV);IvqpC}tuXO%noH4__`k#IJRPL;my|V|;<=C=2nO#~E)-~R%Qgs|~kQ^!c~S-A`$g06Czefl1gJ<|Idkvot%e#VRf<;afk8D{SyxFP8K2PS>l z%Lp*E?ZyXfFDP5Hvh@VE;7(a_6f2px9_CJKl6GMDr-!!pA@i;5`iyGsNW(`TdG%cC zHC;Cu^|QXRVyZN87MD);pX`*3~m{qg;)K1Gi!=bom&?J_x)9!FW>XbPpq zJ!#uE{8uG4F+Lrfe+&Kp6T4m>oBsRxmbHJ+YPYV{o)-?DG2X!(rZSYp zm_eI~$M1GbMKJW0^v`!lbIa&K7j5r2w^7llVV-l~4c%vse?{cmk_#i$^ zdkgFj;&(?M#K&R#Vi>L-?X9ri{%hY6%-f&+x$g+MBxs1^SX@R?N+-`gRXE9e7WH?#?-g%M!H!+K3)B3$>-tJ;j>X;M0V z+tpgZt!ljGb&cka3SF89n?XP_rwTOpTE?&Et z+Kb2wx3kKtL)L4Zm)`Oc=0K<17VbIwfc&j>YWDbi{{uF? B;MV{E literal 0 HcmV?d00001 diff --git a/Effects/Dyes/StratusDyeShader.xnb b/Effects/Dyes/StratusDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..98f77a508ada2187cbd1156a284a84ac0a40b058 GIT binary patch literal 3620 zcmcguO=z2C9RI&bKhiceo0~eJV3Y|{YG}JwI^0ZLy1BBbwQ00?aAfJ*H7rePKG-Td zyfVQF9u#*`JVe-Gv>tMpdKt3A4h}Zl!NXu46mk&UVTgz#H2!|i^FHabx{k4f|MtoA z|NeUZ@AJO1ukJt5DLWq$aXxWg$>++YN@>0tn=NKz2g}(-_e80DJeDjKt8TFxJ1{@* z=Bm?fcFrviMmN)bxtv{E$mc49(Kp<3C0{D;8;uR|Z!nsy6{@weyRYchs^x59FgjH` zTFB=PyUR1B<8E=^_~=M(e*CCAJm-!Ljg9RVf^({0SPnx;z7m1f@aeRjQS9?lk5{76#lu8%eo`7&a#{C1oPOW)*8TLTy`sipGA7OH8LB>6_~ zlx4dyM^%@auXO%h%$Tuh+_%lJ%AK{ccQ$Y?Czjo*Y^5TsYsSqj6!Y)Y++h(stjdly z48?s1mVsSB_8J0v3TwflJ>Xwh^hMw|EczDkkZCIL0pQ~nodUjK(IIrGx~ z0gy>L1dnq~8W82Pau!HHI#rL^r?0TsBYnOBxeT1}BUTVvj&!x3VfHQ{A!Yj)aN4q$ z0o)o4w;ey^?Nq!j#T)c_{++VwD6jN;wDxHd^7x-$3CQFM;`2vtVv61Ivd&Wj$ zBjcl^vew$}Oidq1JAv7QYpp}=bNCJElgBw$=io^6SKtLK9xLPWPJSOtpN+2hoX@*} zJ)nAqIq-Sc6;Id6*{1D%_jkiRz41J1574vf$p`6ISf-}alSsV{oo#IW-m`gYtr1D4 zCTHyXz%uz?(Rl^G$Myba{Pg!%7Ke^pj_V|Tj_-JGV&*22udPq;u;?LFd$|_}aYQ$9!Gp!n3>$hyZxIzb?|* zBa!;)zn^*$qWI0omBh`+rzFl2;_Jt46oY_PDe(+aUR`?3|&i504LLae*326BE#}bOv4ekI(ofw0V7m`dJ zx#Qn~ex@PP^13DSCFKs}@axM1#61Ucyp!ta7hXBE5iaG=kzTJ?n!di4Q6GWs;Nf*w z??GJ53Pf6OJqPi6WCik8{b}SC5FIxRzx`M+P;mp2L97+uFLg4ov;AtG_G{#}U&hUN z#;?(XfB4DNQ4>Fvg1Du9-x*b-&L`7&OZ6;(+M19z8~9#T_28~o`umk_M9G~{vralF z5v41j=^N!kF7F|>Uq=Vz(r}O$`fu@8Hq=JF6;J1^al2=D11Y(wO~>k>Pt`L#PhhFD zZFIHqme;9r(*8IHHqD-Bn!ZK(*Ys9J<2%rwfo?D8&wwM{O6H(Po#0WQJjjs?dF*eu g!u#NVR`rxNtiP#xN1dSZ)AXpL<~9^jKKP9N3yI*+WB>pF literal 0 HcmV?d00001 diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs new file mode 100644 index 0000000000..a2444ed0b8 --- /dev/null +++ b/Items/Dyes/AstralBlueDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class AstralBlueDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralBlueDyeShader")), "DyePass"). + UseColor(new Color(109, 242, 197)).UseSecondaryColor(new Color(42, 147, 154)); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Astral Blue Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 9; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/AstralBlueDye.png b/Items/Dyes/AstralBlueDye.png new file mode 100644 index 0000000000000000000000000000000000000000..d752cde17bf38eb08b1522a7dff50f4780d11c59 GIT binary patch literal 425 zcmV;a0apHrP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0X|7YK~y+TWBmXB zKLZGe^J_yGM1q$euQGyYCNPfzfZ>Ad;!-eQROT<3e*J_QOvAv`-fl2WI~T~9T7vo7 z+#F!~>enA&8U~)6J`Sd-=K?J=N3hK;z0<$~8gimw8U}7WdJU!@KYt0PVPIxYBbcUM z7-*Y2ff?x~^i+AfdzC;_`x&`Tt4#=%0dM{3Ls%d zu?twf2}Aq}iFF2sNxZ+oblzuHFnw#&1u!k3ECQxsfDcMj>;kv}`yIK!7zRKtfw=|* zKHPl+#^`{0E&%x%=5G+to^lI}L4HT}znHcR7{dVNF5r6mk^zK4@eRU``@exP4B+xR z3{dO>cuM?~>IW7;_8&5Mb@d691p$1sH-Tx&T>#6CmioRB29e new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralOrangeDyeShader")), "DyePass"). + UseColor(new Color(255, 166, 94)).UseSecondaryColor(new Color(238, 93, 82)); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Astral Orange Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 9; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/AstralOrangeDye.png b/Items/Dyes/AstralOrangeDye.png new file mode 100644 index 0000000000000000000000000000000000000000..40ead0b2355b0b69e7d80674a2c11f4d6b11312e GIT binary patch literal 415 zcmV;Q0bu@#P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TAd;!-eQROT<3e*J_QOvAv`-fl2WI~T~9T7vo7 z+#F!~>enA&8U~)6J`Sd-=K?J=N3hK;z0<$~8gimw8U}7WdJU!@KYt0PVPIxYBbcUM z7-*Y2ff?x~^%0dNR7k`0i zie13sC#nHu-h)t)Nf3JZJTNumnG%?`_0mvmV*8sr@W<@YY z2b6~al!p5mX6t^($za+7OhQ}$0tT{>bi?otLQy{*z`%va;Dm new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/AstralSwirlDyeShader")), "DyePass"). + UseColor(new Color(42, 147, 154)).UseSecondaryColor(new Color(238, 93, 82)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Astral Swirl Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 9; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/AstralSwirlDye.png b/Items/Dyes/AstralSwirlDye.png new file mode 100644 index 0000000000000000000000000000000000000000..bccd69238197939c03369e50cddf0ee52e05e267 GIT binary patch literal 451 zcmV;!0X+VRP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940a!^yK~y+TWBmXB zKLZGe^J_yGM1q$euQGyYCNPfzfZ>Ad;!-eQROT<3e*J_QOvAv`-fl2WI~T~9T7vo7 z+#F!~>enA&8U~)6J`Sd-=K?J=N3hK;z0<$~8gimw8U}7WdJU!@KYt0PVPIxYBbcUM z7-*Y2ff?x~^%7TCkkHHo* zRK5ENrYUzpn{x@+1(nIKzyi1cx=Xw+{sPk!y8yQVkx5`IeM$q2b%ag87!(GuZ~y^{ zUBCjR85|`dpezWebDRvOmw-tIh8P25C<_%(FCB19$N~$%z^kiI!1RZ^Z@@GR2q=qy zX};N;z%<1!V3rYAYXC9c$x1SOef^1nTZ|7Z0ir?p@1H*m970@h406$r_um-!?>`2s tqdW{?xzSSJ7s4PC9KX1k8o7~y0RSX>cQ@}nq+ + /// Similar to SetDefaults, but always accounts for defining dye IDs + /// + public virtual void SafeSetDefaults() + { + } + /// + /// Similar to SetStaticDefaults, but always accounts for shader binding. + /// + public virtual void SafeSetStaticDefaults() + { + } + } +} \ No newline at end of file diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs new file mode 100644 index 0000000000..46e236aa59 --- /dev/null +++ b/Items/Dyes/CeaselessDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Items.Dyes +{ + public class CeaselessDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CeaselessDyeShader")), "DyePass"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.VoidDye); + recipe.AddIngredient(ItemID.ShadowDye); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/CeaselessDye.png b/Items/Dyes/CeaselessDye.png new file mode 100644 index 0000000000000000000000000000000000000000..edaae80f09cf3030ed5074309624e8eba337fc04 GIT binary patch literal 345 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB4uUY_j)~cCfr9TmT^vI!{FDFu|8LLC@uAbhQNpFkKYyNK zQ-+#BKU2d)CU0kZgLwB?KA-rVKRJ93ANcrr_5qWxu?Mu5aHn+`6gT{|nbei=>-6W} z2~uqL{?&6WTltJhEVo#F!`W`LwQSrOCpw!lC3bv#VLGGk&mYwpZHzPQUbQlwIr3#v zl|g)1kc`jb+cuk*3;M*{?(Fy4xIiI^X`7_jt|Lr|ZkYzY8@XpVeB|vePFaxhfah2X z!&AM6O9c&i#){Je-Z2G4x%|R3;MD@x?eWF>|L+dn7L|cbEALfhdV1Y ovbYijIN$BJ^X new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DefiledFlameDyeShader")), "DyePass"). + UseColor(new Color(106, 190, 48)).UseSecondaryColor(new Color(204, 248, 48)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Defiled Flame Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 4; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + } + } +} \ No newline at end of file diff --git a/Items/Dyes/DefiledFlameDye.png b/Items/Dyes/DefiledFlameDye.png new file mode 100644 index 0000000000000000000000000000000000000000..648497ccae05123f541704ea52d35ca90fb076d8 GIT binary patch literal 408 zcmV;J0cZY+P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz0WC>HK~y+TWBmXB zKLZG8Xy`x~IKcC#FQ6<4`1tt^BZy`K^C$oqE=aK#1M{Uc_`&qE8y~?m3^Xsh1g5F) z0)Ac*FvCb)7R(ouVgb{yp8WySFmUeXV=zrU7igI|f^BZ;ody=rkP`*dFmU71YcT!z z`AaYj12cOX!8G;4K-=62%t$Y(2lHhm#lbW#o3EbSN2M?@F*OIaB}-g43r?P$M@oFaQ9}C~gYSg!NVc0000 new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DragonSoulDyeShader")), "DyePass"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Dragon Soul Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/DragonSoulDye.png b/Items/Dyes/DragonSoulDye.png new file mode 100644 index 0000000000000000000000000000000000000000..bdb8ff2e4d0474a1283a20c0dea92afb0e4d5209 GIT binary patch literal 394 zcmV;50d@X~P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940Ut?3K~y+TWBmXB zKLZE^ajHTXM1pnSZ!>~uCNPfzzyhV=pl^pJm{!m(1Je(#c7bUaDDt=tWkCSNF2D!_ zw-9bHU)2yo-#-5pOvAvgH4r}4!hliB%n@vJOYbzWfQFnXn1+EHk6wf6$IoAaX&9K< z(+H-i7Y5qqPGClQNj;b^D=7}9aoK$JNR&0QJVGzQ{1r{(4{0pXEpZ*1=(ZQo9 ooM3v*r*B}Iau*D6sm#Ct028ic9`>AXoB#j-07*qoM6N<$g7FZS{Qv*} literal 0 HcmV?d00001 diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs new file mode 100644 index 0000000000..d4b0ea8770 --- /dev/null +++ b/Items/Dyes/EndothermicDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class EndothermicDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/EndothermicDyeShader")), "DyePass"). + UseColor(new Color(123, 205, 237)).UseSecondaryColor(new Color(85, 85, 171)); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Endothermic Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/EndothermicDye.png b/Items/Dyes/EndothermicDye.png new file mode 100644 index 0000000000000000000000000000000000000000..760d187983abe0ae8e2c774c06c488e10735dc71 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB_Jc5^1#7ShPy?5zi(`m|fAXLI|LvJMR%p(0lyGT^{_bzs zl%ZzO&(!dcNmEqUAl}cD%g27#cOIX^2R2(@KVb4UhJo2&dd>eYoIsJ^;r<6qzQ!y_ zea5kE=hAYi2nT0B5ukXl`}%`l9zWMVXu@;mO(x6bE8NVv#p(vidzZ+anLbs7{ql~S zeN{#BQx6@upQLyrO|o2ZLqo%S(HX~B^Ge?^U*0cQ&wN>AcSEP|v~I>0St*|b5^Ov@ zb&ZBr0+$~#Bugx~!x|vPcOkd!qhnqBPkG6J`>Zb#LT?Bf9AjPayos4N9jIP!PBL?{ zgad!A#DW{F5}FeQDoWq7&sY}a)$;rp!)aFmwuuRcKU!oxabsg+koumrtLW}^V_;A* Nc)I$ztaD0e0ss{(iERJ? literal 0 HcmV?d00001 diff --git a/Items/Dyes/AdrenalineHairDye.cs b/Items/Dyes/HairDye/AdrenalineHairDye.cs similarity index 93% rename from Items/Dyes/AdrenalineHairDye.cs rename to Items/Dyes/HairDye/AdrenalineHairDye.cs index ddd5fff709..6d07db5548 100644 --- a/Items/Dyes/AdrenalineHairDye.cs +++ b/Items/Dyes/HairDye/AdrenalineHairDye.cs @@ -2,7 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Dyes +namespace CalamityMod.Items.Dyes.HairDye { public class AdrenalineHairDye : ModItem { diff --git a/Items/Dyes/AdrenalineHairDye.png b/Items/Dyes/HairDye/AdrenalineHairDye.png similarity index 100% rename from Items/Dyes/AdrenalineHairDye.png rename to Items/Dyes/HairDye/AdrenalineHairDye.png diff --git a/Items/Dyes/RageHairDye.cs b/Items/Dyes/HairDye/RageHairDye.cs similarity index 93% rename from Items/Dyes/RageHairDye.cs rename to Items/Dyes/HairDye/RageHairDye.cs index 3524432ada..373d925b3c 100644 --- a/Items/Dyes/RageHairDye.cs +++ b/Items/Dyes/HairDye/RageHairDye.cs @@ -2,7 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Dyes +namespace CalamityMod.Items.Dyes.HairDye { public class RageHairDye : ModItem { diff --git a/Items/Dyes/RageHairDye.png b/Items/Dyes/HairDye/RageHairDye.png similarity index 100% rename from Items/Dyes/RageHairDye.png rename to Items/Dyes/HairDye/RageHairDye.png diff --git a/Items/Dyes/StealthHairDye.cs b/Items/Dyes/HairDye/StealthHairDye.cs similarity index 93% rename from Items/Dyes/StealthHairDye.cs rename to Items/Dyes/HairDye/StealthHairDye.cs index c9b96417a9..ef877f9d33 100644 --- a/Items/Dyes/StealthHairDye.cs +++ b/Items/Dyes/HairDye/StealthHairDye.cs @@ -2,7 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Dyes +namespace CalamityMod.Items.Dyes.HairDye { public class StealthHairDye : ModItem { diff --git a/Items/Dyes/StealthHairDye.png b/Items/Dyes/HairDye/StealthHairDye.png similarity index 100% rename from Items/Dyes/StealthHairDye.png rename to Items/Dyes/HairDye/StealthHairDye.png diff --git a/Items/Dyes/WingTimeHairDye.cs b/Items/Dyes/HairDye/WingTimeHairDye.cs similarity index 93% rename from Items/Dyes/WingTimeHairDye.cs rename to Items/Dyes/HairDye/WingTimeHairDye.cs index b2d2bad5a2..7f77cefa55 100644 --- a/Items/Dyes/WingTimeHairDye.cs +++ b/Items/Dyes/HairDye/WingTimeHairDye.cs @@ -2,7 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Dyes +namespace CalamityMod.Items.Dyes.HairDye { public class WingTimeHairDye : ModItem { diff --git a/Items/Dyes/WingTimeHairDye.png b/Items/Dyes/HairDye/WingTimeHairDye.png similarity index 100% rename from Items/Dyes/WingTimeHairDye.png rename to Items/Dyes/HairDye/WingTimeHairDye.png diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs new file mode 100644 index 0000000000..53386334ec --- /dev/null +++ b/Items/Dyes/NightmareDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class NightmareDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/NightmareDyeShader")), "DyePass"). + UseColor(new Color(249, 81, 0)).UseSecondaryColor(new Color(255, 203, 106)); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Nightmare Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/NightmareDye.png b/Items/Dyes/NightmareDye.png new file mode 100644 index 0000000000000000000000000000000000000000..93a142281b75f0e0a7cbe8c464cd7d32c4f44bf4 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB_Jc5^1#7ShPy@H8i(`m|fAXLI|LvJMHW;sRlyGU9|3BZb zDMQVmpQ+&?Q?<3bL3~F%m(Tv+KX`l&A2{gz`=H6&7zM?n?9V3yHVY5i_Jt)DZQO-EUjiF@r!kP*96aTrhnG`Te{n)4_*Hg%-wd=tT5stRT z?FTy85;Yw7Yb6%kV4a~kk>SV3A0{)FMR~P6KNj!UBfvJXA@^>5))O~2HiosUlEMo# S&t;ucLK6V?%Z_IN literal 0 HcmV?d00001 diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs new file mode 100644 index 0000000000..64d462cce1 --- /dev/null +++ b/Items/Dyes/ReaverDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class ReaverDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ReaverDyeShader")), "DyePass"). + UseColor(new Color(54, 164, 66)).UseSecondaryColor(new Color(224, 115, 65)); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Reaver Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 7; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/ReaverDye.png b/Items/Dyes/ReaverDye.png new file mode 100644 index 0000000000000000000000000000000000000000..aa8d35dd5c37c518e77ab5ebf9b71f277334820c GIT binary patch literal 419 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB4uLSEsD@VqP=kf1i(`m|fAXLI|LvJMW*9{|Nw_p!{@-uh zl%ZzO&(!d+>2f7gf?f05RF2vRaVO`-mrM8)W|ip`2#2tKUaVr*{4!O);-Cr7o2q(g zpWySXQE7b%v!kn)H?o>MaRG|osrVx0V_)}A$mj5ZGxOXGeD@k$Fe_&=zU2MtU`?cF zp+WEIXRFn}2Ws-LL_9rU_W5`tZ;C*92-{_Y4@LiDHMp7L?1Y#v%djixEuP0M)nD1b znvn4FtaX4G%Ym3nKO$s(#NX^^T$cHqNkU`275}oI@_*SbSL@a{WzJq2f6(Np-T?!K zC*=a)!uVN|C!967y^--%YvZjN(G3h%6*vCy`P5HIX1$!gWPd~Es#eB3toAYrnej32 zL}$3MNB=Ksd}(|><)F#eON=_^T$@fh14HKfez_oJb0Y%=1_Pan!?uZQKLP`m!PC{x JWt~$(697)Qod5s; literal 0 HcmV?d00001 diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs new file mode 100644 index 0000000000..deaeab1a52 --- /dev/null +++ b/Items/Dyes/ShadowspecDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class ShadowspecDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DragonSoulDyeShader")), "DyePass"). + UseColor(new Color(46, 27, 60)).UseSecondaryColor(new Color(132, 142, 191)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Shadowspec Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Developer; + item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/ShadowspecDye.png b/Items/Dyes/ShadowspecDye.png new file mode 100644 index 0000000000000000000000000000000000000000..e323537ca96107f8d5402303f51871e6da1ebf0c GIT binary patch literal 395 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB4uCLY*0oMfpaum`7sn6_|Kvaa|JyTjXmr19kUVu~Qi7e; zj^AG`r?4`X$HykJT=YqhV`VtZx-RHf!alS85;OMw`Y1Z1t?}-8y{61tI~&@41 new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/StratusDyeShader")), "DyePass"). + UseColor(new Color(36, 86, 163)).UseSecondaryColor(new Color(124, 204, 223)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Stratus Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/StratusDye.png b/Items/Dyes/StratusDye.png new file mode 100644 index 0000000000000000000000000000000000000000..c46981da4328409616f2efb5453cb828cfee4ed9 GIT binary patch literal 408 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRm!3HEhFR0}KQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB_Jc5^1#7ShP=l_gi(`m|fAXLI|LvJMIyy9+BwU)z*S|Av z%1|@tXKHxJr0kt;5bxl{;!|Jojm_uqft`=551PD42GcSZXt?%-fU$U;a7!A26}1sC>jY&%hrCd$*JSyi-d()) != -1, Item.buyPrice(0, 5)); } + // Because of the defiled condition, the dye trader does not receive an alert icon when hardmode starts. + if (type == NPCID.DyeTrader) + { + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode && CalamityWorld.defiled, Item.buyPrice(0, 10)); + } + if (type == NPCID.ArmsDealer) { SetShopItem(ref shop, ref nextSlot, ItemID.Stake, Main.LocalPlayer.HasItem(ModContent.ItemType())); From 8218d5c86c9321bd94baa007de1c136fa815b128 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 23:53:52 -0400 Subject: [PATCH 036/137] removed frosty flare destroyer resist --- NPCs/CalamityGlobalNPC.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6cc62dbe56..e040f62807 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3511,7 +3511,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.75); } From ebac335cfb766fbd99e9a2b085f8c8e5ea8aeb7e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 28 Apr 2020 23:56:33 -0400 Subject: [PATCH 037/137] lessend brimstone sword resist --- NPCs/CalamityGlobalNPC.cs | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e040f62807..71aef83209 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3522,22 +3522,16 @@ namespace CalamityMod.NPCs else if (projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.38); - } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - damage = (int)(damage * 0.25); - } - else if (projectile.type == ModContent.ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 1; - damage = (int)(damage * 0.1); } else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 1; - damage = (int)(damage * 0.01); + projectile.penetrate = 3; + damage = (int)(damage * 0.3); + } + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.25); } } else if (AquaticScourgeIDs.Contains(npc.type)) @@ -3549,16 +3543,16 @@ namespace CalamityMod.NPCs if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.5); - } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - damage = (int)(damage * 0.25); } else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 1; - damage = (int)(damage * 0.1); + projectile.penetrate = 3; + damage = (int)(damage * 0.3); + } + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.25); } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) From bf5b3de4b2a41cf6e5b80234aa57ccaec5af6809 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 00:18:43 -0400 Subject: [PATCH 038/137] old duke resistance tweaks --- NPCs/CalamityGlobalNPC.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 71aef83209..c8ed906725 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3575,7 +3575,7 @@ namespace CalamityMod.NPCs } else if (npc.type == ModContent.NPCType()) { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.2); } @@ -3583,11 +3583,11 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.6); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.75); } From b6440448bbd0affa3eccc2b73b3e0f6bf964bf7b Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 29 Apr 2020 03:13:42 -0500 Subject: [PATCH 039/137] Starfury star has less time left. Mana Overloader rework. Life steal code rework, which reworks the whole mechanic in Calamity as well. Refactors. --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 - Items/Accessories/ManaOverloader.cs | 3 +- Projectiles/CalamityGlobalProjectile.cs | 766 ++++++++---------- Projectiles/Healing/ManaOverloaderHealOrb.cs | 66 ++ Projectiles/Healing/ManaOverloaderHealOrb.png | Bin 0 -> 135 bytes 5 files changed, 409 insertions(+), 428 deletions(-) create mode 100644 Projectiles/Healing/ManaOverloaderHealOrb.cs create mode 100644 Projectiles/Healing/ManaOverloaderHealOrb.png diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 78c06f34ea..67f9f392bd 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2918,8 +2918,6 @@ namespace CalamityMod.CalPlayer if (modPlayer.manaOverloader) { player.magicDamage += 0.06f; - if (player.statMana < (int)(player.statManaMax2 * 0.1)) - player.ghostHeal = true; } if (modPlayer.twinsLore) diff --git a/Items/Accessories/ManaOverloader.cs b/Items/Accessories/ManaOverloader.cs index ab197dddde..36950b8cc8 100644 --- a/Items/Accessories/ManaOverloader.cs +++ b/Items/Accessories/ManaOverloader.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Mana Polarizer"); Tooltip.SetDefault("Increases max mana by 50 and magic damage by 6%\n" + "Life regen lowered by 3 if mana is above 50% of its maximum\n" + - "Spectre healing if mana is below 10% of its maximum"); + "Grants spectre healing, the amount healed scales with your mana\n" + + "The more mana you have, the more you heal"); } public override void SetDefaults() diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2179561dc5..8ce6635060 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2,8 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Projectiles.Magic; @@ -140,8 +139,8 @@ namespace CalamityMod.Projectiles { if (projectile.type == ProjectileID.Starfury) { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; + if (projectile.timeLeft > 45) + projectile.timeLeft = 45; if (projectile.ai[1] == 0f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -170,7 +169,7 @@ namespace CalamityMod.Projectiles projectile.localAI[0] = 1f; } - projectile.rotation += (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 * projectile.direction; if (projectile.ai[1] == 1f) { @@ -222,7 +221,7 @@ namespace CalamityMod.Projectiles 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(projectile.velocity.Y, projectile.velocity.X) + 1.57f; if (projectile.velocity.Y > 16f) projectile.velocity.Y = 16f; @@ -237,13 +236,13 @@ namespace CalamityMod.Projectiles { float num623 = 0.209439516f; float num624 = -2f; - float num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; + float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; projectile.velocity.Y -= num625; projectile.ai[0] += 1f; - num625 = (float)(Math.Cos((double)(num623 * projectile.ai[0])) - 0.5) * num624; + num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; projectile.velocity.Y += num625; @@ -287,19 +286,19 @@ namespace CalamityMod.Projectiles 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.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); projectile.width = (int)(num609 * projectile.scale); projectile.height = (int)(num610 * projectile.scale); - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; projectile.netUpdate = true; } if (projectile.ai[1] != -1f) { - projectile.scale = ((float)(num606 + num607) - projectile.ai[1]) * num608 / (float)(num607 + num606); + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); projectile.width = (int)(num609 * projectile.scale); projectile.height = (int)(num610 * projectile.scale); } @@ -328,10 +327,10 @@ namespace CalamityMod.Projectiles projectile.netUpdate = true; Vector2 center = projectile.Center; - center.Y -= (float)num610 * projectile.scale / 2f; + center.Y -= num610 * projectile.scale / 2f; - float num611 = ((float)(num606 + num607) - projectile.ai[1] + 1f) * num608 / (float)(num607 + num606); - center.Y -= (float)num610 * num611 / 2f; + float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); + center.Y -= 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); @@ -342,7 +341,7 @@ namespace CalamityMod.Projectiles 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[2] = projectile.width; Main.npc[num614].ai[3] = -1.5f; } } @@ -350,15 +349,15 @@ namespace CalamityMod.Projectiles 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; + float num616 = projectile.width / 5f * 2.5f; + float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X -= num617 * (float)-(float)projectile.direction; + projectile.position.X -= num617 * -projectile.direction; 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; + num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + projectile.position.X += num617 * -projectile.direction; } return false; } @@ -379,7 +378,7 @@ namespace CalamityMod.Projectiles { 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; + projectile.position = Main.npc[(int)projectile.ai[1]].Center + value22 - new Vector2(projectile.width, projectile.height) / 2f; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) @@ -400,7 +399,7 @@ namespace CalamityMod.Projectiles return false; } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 180f)) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / 180f) * 10f * num801; if (projectile.scale > num801) { projectile.scale = num801; @@ -412,7 +411,7 @@ namespace CalamityMod.Projectiles projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; - float num806 = (float)projectile.width; + float num806 = projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) @@ -445,7 +444,7 @@ 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); + Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(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; @@ -453,14 +452,14 @@ namespace CalamityMod.Projectiles } if (Main.rand.Next(5) == 0) { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * 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)); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); return false; } @@ -524,7 +523,7 @@ namespace CalamityMod.Projectiles } if (player.MinionDamage() != spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * player.MinionDamage()); + int damage2 = (int)(spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } } @@ -639,7 +638,7 @@ namespace CalamityMod.Projectiles { if (Main.npc[i].CanBeChasedBy(projectile, false)) { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); bool canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); @@ -698,13 +697,13 @@ namespace CalamityMod.Projectiles Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; if (Main.player[projectile.owner].direction != 1) { - vector24.X = (float)player.bodyFrame.Width - vector24.X; + vector24.X = player.bodyFrame.Width - vector24.X; } if (Main.player[projectile.owner].gravDir != 1f) { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + vector24.Y = player.bodyFrame.Height - vector24.Y; } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); @@ -752,14 +751,14 @@ namespace CalamityMod.Projectiles { for (int num252 = 0; num252 < 2; num252++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), 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 = new Vector2(Main.rand.Next(-100, 101), 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)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + value15 *= Main.rand.Next(70, 101) * 0.1f; + int shard = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), value15.X, value15.Y, 90, (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); Main.projectile[shard].ranged = false; } } @@ -792,45 +791,45 @@ namespace CalamityMod.Projectiles } } - if (!projectile.melee && (int)player.meleeEnchant > 0 && !projectile.noEnchantments) + if (!projectile.melee && player.meleeEnchant > 0 && !projectile.noEnchantments) { - if ((int)player.meleeEnchant == 7) //flask of party affects all types of weapons + if (player.meleeEnchant == 7) //flask of party affects all types of weapons { Vector2 velocity = projectile.velocity; - if ((double) velocity.Length() > 4.0) + if (velocity.Length() > 4.0) velocity *= 4f / velocity.Length(); if (Main.rand.NextBool(20)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(139, 143), velocity.X, velocity.Y, 0, new Color(), 1.2f); - Main.dust[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.01); + Main.dust[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); } if (Main.rand.NextBool(40)) { int Type = Main.rand.Next(276, 283); int index = Gore.NewGore(projectile.position, velocity, Type, 1f); - Main.gore[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.01); - Main.gore[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; - Main.gore[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; + Main.gore[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.01); + Main.gore[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.gore[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } } } - if (rogue && (int)player.meleeEnchant > 0 && !projectile.noEnchantments) + if (rogue && player.meleeEnchant > 0 && !projectile.noEnchantments) { - if ((int)player.meleeEnchant == 1 && Main.rand.NextBool(3)) + if (player.meleeEnchant == 1 && Main.rand.NextBool(3)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } - if ((int)player.meleeEnchant == 1) + if (player.meleeEnchant == 1) { if (Main.rand.NextBool(3)) { @@ -840,57 +839,57 @@ namespace CalamityMod.Projectiles Main.dust[index].velocity *= 0.25f; } } - else if ((int)player.meleeEnchant == 2) + else if (player.meleeEnchant == 2) { if (Main.rand.NextBool(2)) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, projectile.velocity.X * 0.2f + (float) (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } - else if ((int)player.meleeEnchant == 3) + else if (player.meleeEnchant == 3) { if (Main.rand.NextBool(2)) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f + (float) (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } - else if ((int)player.meleeEnchant == 4) + else if (player.meleeEnchant == 4) { if (Main.rand.NextBool(2)) { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.2f + (float) (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; } } - else if ((int)player.meleeEnchant == 5) + else if (player.meleeEnchant == 5) { if (Main.rand.NextBool(2)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].velocity.X += (float) projectile.direction; + Main.dust[index].velocity.X += projectile.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } - else if ((int)player.meleeEnchant == 6) + else if (player.meleeEnchant == 6) { if (Main.rand.NextBool(2)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].velocity.X += (float) projectile.direction; + Main.dust[index].velocity.X += projectile.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } - else if ((int)player.meleeEnchant == 8 && Main.rand.NextBool(4)) + else if (player.meleeEnchant == 8 && Main.rand.NextBool(4)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 46, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; @@ -960,7 +959,6 @@ namespace CalamityMod.Projectiles } #endregion - // TODO -- there are a LOT of returns here which should be breaks or gotos out of if statements #region OnHitNPC public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) { @@ -973,8 +971,9 @@ namespace CalamityMod.Projectiles { target.immune[projectile.owner] = 10; } + //flask of party affects all types of weapons, !projectile.melee is to prevent double flask effects - if (!projectile.melee && (int) player.meleeEnchant == 7) + if (!projectile.melee && player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, projectile.owner, 0f, 0f); if (rogue && stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 2) @@ -1001,13 +1000,13 @@ namespace CalamityMod.Projectiles for (int x = projTileX; x < projTileX + distance; x++) { Tile tile = Main.tile[projTileX, projTileY]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + if (tile.active() && (Main.tileSolid[tile.type] || tile.liquid != 0)) { projTileX = x; break; } } - int projectileIndex = Projectile.NewProjectile((float)(projTileX * 16 + 8), (float)(projTileY * 16 - 24), 0f, 0f, ModContent.ProjectileType(), 420, 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ModContent.ProjectileType(), 420, 15f, Main.myPlayer, 16f, 16f); Main.projectile[projectileIndex].Calamity().forceRogue = true; Main.projectile[projectileIndex].netUpdate = true; Main.projectile[projectileIndex].localNPCHitCooldown = 1; @@ -1024,15 +1023,15 @@ namespace CalamityMod.Projectiles if (player.setNebula && player.nebulaCD == 0 && Main.rand.Next(3) == 0) { player.nebulaCD = 30; - int boosterType = Utils.SelectRandom(Main.rand, new int[] + int boosterType = Utils.SelectRandom(Main.rand, new int[] { ItemID.NebulaPickup1, ItemID.NebulaPickup2, ItemID.NebulaPickup3 }); int nebulaBooster = Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, boosterType, 1, false, 0, false, false); - Main.item[nebulaBooster].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; - Main.item[nebulaBooster].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)projectile.direction; + Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; + Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * projectile.direction; if (Main.netMode == 1) { NetMessage.SendData(21, -1, -1, null, nebulaBooster, 0f, 0f, 0f, 0, 0, 0); @@ -1040,65 +1039,123 @@ namespace CalamityMod.Projectiles } } - // Increases the degree to which Spectre Healing set contributes to the lifesteal cap - if (player.ghostHeal) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != ModContent.NPCType()) { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + // Increases the degree to which Spectre Healing set contributes to the lifesteal cap + if (player.ghostHeal) { - return; + float num = 0.1f; + num -= projectile.numHits * 0.05f; + if (num < 0f) + num = 0f; + + float num2 = damage * num; + Main.player[Main.myPlayer].lifeSteal -= num2; } - float num = 0.1f; - num -= (float)projectile.numHits * 0.05f; - if (num < 0f) + + // Increases the degree to which Vampire Knives contribute to the lifesteal cap + if (projectile.type == ProjectileID.VampireKnife) { - num = 0f; + float num = damage * 0.0375f; + if (num < 0f) + num = 0f; + + Main.player[Main.myPlayer].lifeSteal -= num; + } + + if (modPlayer.vampiricTalisman && rogue && crit) + { + float heal = MathHelper.Clamp(damage * 0.015f, 0f, 6f); + Main.player[Main.myPlayer].lifeSteal -= heal * 2f; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, projectile.owner, heal); + } + + if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && rogue && stealthStrike) + { + player.statLife += 1; + player.HealEffect(1); + } + + if (modPlayer.auricSet) + { + float healMult = 0.05f; + healMult -= projectile.numHits * 0.025f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } + else if (modPlayer.silvaSet) + { + float healMult = 0.03f; + healMult -= projectile.numHits * 0.015f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } + else if (modPlayer.godSlayerMage) + { + float healMult = 0.06f; + healMult -= projectile.numHits * 0.015f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } + else if (modPlayer.tarraMage) + { + if (modPlayer.tarraMageHealCooldown <= 0) + { + modPlayer.tarraMageHealCooldown = 90; + + float healMult = 0.1f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + int healAmount = (int)heal; + player.statLife += healAmount; + player.HealEffect(healAmount); + + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } + } + else if (modPlayer.ataxiaMage) + { + float healMult = 0.1f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } + else if (modPlayer.manaOverloader) + { + float healMult = 0.2f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult * (player.statMana / player.statManaMax2); + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 2f); } - float num2 = (float)damage * num; - Main.player[Main.myPlayer].lifeSteal -= num2; } - // Increases the degree to which Vampire Knives contribute to the lifesteal cap - if (projectile.type == ProjectileID.VampireKnife) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - float num = (float)damage * 0.0375f; - if (num < 0f) - { - num = 0f; - } - Main.player[Main.myPlayer].lifeSteal -= num; - } - - if (modPlayer.vampiricTalisman && rogue && crit) - { - if (target.type == NPCID.TargetDummy) - return; - - float heal = (float)damage * 0.015f; - if ((int)heal == 0) - return; - if ((int)heal > 6) - heal = 6; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - Main.player[Main.myPlayer].lifeSteal -= heal * 2f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); - } - - if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && rogue && stealthStrike) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - player.statLife += 1; - player.HealEffect(1); - } + OTHEREFFECTS: if (modPlayer.alchFlask && (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) && @@ -1123,75 +1180,6 @@ namespace CalamityMod.Projectiles Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); } - if (modPlayer.auricSet && target.canGhostHeal) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - 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; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.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, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num14, num12); - } - else if (modPlayer.silvaSet && target.canGhostHeal) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - 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; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.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, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num14, num12); - } - if (projectile.magic) { if (modPlayer.silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) @@ -1199,8 +1187,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 -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= 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); @@ -1220,139 +1208,40 @@ namespace CalamityMod.Projectiles projectile.Damage(); } - if (modPlayer.tarraMage && target.canGhostHeal) - { - if (modPlayer.tarraMageHealCooldown <= 0) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (modPlayer.reaverBurst) + { + int num251 = Main.rand.Next(2, 5); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) { - return; + value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } - modPlayer.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; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - int healAmount = modPlayer.auricSet ? projectile.damage / 100 : projectile.damage / 50; - player.statLife += healAmount; - player.HealEffect(healAmount); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - } - } - - if (modPlayer.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)(projectile.damage * 0.15); - if (newDamage > 15) - { - newDamage = (int)((projectile.damage * 0.15 - 15) * 0.1) + 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 (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) - { + value15.Normalize(); + value15 *= Main.rand.Next(70, 101) * 0.1f; + int newDamage = (int)(projectile.damage * 0.15); + if (newDamage > 15) + { + newDamage = (int)((projectile.damage * 0.15 - 15) * 0.1) + 15; + } + int proj = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (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 (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) + { SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 20f); int num = (int)(projectile.damage * 0.5f); - modPlayer.ataxiaDmg += (float)num; - if (target.canGhostHeal) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - 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; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.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, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) - { + modPlayer.ataxiaDmg += num; + } + else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) + { SpawnOrb(projectile, modPlayer.auricSet ? 2f : 1.5f, ModContent.ProjectileType(), 800f, 20f); int num = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += (float)num; - if (target.canGhostHeal) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - float num11 = modPlayer.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; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.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, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num14, num12); - } - } + modPlayer.godSlayerDmg += num; + } } else if (projectile.melee) { @@ -1370,86 +1259,82 @@ namespace CalamityMod.Projectiles { if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { - if (Main.rand.NextBool(5)) + switch (Main.rand.Next(5)) { - SpawnOrb(projectile, 1.6f, ModContent.ProjectileType(), 800f, Main.rand.Next(15, 30)); - int num = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += (float)num; - } - else if (Main.rand.NextBool(4)) - { - SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 30f); - int num = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += (float)num; - if (target.canGhostHeal) - { - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + case 0: + + SpawnOrb(projectile, 1.6f, ModContent.ProjectileType(), 800f, Main.rand.Next(15, 30)); + int num = (int)(projectile.damage * 0.5f); + modPlayer.xerocDmg += num; + + break; + + case 1: + + SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 30f); + int num2 = (int)(projectile.damage * 0.5f); + modPlayer.xerocDmg += num2; + + if (target.canGhostHeal && Main.player[Main.myPlayer].lifeSteal > 0f) { - return; + float healMult = 0.06f; + healMult -= projectile.numHits * 0.015f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto SKIPXEROC; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); } - float num11 = 0.1f; - num11 -= (float)projectile.numHits * 0.05f; - if (num11 <= 0f) + + break; + + case 2: + + int newDamage = (int)(projectile.damage * 0.15); + if (newDamage > 40) { - return; + newDamage = (int)((projectile.damage * 0.15 - 40) * 0.1) + 40; } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + + break; + + case 3: + + int newDamage2 = (int)(projectile.damage * 0.2); + if (newDamage2 > 40) { - return; + newDamage = (int)((projectile.damage * 0.2 - 40) * 0.1) + 40; } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.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, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (Main.rand.NextBool(3)) - { - int newDamage = (int)(projectile.damage * 0.15); - if (newDamage > 40) - { - newDamage = (int)((projectile.damage * 0.15 - 40) * 0.1) + 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); - } - else if (Main.rand.NextBool(2)) - { - int newDamage = (int)(projectile.damage * 0.2); - if (newDamage > 40) - { - newDamage = (int)((projectile.damage * 0.2 - 40) * 0.1) + 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); - } - else - { - SpawnOrb(projectile, 1.2f, ModContent.ProjectileType(), 800f, 15f); - int num = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += (float)num; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage2, 0f, projectile.owner, 0f, 0f); + + break; + + case 4: + + SpawnOrb(projectile, 1.2f, ModContent.ProjectileType(), 800f, 15f); + int num3 = (int)(projectile.damage * 0.5f); + modPlayer.xerocDmg += num3; + + break; + + default: + break; } } + + SKIPXEROC: + if (modPlayer.featherCrown && stealthStrike && modPlayer.featherCrownCooldown <= 0) { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); float speedX = (target.Center.X - pos.X) / 30f; float speedY = (target.Center.Y - pos.Y) * 8; int dmg = (int)(15 + (projectile.damage * 0.05f)); - int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), dmg, 3, projectile.owner, 0f, (float)Main.rand.Next(15)); + int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), dmg, 3, projectile.owner, 0f, Main.rand.Next(15)); Main.projectile[feather].Calamity().forceRogue = true; modPlayer.featherCrownCooldown = 15; } @@ -1459,9 +1344,9 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (target.Center - pos) / 10f; - float AI1 = (float)Main.rand.Next(3); + float AI1 = Main.rand.Next(3); int dmg = (int)(150 + (projectile.damage * 0.05f)); int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, dmg, 3, projectile.owner, 0f, AI1); Main.projectile[flare].Calamity().forceRogue = true; @@ -1473,7 +1358,7 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (target.Center - pos) / 40f; int dmg = (int)(1000 + (projectile.damage * 0.05f)); int flare = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(),dmg, 3f, projectile.owner, 0f, 0f); @@ -1486,8 +1371,8 @@ namespace CalamityMod.Projectiles { for (int index2 = 0; index2 < 6; index2++) { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; + float xVector = Main.rand.Next(-35, 36) * 0.02f; + float yVector = Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; int dmg = (int)(75 + (projectile.damage * 0.05f)); @@ -1572,7 +1457,7 @@ namespace CalamityMod.Projectiles { SpawnOrb(projectile, 2f, ModContent.ProjectileType(), 800f, 15f, true); int num = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += (float)num; + modPlayer.godSlayerDmg += num; } //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery @@ -1584,6 +1469,7 @@ namespace CalamityMod.Projectiles ModContent.ProjectileType(), ModContent.ProjectileType() }; + if (summonExceptionList.TrueForAll(x => projectile.type != x)) { if (modPlayer.jellyDmg <= 0) @@ -1634,7 +1520,7 @@ namespace CalamityMod.Projectiles { SpawnOrb(projectile, 1.05f, ModContent.ProjectileType(), 800f, 15f); int num = (int)(projectile.damage * 0.5f); - modPlayer.jellyDmg += (float)num; + modPlayer.jellyDmg += num; } } @@ -1659,13 +1545,13 @@ namespace CalamityMod.Projectiles 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)); + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), 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 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + value15 *= Main.rand.Next(70, 101) * 0.1f; int newDamage = (int)(projectile.damage * 0.33); if (newDamage > 65) { @@ -1731,7 +1617,7 @@ namespace CalamityMod.Projectiles { spriteEffects = SpriteEffects.FlipHorizontally; } - Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.projFrames[projectile.type] / 2); Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); Color alpha15 = projectile.GetAlpha(color9); for (int num213 = 0; num213 < 4; num213++) @@ -1747,7 +1633,7 @@ namespace CalamityMod.Projectiles { position9.X = Main.player[Main.myPlayer].Center.X - num214; } - position9.X -= (float)(projectile.width / 2); + position9.X -= projectile.width / 2; if (num213 == 0 || num213 == 1) { position9.Y = Main.player[Main.myPlayer].Center.Y + num215; @@ -1758,9 +1644,9 @@ namespace CalamityMod.Projectiles } int frames = texture.Height / Main.projFrames[projectile.type]; int y = frames * projectile.frame; - position9.Y -= (float)(projectile.height / 2); + position9.Y -= 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 + projectile.gfxOffY), + new Vector2(position9.X - Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } } @@ -1790,7 +1676,7 @@ namespace CalamityMod.Projectiles for (int i = 0; i < projectile.oldPos.Length; i++) { Vector2 drawPos = projectile.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); Main.spriteBatch.Draw(texture, drawPos, rectangle, color, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); } break; @@ -1803,8 +1689,8 @@ namespace CalamityMod.Projectiles { Color color26 = color25; color26 = projectile.GetAlpha(color26); - float num164 = (float)(whyIsThisAlwaysEight - k); - color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + float num164 = whyIsThisAlwaysEight - k; + color26 *= num164 / (ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); Main.spriteBatch.Draw(texture, projectile.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, color26, projectile.rotation, rectangle.Size() / 2f, projectile.scale, spriteEffects, 0f); k += afterimageCounter; } @@ -1843,13 +1729,13 @@ namespace CalamityMod.Projectiles { for (int num252 = 0; num252 < 3; num252++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), 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 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + value15 *= Main.rand.Next(70, 101) * 0.1f; int newDamage = (int)(projectile.damage * 0.33); int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.LostSoulFriendly, newDamage, 0f, projectile.owner, 0f, 0f); Main.projectile[soul].Calamity().forceRogue = true; @@ -1895,8 +1781,38 @@ namespace CalamityMod.Projectiles } #endregion + #region LifeSteal + public static bool CanSpawnLifeStealProjectile(Projectile projectile, float healMultiplier, float healAmount) + { + if (healMultiplier <= 0f || (int)healAmount <= 0) + return false; + + return true; + } + + public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) + { + Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < Main.maxPlayers; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (Main.player[i].width / 2) - projectile.position.X + (projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (Main.player[i].height / 2) - projectile.position.Y + (projectile.height / 2)); + if (num15 < distanceRequired && (Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = Main.player[i].statLifeMax2 - Main.player[i].statLife; + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, healProjectileType, 0, 0f, projectile.owner, num14, healAmount); + } + #endregion + #region AI Shortcuts - public void SpawnOrb(Projectile projectile, float dmgMult, int projType, float distanceRequired, float N, bool gsPhantom = false) + public void SpawnOrb(Projectile projectile, float dmgMult, int projType, float distanceRequired, float N, bool gsPhantom = false) { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); @@ -1910,7 +1826,7 @@ namespace CalamityMod.Projectiles { 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)); + float num5 = Math.Abs(Main.npc[i].position.X + (Main.npc[i].width / 2) - projectile.position.X + (projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (Main.npc[i].height / 2) - projectile.position.Y + (projectile.height / 2)); if (num5 < distanceRequired) { if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) @@ -1940,13 +1856,13 @@ namespace CalamityMod.Projectiles num6 = array[Main.rand.Next(num3)]; } float num7 = N; - 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)); + float num8 = Main.rand.Next(-100, 101); + float num9 = Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); num10 = num7 / num10; num8 *= num10; num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, projType, (int)(num * dmgMult), 0f, projectile.owner, gsPhantom ? 0f : (float)num6, gsPhantom ? ai1 : 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, projType, (int)(num * dmgMult), 0f, projectile.owner, gsPhantom ? 0f : num6, gsPhantom ? ai1 : 0f); } public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) @@ -1959,7 +1875,7 @@ namespace CalamityMod.Projectiles { if (Main.npc[i].CanBeChasedBy(projectile, false)) { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); bool canHit = true; if (extraDistance < maxDistance && !ignoreTiles) @@ -1995,7 +1911,7 @@ namespace CalamityMod.Projectiles { if (Main.npc[i].CanBeChasedBy(projectile, false)) { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); bool canHit = true; if (extraDistance < maxDistance) @@ -2058,7 +1974,7 @@ namespace CalamityMod.Projectiles { Projectile proj = Main.projectile[index]; bool flag23 = Main.projPet[proj.type]; - if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < (float)projectile.width) + if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) { if (projectile.position.X < proj.position.X) { @@ -2082,20 +1998,20 @@ namespace CalamityMod.Projectiles float num16 = 0.5f; projectile.tileCollide = false; float range = 100f; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float xDist = player.position.X + (float)(player.width / 2) - vector3.X; - float yDist = player.position.Y + (float)(player.height / 2) - vector3.Y; - yDist += (float)Main.rand.Next(-10, 21); - xDist += (float)Main.rand.Next(-10, 21); + Vector2 vector3 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float xDist = player.position.X + (player.width / 2) - vector3.X; + float yDist = player.position.Y + (player.height / 2) - vector3.Y; + yDist += Main.rand.Next(-10, 21); + xDist += Main.rand.Next(-10, 21); //light pets lead the player, normal pets trail the player - xDist += (float)(60 * (lightPet ? (float)player.direction : -(float)player.direction)); + xDist += 60 * (lightPet ? player.direction : -player.direction); yDist -= 60f; - float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + float playerDist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); float num21 = 18f; //if player is close enough, resume normal if (playerDist < range && player.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && + projectile.position.Y + projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { if (projectile.velocity.Y < -6f) @@ -2107,8 +2023,8 @@ namespace CalamityMod.Projectiles //teleport to player if too far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (projectile.width / 2); + projectile.position.Y = player.Center.Y - (projectile.height / 2); projectile.netUpdate = true; } diff --git a/Projectiles/Healing/ManaOverloaderHealOrb.cs b/Projectiles/Healing/ManaOverloaderHealOrb.cs new file mode 100644 index 0000000000..beceb093f6 --- /dev/null +++ b/Projectiles/Healing/ManaOverloaderHealOrb.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Healing +{ + public class ManaOverloaderHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Overloader Heal Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 180; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 3f; + if (Main.player[num487].lifeMagnet) + num488 *= 1.5f; + + Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + 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(num489 * num489 + num490 * num490); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + 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, 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; + 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, 175, 0f, 0f, 100, default, 1.3f); + Main.dust[num500].noGravity = true; + 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/ManaOverloaderHealOrb.png b/Projectiles/Healing/ManaOverloaderHealOrb.png new file mode 100644 index 0000000000000000000000000000000000000000..15e877573779272f931ab67d818cf9f2b8911a17 GIT binary patch literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^EFjFm1|(O0oL2{=*pj^6T^Rm@;DWu&Cj&(|3p^r= z85sBugD~Uq{1qucLG}_)Usv`AZ0utE^0#a@0p%D(JY5_^IIbuE`TyUZ*(f2&fw_g1 Y;aDFttLt^E7eILiPgg&ebxsLQ0Jwf72LJ#7 literal 0 HcmV?d00001 From 0e686965265320bea1d68dc79c5aa96772cc9169 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 29 Apr 2020 06:53:35 -0500 Subject: [PATCH 040/137] Fixed some bugs with my previous refactors. Refactored several boss AIs. Fixed an issue with mana overloader mana scaling. --- NPCs/CalamityAI.cs | 50 +- NPCs/CalamityGlobalAI.cs | 1610 +++++++++++------------ Projectiles/CalamityGlobalProjectile.cs | 85 +- 3 files changed, 874 insertions(+), 871 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index b443233979..0e8a726a15 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -625,7 +625,7 @@ namespace CalamityMod.NPCs npc.defense = npc.defDefense; // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Variables for buffing the AI bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; @@ -1130,7 +1130,7 @@ namespace CalamityMod.NPCs Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Spawn phase 2 Cal if (lifeRatio <= 0.75f && Main.netMode != NetmodeID.MultiplayerClient && !phase2) @@ -2257,7 +2257,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Variables bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; @@ -2899,7 +2899,7 @@ namespace CalamityMod.NPCs // Calculate phases based on worm HP int astrumDeusTotalHP = 0; - double mainDeusHPRatio = npc.life / npc.lifeMax; + double mainDeusHPRatio = npc.life / (double)npc.lifeMax; if (calamityGlobalNPC.newAI[0] == 1f) { for (int i = 0; i < Main.maxNPCs; i++) @@ -3195,7 +3195,7 @@ namespace CalamityMod.NPCs } // Life remaining - float deusHPRatio = npc.life / npc.lifeMax; + float deusHPRatio = npc.life / (float)npc.lifeMax; // Only the smaller worm heads use this code if (head) @@ -3519,7 +3519,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.unbreakableDR = true; } - double lifeRatio = (double)npc.life / (double)npc.lifeMax; + double lifeRatio = npc.life / (double)npc.lifeMax; int lifePercentage = (int)(100.0 * lifeRatio); bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; @@ -3585,7 +3585,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; int numDust = (int)(0.2f * MathHelper.TwoPi * num474); - float angleIncrement = MathHelper.TwoPi / (float)numDust; + float angleIncrement = MathHelper.TwoPi / numDust; Vector2 dustOffset = new Vector2(num474, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); @@ -3604,9 +3604,9 @@ namespace CalamityMod.NPCs { 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); + float num476 = Main.player[num475].position.X + (Main.player[num475].width / 2); + float num477 = Main.player[num475].position.Y + (Main.player[num475].height / 2); + float num478 = Math.Abs(npc.position.X + (npc.width / 2) - num476) + Math.Abs(npc.position.Y + (npc.height / 2) - num477); if (num478 < num474) { @@ -3637,10 +3637,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X + Main.rand.Next(-20, 21); + float num943 = player.position.Y + player.height * 0.5f - vector104.Y + Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -3661,7 +3661,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < 12; i++) { float ai1 = player.ZoneDungeon ? 0f : 1f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, (float)(i * 30), ai1); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, i * 30, ai1); } } else @@ -3689,10 +3689,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num825 = player.position.X + (player.width / 2) - vector82.X; + float num826 = player.position.Y + (player.height / 2) - vector82.Y; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; @@ -3724,16 +3724,16 @@ namespace CalamityMod.NPCs } if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = (float)npc.lifeMax; + calamityGlobalNPC.newAI[0] = npc.lifeMax; if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.26); - if ((float)(npc.life + num660) < calamityGlobalNPC.newAI[0]) + int num660 = (int)(npc.lifeMax * 0.26); + if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) { - calamityGlobalNPC.newAI[0] = (float)npc.life; + calamityGlobalNPC.newAI[0] = npc.life; calamityGlobalNPC.newAI[2] += 1f; int glob = revenge ? 8 : 4; if (calamityGlobalNPC.newAI[0] <= 0.5f) @@ -3806,7 +3806,7 @@ namespace CalamityMod.NPCs npc.timeLeft = 1800; // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; @@ -5698,7 +5698,7 @@ namespace CalamityMod.NPCs npc.alpha = 255; // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Variables for buffing the AI bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index a42d5acc0c..9c2a1a35df 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -51,8 +51,8 @@ namespace CalamityMod.NPCs } 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; + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num4 = npc.direction * num / 2f; float num5 = -num / 2f; if (npc.velocity.X < num4) @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs 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 = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; float num11 = 0.7f; if (npc.collideX) @@ -108,9 +108,9 @@ namespace CalamityMod.NPCs npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -num11; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) npc.velocity.Y = -2f; } @@ -138,7 +138,7 @@ namespace CalamityMod.NPCs // Spawn crystal in phase 2 if (phase2 && !NPC.AnyNPCs(ModContent.NPCType())) { - Vector2 vector = npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)); + Vector2 vector = npc.Center + new Vector2(-40f, -(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); @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs 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].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 38); @@ -156,7 +156,7 @@ namespace CalamityMod.NPCs // Set up health value for spawning slimes if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = (float)npc.lifeMax; + npc.ai[3] = npc.lifeMax; // Spawn with attack delay if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs 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]; + bool flag11 = Main.tile[num239, num241].nactive() && Main.tileSolid[Main.tile[num239, num241].type] && !Main.tileSolidTop[Main.tile[num239, num241].type]; if (flag11) { num242 = 1; @@ -233,7 +233,7 @@ namespace CalamityMod.NPCs 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]; + bool flag12 = Main.tile[num239, num243].nactive() && Main.tileSolid[Main.tile[num239, num243].type] && !Main.tileSolidTop[Main.tile[num239, num243].type]; if (flag12) { num242--; @@ -253,8 +253,8 @@ namespace CalamityMod.NPCs if (flag13) { - npc.localAI[1] = (float)(num239 * 16 + 8); - npc.localAI[2] = (float)(num240 * 16 + 16); + npc.localAI[1] = num239 * 16 + 8; + npc.localAI[2] = num240 * 16 + 16; break; } } @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs if (num238 >= 100) { - Vector2 bottom = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; npc.localAI[1] = bottom.X; npc.localAI[2] = bottom.Y; } @@ -291,7 +291,7 @@ namespace CalamityMod.NPCs flag9 = true; if (npc.ai[0] == 60f) - Gore.NewGore(npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)), npc.velocity, 734, 1f); + Gore.NewGore(npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -363,7 +363,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; if (!flag8) @@ -373,16 +373,16 @@ namespace CalamityMod.NPCs npc.ai[0] += 9f; else { - if ((double)npc.life < (double)npc.lifeMax * 0.8 || death) + if (npc.life < npc.lifeMax * 0.8 || death) npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.6 || death) + if (npc.life < npc.lifeMax * 0.6 || death) npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.4 || death) + if (npc.life < npc.lifeMax * 0.4 || death) npc.ai[0] += 2f; } - if ((double)npc.life < (double)npc.lifeMax * 0.2 || death) + if (npc.life < npc.lifeMax * 0.2 || death) npc.ai[0] += 3f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (npc.life < npc.lifeMax * 0.1 || death) npc.ai[0] += 4f; if (npc.ai[0] >= 0f) @@ -402,7 +402,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 3f) { npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (phase2 ? 4f : 3.5f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 4f : 3.5f) * npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -412,7 +412,7 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 2f) { npc.velocity.Y = -6f * speedMult; - npc.velocity.X += (phase2 ? 5f : 4.5f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 5f : 4.5f) * npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -422,7 +422,7 @@ namespace CalamityMod.NPCs else { npc.velocity.Y = -8f * speedMult; - npc.velocity.X += (phase2 ? 4.5f : 4f) * (float)npc.direction; + npc.velocity.X += (phase2 ? 4.5f : 4f) * npc.direction; if (CalamityWorld.bossRushActive) npc.velocity.X *= 2f; @@ -438,8 +438,8 @@ namespace CalamityMod.NPCs // Change jump velocity else if (npc.target < Main.maxPlayers && ((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; + if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) + npc.velocity.X += (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * npc.direction; else npc.velocity.X *= CalamityWorld.bossRushActive ? 0.9f : 0.93f; } @@ -457,28 +457,28 @@ namespace CalamityMod.NPCs lifeRatio *= num234; if (lifeRatio != npc.scale) { - npc.position.X += (float)(npc.width / 2); - npc.position.Y += (float)npc.height; + npc.position.X += npc.width / 2; + npc.position.Y += 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; + npc.position.X -= npc.width / 2; + npc.position.Y -= 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]) + int num251 = (int)(npc.lifeMax * 0.05); + if (npc.life + num251 < npc.ai[3]) { - npc.ai[3] = (float)npc.life; + npc.ai[3] = 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 x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); int random = phase2 ? 10 : 8; int npcType = Main.rand.Next(random); @@ -525,9 +525,9 @@ namespace CalamityMod.NPCs 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].velocity.X = Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num255].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num255].ai[0] = -1000 * Main.rand.Next(3); Main.npc[num255].ai[1] = 0f; if (Main.netMode == NetmodeID.Server && num255 < Main.maxNPCs) @@ -554,7 +554,7 @@ namespace CalamityMod.NPCs float num5 = 20f; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool phase2 = lifeRatio < 0.85f || death; bool phase3 = lifeRatio < 0.75f || death; @@ -565,14 +565,14 @@ namespace CalamityMod.NPCs 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; + float num6 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num7 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float num8 = (float)Math.Atan2(num7, num6) + MathHelper.PiOver2; if (num8 < 0f) - num8 += 6.283f; - else if ((double)num8 > 6.283) - num8 -= 6.283f; + num8 += MathHelper.TwoPi; + else if (num8 > MathHelper.TwoPi) + num8 -= MathHelper.TwoPi; float num9 = 0f; if (npc.ai[0] == 0f && npc.ai[1] == 0f) @@ -591,14 +591,14 @@ namespace CalamityMod.NPCs if (npc.rotation < num8) { - if ((double)(num8 - npc.rotation) > 3.1415) + if ((num8 - npc.rotation) > MathHelper.Pi) npc.rotation -= num9; else npc.rotation += num9; } else if (npc.rotation > num8) { - if ((double)(npc.rotation - num8) > 3.1415) + if ((npc.rotation - num8) > MathHelper.Pi) npc.rotation += num9; else npc.rotation -= num9; @@ -607,15 +607,15 @@ namespace CalamityMod.NPCs 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; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; 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); + int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); Dust dust = Main.dust[num10]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; @@ -636,10 +636,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num13 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector.X; + float num14 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector.Y; + float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14); float num16 = num15; num15 = num11 / num15; @@ -692,9 +692,9 @@ namespace CalamityMod.NPCs 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)); + float num20 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector.X; + float num21 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector.Y; + float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); num22 = num19 / num22; Vector2 vector2 = vector; @@ -730,10 +730,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector4 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num25 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector4.X; + float num26 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector4.Y; + float num27 = (float)Math.Sqrt(num25 * num25 + num26 * num26); num27 = num24 / num27; npc.velocity.X = num25 * num27; @@ -751,16 +751,16 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= 40f) { npc.velocity *= 0.975f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; int num28 = 90; - if (npc.ai[2] >= (float)num28) + if (npc.ai[2] >= num28) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -795,7 +795,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 1f) { npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) + if (npc.ai[2] > 0.5) npc.ai[2] = 0.5f; } else @@ -809,10 +809,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector5 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num31 = Main.rand.Next(-200, 200); + float num32 = Main.rand.Next(-200, 200); + float num33 = (float)Math.Sqrt(num31 * num31 + num32 * num32); num33 = 8f / num33; Vector2 vector6 = vector5; @@ -854,34 +854,34 @@ namespace CalamityMod.NPCs 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); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 8, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } else { npc.defense = 6; - npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.4f : 1.2f)); + npc.damage = (int)(npc.defDamage * (phase5 ? 1.4f : 1.2f)); if (npc.ai[1] == 0f & phase5) npc.ai[1] = 5f; @@ -896,10 +896,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector8 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num39 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector8.X; + float num40 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120f - vector8.Y; + float num41 = (float)Math.Sqrt(num39 * num39 + num40 * num40); if (num41 > 400f) { @@ -974,10 +974,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num43 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector9.X; + float num44 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector9.Y; + float num45 = (float)Math.Sqrt(num43 * num43 + num44 * num44); num45 = num42 / num45; npc.velocity.X = num43 * num45; @@ -997,16 +997,16 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= num46) { npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; int num47 = 80; - if (npc.ai[2] >= (float)num47) + if (npc.ai[2] >= num47) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -1020,7 +1020,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && phase3) { npc.ai[1] = 3f; - npc.ai[3] += (float)Main.rand.Next(1, 4); + npc.ai[3] += Main.rand.Next(1, 4); } npc.netUpdate = true; @@ -1053,9 +1053,9 @@ namespace CalamityMod.NPCs 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; + Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (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; @@ -1072,17 +1072,17 @@ namespace CalamityMod.NPCs 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; + num49 *= 1f + Main.rand.Next(-10, 11) * 0.01f; + num50 *= 1f + Main.rand.Next(-10, 11) * 0.01f; - float num52 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); + float num52 = (float)Math.Sqrt(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; + npc.velocity.X += Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y += Main.rand.Next(-20, 21) * 0.1f; if (num53 < 100f) { @@ -1135,13 +1135,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= num60) { npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; float num61 = num60 + 13f; if (npc.ai[2] >= num61) @@ -1177,9 +1177,9 @@ namespace CalamityMod.NPCs 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; + Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + num62 - vector11.Y; bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; if (horizontalCharge) @@ -1188,11 +1188,11 @@ namespace CalamityMod.NPCs 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; + num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + num62 - vector11.X; + num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector11.Y; } - float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); + float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); num67 = num63 / num67; num65 *= num67; num66 *= num67; @@ -1227,10 +1227,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector.X; + float num21 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector.Y; + float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); num22 = num19 / num22; Vector2 vector2 = vector; @@ -1306,10 +1306,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; + float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50); num51 = num48 / num51; npc.velocity.X = num49 * num51; @@ -1337,13 +1337,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= num60) { npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; float num61 = num60 + 13f; if (npc.ai[2] >= num61) @@ -1377,7 +1377,7 @@ namespace CalamityMod.NPCs float totalSegments = death ? 73f : 63f; // Count segments remaining - float segmentCount = (float)(NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail)); // 2f to 65f + float segmentCount = 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); @@ -1390,7 +1390,7 @@ namespace CalamityMod.NPCs // Damage if (phase4 && npc.type == NPCID.EaterofWorldsHead) - npc.damage = (int)((float)npc.defDamage * (phase5 ? 1.2f : 1.1f)); + npc.damage = (int)(npc.defDamage * (phase5 ? 1.2f : 1.1f)); // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient && !phase5) @@ -1402,7 +1402,7 @@ namespace CalamityMod.NPCs { 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); + NPC.NewNPC((int)(npc.position.X + (npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (npc.height / 2) + npc.velocity.Y), NPCID.VileSpit, 0, 0f, 1f, 0f, 0f, 255); } } @@ -1422,10 +1422,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num349 *= num351; num350 *= num351; @@ -1435,7 +1435,7 @@ namespace CalamityMod.NPCs if (death) num419 += 2; int num420 = ProjectileID.CursedFlameHostile; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num418 / num351; num349 *= num351; num350 *= num351; @@ -1474,21 +1474,21 @@ namespace CalamityMod.NPCs 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); + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + 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); + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + 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); + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + 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[1] = npc.whoAmI; Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; npc.netUpdate = true; } @@ -1522,10 +1522,10 @@ namespace CalamityMod.NPCs { npc.type = NPCID.EaterofWorldsHead; int whoAmI = npc.whoAmI; - float num25 = (float)npc.life / (float)npc.lifeMax; + float num25 = npc.life / (float)npc.lifeMax; float num26 = npc.ai[0]; npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num25); + npc.life = (int)(npc.lifeMax * num25); npc.ai[0] = num26; npc.TargetClosest(true); npc.netUpdate = true; @@ -1534,10 +1534,10 @@ namespace CalamityMod.NPCs 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 num27 = npc.life / (float)npc.lifeMax; float num28 = npc.ai[1]; npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num27); + npc.life = (int)(npc.lifeMax * num27); npc.ai[1] = num28; npc.TargetClosest(true); npc.netUpdate = true; @@ -1550,9 +1550,9 @@ namespace CalamityMod.NPCs // Movement int num29 = (int)(npc.position.X / 16f) - 1; - int num30 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num30 = (int)((npc.position.X + npc.width) / 16f) + 2; int num31 = (int)(npc.position.Y / 16f) - 1; - int num32 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num32 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num29 < 0) num29 = 0; if (num30 > Main.maxTilesX) @@ -1570,12 +1570,12 @@ namespace CalamityMod.NPCs { 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)) + if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].nactive() && (Main.tileSolid[Main.tile[num33, num34].type] || (Main.tileSolidTop[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) + vector.X = num33 * 16; + vector.Y = num34 * 16; + if (npc.position.X + npc.width > vector.X && npc.position.X < vector.X + 16f && npc.position.Y + npc.height > vector.Y && npc.position.Y < vector.Y + 16f) { flag2 = true; if (Main.rand.NextBool(100) && Main.tile[num33, num34].nactive()) @@ -1628,34 +1628,34 @@ namespace CalamityMod.NPCs 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); + Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num39 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num40 = Main.player[npc.target].position.Y + (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 = (int)(num39 / 16f) * 16; + num40 = (int)(num40 / 16f) * 16; + vector2.X = (int)(vector2.X / 16f) * 16; + vector2.Y = (int)(vector2.Y / 16f) * 16; num39 -= vector2.X; num40 -= vector2.Y; - float num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (npc.ai[1] > 0f && npc.ai[1] < 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; + vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num39 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector2.X; + num40 = Main.npc[(int)npc.ai[1]].position.Y + (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)); + npc.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2; + num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); int num53 = npc.width; - num53 = (int)((float)num53 * npc.scale); - num52 = (num52 - (float)num53) / num52; + num53 = (int)(num53 * npc.scale); + num52 = (num52 - num53) / num52; num39 *= num52; num40 *= num52; npc.velocity = Vector2.Zero; @@ -1681,7 +1681,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.4) { if (npc.velocity.X < 0f) npc.velocity.X -= num38 * 1.1f; @@ -1718,7 +1718,7 @@ namespace CalamityMod.NPCs Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } - num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); float num55 = Math.Abs(num39); float num56 = Math.Abs(num40); float num57 = num37 / num52; @@ -1738,7 +1738,7 @@ namespace CalamityMod.NPCs if (flag5) { - if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) + if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) { npc.active = false; int num59 = (int)npc.ai[0]; @@ -1774,7 +1774,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num40) < 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; @@ -1782,7 +1782,7 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num39) < 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; @@ -1797,7 +1797,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num38; @@ -1812,7 +1812,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num38; @@ -1822,7 +1822,7 @@ namespace CalamityMod.NPCs } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (npc.type == NPCID.EaterofWorldsHead) { @@ -1866,11 +1866,11 @@ namespace CalamityMod.NPCs { 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); + num790 += Main.rand.Next(-npc.width, npc.width); + num791 += 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].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); Main.npc[num792].netUpdate = true; } } @@ -1900,19 +1900,19 @@ namespace CalamityMod.NPCs 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); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 392, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 393, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 394, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, 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; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -1929,7 +1929,7 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = false; // Deal no damage while spinning - npc.damage = spinning ? 0 : (int)((float)npc.defDamage * (phase5 ? 1.2f : 1f)); + npc.damage = spinning ? 0 : (int)(npc.defDamage * (phase5 ? 1.2f : 1f)); // Move towards target npc.TargetClosest(true); @@ -1947,7 +1947,7 @@ namespace CalamityMod.NPCs 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 num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); float velocityBoost = death ? 2f : 2f * (1f - lifeRatio); float num798 = 8f + velocityBoost; if (CalamityWorld.bossRushActive) @@ -2017,7 +2017,7 @@ namespace CalamityMod.NPCs 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.ai[3] = !spin ? 0f : Main.rand.Next(61); npc.localAI[1] = !spin ? 120f : 0f; npc.netUpdate = true; } @@ -2033,8 +2033,8 @@ namespace CalamityMod.NPCs // Velocity int var = 120; - float velocity = 6.28318548f / ((float)var * 0.75f); - npc.velocity = npc.velocity.RotatedBy((double)(-(double)velocity * npc.ai[1]), default); + float velocity = MathHelper.TwoPi / (var * 0.75f); + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1], default); npc.ai[2] += 1f; @@ -2066,7 +2066,7 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 12; num623++) @@ -2080,11 +2080,11 @@ namespace CalamityMod.NPCs // 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + 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)); + float num182 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; num182 *= num183; @@ -2094,11 +2094,11 @@ namespace CalamityMod.NPCs // 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)); + num180 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += (float)Main.rand.Next(-120, 121); + num180 += Main.rand.Next(-120, 121); num180 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, ModContent.ProjectileType(), 12, 0f, Main.myPlayer, 0f, 0f); } @@ -2200,8 +2200,8 @@ namespace CalamityMod.NPCs } npc.ai[3] = 0f; npc.ai[0] = npc.ai[0] == -7f ? -8f : -2f; - npc.ai[1] = (float)num801; - npc.ai[2] = (float)num802; + npc.ai[1] = num801; + npc.ai[2] = num802; npc.netUpdate = true; npc.netSpam = 0; Block_2784: @@ -2223,8 +2223,8 @@ namespace CalamityMod.NPCs 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); + npc.position.X = npc.ai[1] * 16f - (npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); Main.PlaySound(SoundID.Item8, npc.Center); npc.ai[0] = npc.ai[0] == -8f ? -9f : -3f; npc.netUpdate = true; @@ -2258,7 +2258,7 @@ namespace CalamityMod.NPCs npc.ai[0] = -4f; npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - npc.ai[3] = (float)Main.rand.Next(61); + npc.ai[3] = Main.rand.Next(61); } else { @@ -2298,8 +2298,8 @@ namespace CalamityMod.NPCs 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); + float num805 = (float)Math.Sqrt(num803 * num803 + num804 * num804); + float num806 = (CalamityWorld.bossRushActive ? 5f : 1f) + (creeperScale * 0.1f); if (CalamityWorld.bossRushActive) num806 *= 1.5f; @@ -2321,7 +2321,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { // Teleport location - npc.localAI[1] += 1f + ((float)creeperScale * 0.1f); + npc.localAI[1] += 1f + (creeperScale * 0.1f); if (npc.localAI[1] >= 300f) { npc.localAI[1] = 0f; @@ -2348,7 +2348,7 @@ namespace CalamityMod.NPCs 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)) + if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2(num810 * 16, num811 * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { break; } @@ -2358,8 +2358,8 @@ namespace CalamityMod.NPCs } } npc.ai[0] = 1f; - npc.ai[1] = (float)num810; - npc.ai[2] = (float)num811; + npc.ai[1] = num810; + npc.ai[2] = num811; npc.netUpdate = true; Block_2801: ; @@ -2375,8 +2375,8 @@ namespace CalamityMod.NPCs { 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.position.X = npc.ai[1] * 16f - (npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); npc.ai[0] = 2f; } } @@ -2439,7 +2439,7 @@ namespace CalamityMod.NPCs 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 num814 = (float)Math.Sqrt(num812 * num812 + num813 * num813); float velocity = 9f; if (CalamityWorld.bossRushActive) velocity *= 2f; @@ -2463,7 +2463,7 @@ namespace CalamityMod.NPCs // Charge at target int creeperScale = 21 - creeperCount; // 1 to 20 - npc.ai[1] += 0.5f + ((float)creeperScale * 0.25f); + npc.ai[1] += 0.5f + (creeperScale * 0.25f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) { npc.ai[1] = 0f; @@ -2471,7 +2471,7 @@ namespace CalamityMod.NPCs 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 = (float)Math.Sqrt(num812 * num812 + num813 * num813); num814 = velocity / num814; npc.velocity.X = num812 * num814; npc.velocity.Y = num813 * num814; @@ -2491,7 +2491,7 @@ namespace CalamityMod.NPCs 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)); + float num817 = (float)Math.Sqrt(num815 * num815 + num816 * num816); // Return to Brain if (num817 > 700f || (npc.justHit && !phase2)) @@ -2523,11 +2523,11 @@ namespace CalamityMod.NPCs } 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)) + if (CalamityWorld.bossRushActive || !Main.player[npc.target].ZoneJungle || Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16)) enrage = true; // Boost defense and damage as health decreases - int statBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + int statBoost = (int)(20f * (1f - npc.life / (float)npc.lifeMax)); if (death) { npc.defense = npc.defDefense + 20; @@ -2546,9 +2546,9 @@ namespace CalamityMod.NPCs // Despawn if (Main.player[npc.target].dead) { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + if (npc.position.Y < Main.worldSurface * 16.0 + 2000.0) npc.velocity.Y += 0.04f; - if (npc.position.X < (float)(Main.maxTilesX * 8)) + if (npc.position.X < (Main.maxTilesX * 8)) npc.velocity.X -= 0.04f; else npc.velocity.X += 0.04f; @@ -2584,8 +2584,8 @@ namespace CalamityMod.NPCs phase = 3; } } - while ((float)phase == num595); - npc.ai[0] = (float)phase; + while (phase == num595); + npc.ai[0] = phase; npc.ai[1] = 0f; npc.ai[2] = 0f; } @@ -2607,18 +2607,18 @@ namespace CalamityMod.NPCs speed += 8f; else { - if ((double)npc.life < (double)npc.lifeMax * 0.75 || death) + if (npc.life < npc.lifeMax * 0.75 || death) speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (npc.life < npc.lifeMax * 0.5 || death) speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) + if (npc.life < npc.lifeMax * 0.25 || death) speed += 2f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (npc.life < npc.lifeMax * 0.1 || death) speed += 2f; // Switch to a random phase if chargeAmt has been exceeded - if (npc.ai[1] > (float)(2 * chargeAmt) && npc.ai[1] % 2f == 0f) + if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) { npc.ai[0] = -1f; npc.ai[1] = 0f; @@ -2632,7 +2632,7 @@ namespace CalamityMod.NPCs { // Get target and initiate 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) + if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < 20f) { // Set AI variables and speed npc.localAI[0] = 1f; @@ -2640,10 +2640,10 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // 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)); + Vector2 vector74 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num599 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector74.X; + float num600 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector74.Y; + float num601 = (float)Math.Sqrt(num599 * num599 + num600 * num600); num601 = speed / num601; npc.velocity.X = num599 * num601; npc.velocity.Y = num600 * num601; @@ -2665,30 +2665,30 @@ namespace CalamityMod.NPCs } else { - if ((double)npc.life < (double)npc.lifeMax * 0.75 || death) + if (npc.life < npc.lifeMax * 0.75 || death) { num602 += 1f; num603 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (npc.life < npc.lifeMax * 0.5 || death) { num602 += 1f; num603 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) + if (npc.life < npc.lifeMax * 0.25 || death) { num602 += 2f; num603 += 0.05f; } } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (npc.life < npc.lifeMax * 0.1 || death) { 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)) + if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) npc.velocity.Y += num603; else npc.velocity.Y -= num603; @@ -2698,10 +2698,10 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > num602) 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))) > 500f) - npc.velocity.X += num603 * (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 -= num603 * (float)npc.direction; + if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) + npc.velocity.X += num603 * npc.direction; + else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) + npc.velocity.X -= num603 * npc.direction; else npc.velocity.X *= 0.8f; @@ -2732,18 +2732,18 @@ namespace CalamityMod.NPCs int num604 = 500; if (enrage) num604 = 225; - else if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) + else if (npc.life < npc.lifeMax * 0.33 || death) num604 = 300; - else if ((double)npc.life < (double)npc.lifeMax * 0.66) + else if (npc.life < npc.lifeMax * 0.66) num604 = 450; // 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)) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (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) + if (npc.direction == num605 && Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > num604) npc.ai[2] = 1f; // Keep moving @@ -2806,10 +2806,10 @@ namespace CalamityMod.NPCs // 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)); + Vector2 vector75 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num609 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector75.X; + float num610 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector75.Y; + float num611 = (float)Math.Sqrt(num609 * num609 + num610 * num610); // Go to bee spawn phase if (num611 < (death ? 400f : 300f)) @@ -2855,22 +2855,22 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector76 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector77 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; + float num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; + float num614 = (float)Math.Sqrt(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 || death) + npc.ai[1] += (playerNearBoss / 2); + if (npc.life < npc.lifeMax * 0.75 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (npc.life < npc.lifeMax * 0.5 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) + if (npc.life < npc.lifeMax * 0.25 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (npc.life < npc.lifeMax * 0.1 || death) npc.ai[1] += 0.25f; bool spawnBee = false; @@ -2889,7 +2889,7 @@ namespace CalamityMod.NPCs { int hornetAmt = CalamityMod.hornetList.Count; int spawnType = Main.rand.Next(210, 212); - if (npc.life < (double)npc.lifeMax * 0.66 || death) + if (npc.life < npc.lifeMax * 0.66 || death) spawnType = 210; int random = death ? 5 : 6; @@ -2897,8 +2897,8 @@ namespace CalamityMod.NPCs 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; + Main.npc[spawn].velocity.X = Main.rand.Next(-200, 201) * 0.002f; + Main.npc[spawn].velocity.Y = Main.rand.Next(-200, 201) * 0.002f; if (!CalamityMod.hornetList.Contains(spawnType)) Main.npc[spawn].localAI[0] = 60f; @@ -2913,9 +2913,9 @@ namespace CalamityMod.NPCs 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)); + num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; + num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; + num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); num614 = num617 / num614; if (npc.velocity.X < num612) @@ -2962,21 +2962,21 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector78 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector79 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; + float num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector79.Y; + float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); // Stinger fire counter npc.ai[1] += 1f; bool shoot = false; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || death || enrage) + if (npc.life < npc.lifeMax * 0.33 || death || enrage) { if (npc.ai[1] % 15f == 14f) shoot = true; } - else if (npc.life < (double)npc.lifeMax * 0.66) + else if (npc.life < npc.lifeMax * 0.66) { if (npc.ai[1] % 25f == 24f) shoot = true; @@ -2985,18 +2985,18 @@ namespace CalamityMod.NPCs 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)) + if (shoot && npc.position.Y + 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 || enrage || death) + if (npc.life < npc.lifeMax * 0.33 || enrage || death) num624 += 3f; - 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)); + float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; + float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; + float num627 = (float)Math.Sqrt(num625 * num625 + num626 * num626); num627 = num624 / num627; num625 *= num627; num626 *= num627; @@ -3016,8 +3016,8 @@ namespace CalamityMod.NPCs { 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; + num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; + num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector79.Y; if (npc.velocity.X < num621) { @@ -3103,7 +3103,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool phase2 = lifeRatio < 0.33f || death; @@ -3119,15 +3119,15 @@ namespace CalamityMod.NPCs 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); + int num155 = NPC.NewNPC((int)(npc.position.X + (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[1] = 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); + num155 = NPC.NewNPC((int)(npc.position.X + (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[1] = npc.whoAmI; Main.npc[num155].ai[3] = 150f; Main.npc[num155].target = npc.target; Main.npc[num155].netUpdate = true; @@ -3140,25 +3140,25 @@ namespace CalamityMod.NPCs 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); + int num155 = NPC.NewNPC((int)(npc.position.X + (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; if (death) Main.npc[num155].Calamity().newAI[0] = -1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].ai[3] = (death ? -75f : 0f); + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].ai[3] = death ? -75f : 0f; 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); + num155 = NPC.NewNPC((int)(npc.position.X + (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; if (death) Main.npc[num155].Calamity().newAI[0] = -1f; - Main.npc[num155].ai[1] = (float)npc.whoAmI; - Main.npc[num155].ai[3] = (death ? 75f : 150f); + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].ai[3] = death ? 75f : 150f; Main.npc[num155].target = npc.target; Main.npc[num155].netUpdate = true; } @@ -3204,7 +3204,7 @@ namespace CalamityMod.NPCs 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); + Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); // Fire magic bolt after teleport if (Main.netMode != NetmodeID.MultiplayerClient) @@ -3259,7 +3259,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 value53 = npc.Center + new Vector2(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(); @@ -3280,8 +3280,8 @@ namespace CalamityMod.NPCs 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); + calamityGlobalNPC.newAI[2] = num1458 * 16 - npc.width / 2; + calamityGlobalNPC.newAI[3] = num1459 * 16 - npc.height; break; } } @@ -3342,22 +3342,22 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[1] = 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)); + float num159 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector18.X; + float num160 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector18.Y; + float num161 = (float)Math.Sqrt(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 = phase2 ? 5f : 4f; 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)); + float num163 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X + Main.rand.Next(-20, 21); + float num164 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector18.Y + Main.rand.Next(-20, 21); + float num165 = (float)Math.Sqrt(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); + Vector2 vector19 = new Vector2(num163 * 1f + Main.rand.Next(-50, 51) * 0.01f, num164 * 1f + Main.rand.Next(-50, 51) * 0.01f); vector19.Normalize(); vector19 *= num162; vector19 += npc.velocity; @@ -3420,7 +3420,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -3429,7 +3429,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -3458,14 +3458,14 @@ namespace CalamityMod.NPCs 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)); + npc.rotation += npc.direction * 0.3f; + Vector2 vector20 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num173 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector20.X; + float num174 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector20.Y; + float num175 = (float)Math.Sqrt(num173 * num173 + num174 * num174); // Increase speed while charging - npc.damage = (int)((double)npc.defDamage * 1.3); + npc.damage = (int)(npc.defDamage * 1.3); float num176 = CalamityWorld.bossRushActive ? 10f : 4.5f; float velocityBoost = death ? 1f : 1f - lifeRatio; if (handsDead) @@ -3504,11 +3504,11 @@ namespace CalamityMod.NPCs { 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)); + npc.rotation += npc.direction * 0.3f; + Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; + float num178 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector21.Y; + float num179 = (float)Math.Sqrt(num177 * num177 + num178 * num178); num179 = 8f / num179; npc.velocity.X = num177 * num179; npc.velocity.Y = num178 * num179; @@ -3528,7 +3528,7 @@ namespace CalamityMod.NPCs // 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); + int num180 = Dust.NewDust(new Vector2(npc.position.X + (npc.width / 2) - 15f - npc.velocity.X * 5f, npc.position.Y + 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; @@ -3613,7 +3613,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; @@ -3622,7 +3622,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; @@ -3661,7 +3661,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.92f; @@ -3670,7 +3670,7 @@ namespace CalamityMod.NPCs 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.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.92f; @@ -3680,20 +3680,20 @@ namespace CalamityMod.NPCs } } - 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; + Vector2 vector22 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num182 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num184 = (float)Math.Sqrt(num182 * num182 + num183 * num183); + npc.rotation = (float)Math.Atan2(num183, num182) + MathHelper.PiOver2; 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; + Vector2 vector23 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num185 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); + npc.rotation = (float)Math.Atan2(num186, num185) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.2f; @@ -3704,10 +3704,10 @@ namespace CalamityMod.NPCs { 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)); + vector23 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num185 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector23.X; + num186 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector23.Y; + num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); num187 = 23f / num187; if (CalamityWorld.bossRushActive) @@ -3725,11 +3725,11 @@ namespace CalamityMod.NPCs } 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; + Vector2 vector24 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num188 = Main.npc[(int)npc.ai[1]].position.X + (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; + float num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); + npc.rotation = (float)Math.Atan2(num189, num188) + MathHelper.PiOver2; npc.velocity.Y *= 0.95f; npc.velocity.X += 0.2f * -npc.ai[0]; @@ -3738,14 +3738,14 @@ namespace CalamityMod.NPCs else 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) + if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (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)); + vector24 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num188 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector24.X; + num189 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector24.Y; + num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); num190 = 24f / num190; if (CalamityWorld.bossRushActive) @@ -3756,7 +3756,7 @@ namespace CalamityMod.NPCs 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.velocity == Vector2.Zero)) + else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || npc.velocity == Vector2.Zero)) npc.ai[2] = 0f; if (ModLoader.GetMod("FargowiltasSouls") != null) @@ -3774,7 +3774,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Despawn - if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) + if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) npc.active = false; // Set Wall of Flesh variables @@ -3786,7 +3786,7 @@ namespace CalamityMod.NPCs } // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP bool phase2 = lifeRatio < 0.66f || death; @@ -3812,21 +3812,21 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; npc.ai[1] = 0f; - if (npc.ai[2] > (float)num330) + if (npc.ai[2] > 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); + int num331 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1, 0f, 0f, 0f, 0f, 255); + Main.npc[num331].velocity.X = npc.direction * 9; } } // Play sound npc.localAI[3] += 1f; - if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) + if (npc.localAI[3] >= (600 + Main.rand.Next(1000))) { - npc.localAI[3] = (float)-(float)Main.rand.Next(200); + npc.localAI[3] = -Main.rand.Next(200); Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 10, 1f, 0f); } @@ -3835,8 +3835,8 @@ namespace CalamityMod.NPCs // 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 num333 = (int)((npc.position.X + npc.width) / 16f); + int num334 = (int)((npc.position.Y + (npc.height / 2)) / 16f); int num335 = 0; int num336 = num334 + 7; while (num335 < 15 && num336 > Main.maxTilesY - 200) @@ -3906,7 +3906,7 @@ namespace CalamityMod.NPCs } // Set Y velocity and position - float num339 = (float)((Main.wofB + Main.wofT) / 2 - npc.height / 2); + float num339 = (Main.wofB + Main.wofT) / 2 - npc.height / 2; if (npc.position.Y > num339 + 1f) npc.velocity.Y = -1f; @@ -3915,12 +3915,12 @@ namespace CalamityMod.NPCs npc.velocity.Y = 0f; int num340 = (Main.maxTilesY - 180) * 16; - if (num339 < (float)num340) - num339 = (float)num340; + if (num339 < num340) + num339 = num340; npc.position.Y = num339; - float targetPosition = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float npcPosition = npc.position.X + (float)(npc.width / 2); + float targetPosition = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float npcPosition = npc.position.X + (npc.width / 2); // Speed up if target is too far or if they're hiding behind tiles, slow down if too close float distanceFromTarget; @@ -4006,7 +4006,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X == 0f) { npc.TargetClosest(true); - npc.velocity.X = (float)npc.direction; + npc.velocity.X = npc.direction; } if (npc.velocity.X < 0f) { @@ -4021,23 +4021,23 @@ namespace CalamityMod.NPCs // 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)); + Vector2 vector37 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num342 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector37.X; + float num343 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector37.Y; + float num344 = (float)Math.Sqrt(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; + if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) + npc.rotation = (float)Math.Atan2(-num343, -num342) + MathHelper.Pi; 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 if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) + npc.rotation = (float)Math.Atan2(num343, num342) + MathHelper.Pi; else npc.rotation = 0f; @@ -4059,7 +4059,7 @@ namespace CalamityMod.NPCs chance = (chance * 3 + 60) / 4; // Range of 60 to 268 - chance = (int)((double)chance * 2D); + chance = (int)(chance * 2D); if (Main.rand.Next(chance) == 0) { @@ -4081,7 +4081,7 @@ namespace CalamityMod.NPCs for (int num349 = 0; num349 < 1000; num349++) { int num350 = Main.rand.Next(10); - float num351 = (float)num350 * 0.1f - 0.05f; + float num351 = num350 * 0.1f - 0.05f; bool flag29 = true; for (int num352 = 0; num352 < num346; num352++) { @@ -4100,7 +4100,7 @@ namespace CalamityMod.NPCs 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; + Main.npc[num353].ai[0] = num348 * 0.1f - 0.05f; } } } @@ -4111,24 +4111,24 @@ namespace CalamityMod.NPCs { npc.localAI[0] = 2f; - num339 = (float)((Main.wofB + Main.wofT) / 2); - num339 = (num339 + (float)Main.wofT) / 2f; + num339 = (Main.wofB + Main.wofT) / 2; + num339 = (num339 + 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; + num339 = (Main.wofB + Main.wofT) / 2; + num339 = (num339 + 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; + num339 = (Main.wofB + Main.wofT) / 2; + num339 = (num339 + 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; + Main.npc[num354].ai[0] = num355 * 0.1f - 0.05f; num = num355; } } @@ -4165,12 +4165,12 @@ namespace CalamityMod.NPCs npc.direction = Main.npc[Main.wof].direction; npc.spriteDirection = npc.direction; - float num356 = (float)((Main.wofB + Main.wofT) / 2); + float num356 = (Main.wofB + Main.wofT) / 2; if (npc.ai[0] > 0f) - num356 = (num356 + (float)Main.wofT) / 2f; + num356 = (num356 + Main.wofT) / 2f; else - num356 = (num356 + (float)Main.wofB) / 2f; - num356 -= (float)(npc.height / 2); + num356 = (num356 + Main.wofB) / 2f; + num356 -= npc.height / 2; if (npc.position.Y > num356 + 1f) npc.velocity.Y = -1f; @@ -4187,10 +4187,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector38 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num357 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector38.X; + float num358 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector38.Y; + float num359 = (float)Math.Sqrt(num357 * num357 + num358 * num358); num357 *= num359; num358 *= num359; @@ -4198,16 +4198,16 @@ namespace CalamityMod.NPCs 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; + if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) > npc.position.X + (npc.width / 2)) + npc.rotation = (float)Math.Atan2(-num358, -num357) + MathHelper.Pi; 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 if (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) < npc.position.X + (npc.width / 2)) + npc.rotation = (float)Math.Atan2(num358, num357) + MathHelper.Pi; else { npc.rotation = 0f; @@ -4218,7 +4218,7 @@ namespace CalamityMod.NPCs 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; + float lifeRatio = Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; float shootBoost = death ? 3f : 4f * (1f - lifeRatio); npc.localAI[1] += 1f + shootBoost; @@ -4250,10 +4250,10 @@ namespace CalamityMod.NPCs damage += 2; 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)); + vector38 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num357 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector38.X; + num358 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector38.Y; + num359 = (float)Math.Sqrt(num357 * num357 + num358 * num358); num359 = velocity / num359; num357 *= num359; num358 *= num359; @@ -4283,7 +4283,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[1] += 1f; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on life percentage bool phase2 = lifeRatio < 0.66f || death; @@ -4384,7 +4384,7 @@ namespace CalamityMod.NPCs // Spawn segments from head if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) { - npc.ai[3] = (float)npc.whoAmI; + npc.ai[3] = npc.whoAmI; npc.realLife = npc.whoAmI; int num2 = npc.whoAmI; @@ -4395,11 +4395,11 @@ namespace CalamityMod.NPCs 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; + int num5 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[3] = npc.whoAmI; Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)num5; + Main.npc[num5].ai[1] = num2; + Main.npc[num2].ai[0] = num5; NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); num2 = num5; } @@ -4409,14 +4409,14 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > (flyAtTarget ? 320f : 80f)) { // Laser rate of fire - int shootTime = 1 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 7D : 3D) * (double)lifeRatio); + int shootTime = 1 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 7D : 3D) * lifeRatio); if (CalamityWorld.bossRushActive) shootTime += 1; - calamityGlobalNPC.newAI[0] += (float)Main.rand.Next(shootTime); + calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); int randomCount = death ? Main.rand.Next(1470, 27300) : Main.rand.Next(1330, 24700); - if (calamityGlobalNPC.newAI[0] >= (float)randomCount) + if (calamityGlobalNPC.newAI[0] >= randomCount) { calamityGlobalNPC.newAI[0] = 0f; npc.TargetClosest(true); @@ -4481,10 +4481,10 @@ namespace CalamityMod.NPCs damage += 2; // Get target vector - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = player.position.X + (float)player.width * 0.5f - vector.X; - float num7 = player.position.Y + (float)player.height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num6 = player.position.X + player.width * 0.5f - vector.X; + float num7 = player.position.Y + player.height * 0.5f - vector.Y; + float num8 = (float)Math.Sqrt(num6 * num6 + num7 * num7); num8 = projectileSpeed / num8; num6 *= num8; num7 *= num8; @@ -4512,9 +4512,9 @@ namespace CalamityMod.NPCs } int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num13 = (int)((npc.position.X + npc.width) / 16f) + 2; int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num15 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num12 < 0) num12 = 0; @@ -4533,12 +4533,12 @@ namespace CalamityMod.NPCs { 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)) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].type] || (Main.tileSolidTop[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) + vector2.X = k * 16; + vector2.Y = l * 16; + if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) { flag2 = true; break; @@ -4552,7 +4552,7 @@ namespace CalamityMod.NPCs 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); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); npc.localAI[1] = 1f; @@ -4593,13 +4593,13 @@ namespace CalamityMod.NPCs flag2 = false; npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) { npc.velocity.Y += 1f; fallSpeed = 32f; } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if (npc.position.Y > Main.rockLayer * 16.0) { for (int n = 0; n < Main.maxNPCs; n++) { @@ -4623,31 +4623,31 @@ namespace CalamityMod.NPCs 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 = player.position.X + (float)(player.width / 2); - float num21 = player.position.Y + (float)(player.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); + Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num20 = player.position.X + (player.width / 2); + float num21 = player.position.Y + (player.height / 2); + num20 = (int)(num20 / 16f) * 16; + num21 = (int)(num21 / 16f) * 16; + vector3.X = (int)(vector3.X / 16f) * 16; + vector3.Y = (int)(vector3.Y / 16f) * 16; num20 -= vector3.X; num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (npc.ai[1] > 0f && npc.ai[1] < 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; + vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (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)); + npc.rotation = (float)Math.Atan2(num21, num20) + MathHelper.PiOver2; + num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; + num22 = (num22 - num23) / num22; num20 *= num22; num21 *= num22; npc.velocity = Vector2.Zero; @@ -4664,7 +4664,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.4) { if (npc.velocity.X < 0f) npc.velocity.X -= speed * 1.1f; @@ -4700,7 +4700,7 @@ namespace CalamityMod.NPCs Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); float num25 = Math.Abs(num20); float num26 = Math.Abs(num21); float num27 = fallSpeed / num22; @@ -4725,7 +4725,7 @@ namespace CalamityMod.NPCs if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) { if (npc.velocity.X == 0f) - npc.velocity.X -= (float)npc.direction; + npc.velocity.X -= npc.direction; npc.velocity.X *= 1.1f; } @@ -4762,14 +4762,14 @@ namespace CalamityMod.NPCs 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 (Math.Abs(num21) < 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 (Math.Abs(num20) < 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; @@ -4784,7 +4784,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += speed; @@ -4799,7 +4799,7 @@ namespace CalamityMod.NPCs 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 ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += speed; @@ -4810,7 +4810,7 @@ namespace CalamityMod.NPCs } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (npc.type == NPCID.TheDestroyer) { @@ -4858,32 +4858,32 @@ namespace CalamityMod.NPCs if (CalamityGlobalNPC.fireEye != -1) spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - bool enrage = (double)npc.life < (double)npc.lifeMax * (death ? 0.5 : 0.25); + bool enrage = npc.life < npc.lifeMax * (death ? 0.5 : 0.25); // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret if (npc.target < 0 || npc.target == Main.maxPlayers || 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 + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num377 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float num378 = (float)Math.Atan2((double)num377, (double)num376) + 1.57f; + float num378 = (float)Math.Atan2(num377, num376) + MathHelper.PiOver2; if (num378 < 0f) - num378 += 6.283f; - else if ((double)num378 > 6.283) - num378 -= 6.283f; + num378 += MathHelper.TwoPi; + else if (num378 > MathHelper.TwoPi) + num378 -= MathHelper.TwoPi; float num379 = 0.1f; if (npc.rotation < num378) { - if ((double)(num378 - npc.rotation) > 3.1415) + if ((num378 - npc.rotation) > MathHelper.Pi) npc.rotation -= num379; else npc.rotation += num379; } else if (npc.rotation > num378) { - if ((double)(npc.rotation - num378) > 3.1415) + if ((npc.rotation - num378) > MathHelper.Pi) npc.rotation += num379; else npc.rotation -= num379; @@ -4893,16 +4893,16 @@ namespace CalamityMod.NPCs npc.rotation = num378; if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; 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); + int num380 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); Dust dust = Main.dust[num380]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; @@ -4941,13 +4941,13 @@ namespace CalamityMod.NPCs } int num384 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + 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)); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num385 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num384 * 300) - vector40.X; + float num386 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector40.Y; + float num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); float num388 = num387; num387 = num382 / num387; @@ -4989,7 +4989,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num388 < 400f) + else if (npc.position.Y + npc.height < Main.player[npc.target].position.Y && num388 < 400f) { if (!Main.player[npc.target].dead) npc.ai[3] += 1f; @@ -4997,9 +4997,9 @@ namespace CalamityMod.NPCs 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; + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num385 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector40.X; + num386 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5009,7 +5009,7 @@ namespace CalamityMod.NPCs num390 += 2; int num391 = ProjectileID.EyeLaser; - num387 = (float)Math.Sqrt((double)(num385 * num385 + num386 * num386)); + num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); num387 = num389 / num387; num385 *= num387; num386 *= num387; @@ -5026,10 +5026,10 @@ namespace CalamityMod.NPCs { 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)); + Vector2 vector41 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num394 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector41.X; + float num395 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector41.Y; + float num396 = (float)Math.Sqrt(num394 * num394 + num395 * num395); num396 = num393 / num396; npc.velocity.X = num394 * num396; npc.velocity.Y = num395 * num396; @@ -5041,17 +5041,17 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= 25f) { npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) { npc.velocity.X = 0f; } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; if (npc.ai[2] >= 70f) { @@ -5070,7 +5070,7 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - if ((double)npc.life < (double)npc.lifeMax * 0.7 || targetFloatingUp || death) + if (npc.life < npc.lifeMax * 0.7 || targetFloatingUp || death) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -5085,7 +5085,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 1f) { npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) + if (npc.ai[2] > 0.5) npc.ai[2] = 0.5f; } else @@ -5110,15 +5110,15 @@ namespace CalamityMod.NPCs 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); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 143, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); num = num398; } @@ -5126,13 +5126,13 @@ 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } else @@ -5147,7 +5147,7 @@ namespace CalamityMod.NPCs int defenseGain = spazInPhase1 ? 9999 : 20; npc.chaseable = !spazInPhase1; - npc.damage = (int)((double)npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.5); npc.defense = npc.defDefense + defenseGain; npc.HitSound = SoundID.NPCHit4; @@ -5162,10 +5162,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector42 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num401 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector42.X; + float num402 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector42.Y; + float num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); num403 = num399 / num403; num401 *= num403; num402 *= num403; @@ -5213,10 +5213,10 @@ namespace CalamityMod.NPCs 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; + vector42 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num401 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector42.X; + num402 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector42.Y; + npc.rotation = (float)Math.Atan2(num402, num401) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5233,7 +5233,7 @@ namespace CalamityMod.NPCs num405 += 3; int num406 = ProjectileID.DeathLaser; - num403 = (float)Math.Sqrt((double)(num401 * num401 + num402 * num402)); + num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); num403 = num404 / num403; num401 *= num403; num402 *= num403; @@ -5257,7 +5257,7 @@ namespace CalamityMod.NPCs 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) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) num408 = -1; float num409 = 9.5f; @@ -5268,10 +5268,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector43 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num411 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num408 * 340) - vector43.X; + float num412 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector43.Y; + float num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); num413 = num409 / num413; num411 *= num413; num412 *= num413; @@ -5301,10 +5301,10 @@ namespace CalamityMod.NPCs 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; + vector43 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num411 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector43.X; + num412 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector43.Y; + npc.rotation = (float)Math.Atan2(num412, num411) - MathHelper.PiOver2; // Enrage if (targetFloatingUp) @@ -5328,7 +5328,7 @@ namespace CalamityMod.NPCs num415 += 2; int num416 = ProjectileID.DeathLaser; - num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412)); + num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); num413 = num414 / num413; num411 *= num413; num412 *= num413; @@ -5375,10 +5375,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector47 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num451 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector47.X; + float num452 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector47.Y; + float num453 = (float)Math.Sqrt(num451 * num451 + num452 * num452); num453 = num450 / num453; npc.velocity.X = num451 * num453; npc.velocity.Y = num452 * num453; @@ -5397,14 +5397,14 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= chargeTime) { npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; float fireRate = spazAlive ? 13f : 9f; if (CalamityWorld.bossRushActive) @@ -5412,10 +5412,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5427,10 +5427,10 @@ namespace CalamityMod.NPCs num354 += 3; int num355 = ModContent.ProjectileType(); - 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)); + vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num353 / num351; num349 *= num351; num350 *= num351; @@ -5472,13 +5472,13 @@ namespace CalamityMod.NPCs } int num408 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + 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)); + Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num62 * num408) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector11.Y; + float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); num67 = num63 / num67; num65 *= num67; @@ -5545,33 +5545,33 @@ namespace CalamityMod.NPCs if (CalamityGlobalNPC.laserEye != -1) retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - bool enrage = (double)npc.life < (double)npc.lifeMax * (death ? 0.5 : 0.25); + bool enrage = npc.life < npc.lifeMax * (death ? 0.5 : 0.25); // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || 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 num418 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num419 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); - float num420 = (float)Math.Atan2((double)num419, (double)num418) + 1.57f; + float num420 = (float)Math.Atan2(num419, num418) + MathHelper.PiOver2; if (num420 < 0f) - num420 += 6.283f; - else if ((double)num420 > 6.283) - num420 -= 6.283f; + num420 += MathHelper.TwoPi; + else if (num420 > MathHelper.TwoPi) + num420 -= MathHelper.TwoPi; float num421 = 0.15f; if (npc.rotation < num420) { - if ((double)(num420 - npc.rotation) > 3.1415) + if ((num420 - npc.rotation) > MathHelper.Pi) npc.rotation -= num421; else npc.rotation += num421; } else if (npc.rotation > num420) { - if ((double)(npc.rotation - num420) > 3.1415) + if ((npc.rotation - num420) > MathHelper.Pi) npc.rotation += num421; else npc.rotation -= num421; @@ -5581,9 +5581,9 @@ namespace CalamityMod.NPCs npc.rotation = num420; if (npc.rotation < 0f) - npc.rotation += 6.283f; - else if ((double)npc.rotation > 6.283) - npc.rotation -= 6.283f; + npc.rotation += MathHelper.TwoPi; + else if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; if (npc.rotation > num420 - num421 && npc.rotation < num420 + num421) npc.rotation = num420; @@ -5591,7 +5591,7 @@ namespace CalamityMod.NPCs // 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); + int num422 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(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; @@ -5638,13 +5638,13 @@ namespace CalamityMod.NPCs } int num426 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + 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)); + Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num426 * 400) - vector44.X; + float num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; + float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); num429 = num424 / num429; num427 *= num429; @@ -5695,9 +5695,9 @@ namespace CalamityMod.NPCs 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; + vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector44.X; + num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float num430 = CalamityWorld.bossRushActive ? 20f : 15f; @@ -5706,12 +5706,12 @@ namespace CalamityMod.NPCs num431 += 3; int num432 = ProjectileID.CursedFlameHostile; - num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + num429 = (float)Math.Sqrt(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; + num427 += Main.rand.Next(-10, 11) * 0.05f; + num428 += Main.rand.Next(-10, 11) * 0.05f; vector44.X += num427 * 4f; vector44.Y += num428 * 4f; @@ -5727,10 +5727,10 @@ namespace CalamityMod.NPCs // 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)); + Vector2 vector45 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num435 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector45.X; + float num436 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector45.Y; + float num437 = (float)Math.Sqrt(num435 * num435 + num436 * num436); num437 = num434 / num437; npc.velocity.X = num435 * num437; npc.velocity.Y = num436 * num437; @@ -5746,13 +5746,13 @@ namespace CalamityMod.NPCs // Slow down npc.velocity *= 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charge 8 times float chargeTime = 38f; @@ -5774,7 +5774,7 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - if ((double)npc.life < (double)npc.lifeMax * 0.7 || targetFloatingUp || death) + if (npc.life < npc.lifeMax * 0.7 || targetFloatingUp || death) { // Reset AI array and go to transition phase npc.ai[0] = 1f; @@ -5792,7 +5792,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 1f) { npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) + if (npc.ai[2] > 0.5) npc.ai[2] = 0.5f; } else @@ -5819,15 +5819,15 @@ namespace CalamityMod.NPCs 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); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 144, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); num = num439; } @@ -5835,13 +5835,13 @@ 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); + Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) npc.velocity.Y = 0f; } @@ -5859,7 +5859,7 @@ namespace CalamityMod.NPCs npc.chaseable = !retInPhase1; // Increase defense and damage - npc.damage = (int)((double)npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.5); npc.defense = npc.defDefense + defenseGain; // Change hit sound to metal @@ -5877,13 +5877,13 @@ namespace CalamityMod.NPCs } int num442 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + 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)); + Vector2 vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num443 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num442 * 180) - vector46.X; + float num444 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector46.Y; + float num445 = (float)Math.Sqrt(num443 * num443 + num444 * num444); // Boost speed if too far from target if (num445 > 300f) @@ -5965,15 +5965,15 @@ namespace CalamityMod.NPCs num447 += 3; int num448 = ModContent.ProjectileType(); - 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)); + vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num443 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector46.X; + num444 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector46.Y; + num445 = (float)Math.Sqrt(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 += Main.rand.Next(-10, 11) * 0.01f; + num443 += Main.rand.Next(-10, 11) * 0.01f; num444 += npc.velocity.Y * 0.5f; num443 += npc.velocity.X * 0.5f; vector46.X -= num443 * 1f; @@ -6011,10 +6011,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector47 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num451 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector47.X; + float num452 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector47.Y; + float num453 = (float)Math.Sqrt(num451 * num451 + num452 * num452); num453 = num450 / num453; npc.velocity.X = num451 * num453; npc.velocity.Y = num452 * num453; @@ -6039,13 +6039,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= chargeTime) { npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charges 5 times if (npc.ai[2] >= chargeTime + 30f) @@ -6098,10 +6098,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; + float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50); float num52 = num51; num51 = num48 / num51; @@ -6155,13 +6155,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= num60) { npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + if (npc.velocity.Y > -0.1 && 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; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; // Charge 3 times float num61 = num60 + 25f; @@ -6197,10 +6197,10 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; + float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + num62 - vector11.Y; + float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); num67 = num63 / num67; num65 *= num67; @@ -6237,9 +6237,9 @@ namespace CalamityMod.NPCs 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; + Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector44.X; + float num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float num430 = 16f; @@ -6248,7 +6248,7 @@ namespace CalamityMod.NPCs num431 += 3; int num432 = ModContent.ProjectileType(); - float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); num429 = num430 / num429; num427 *= num429; num428 *= num429; @@ -6646,8 +6646,8 @@ namespace CalamityMod.NPCs if (targetFloatingUp) speed += 5f; - float speedBuff = 3f + (3f * (1f - npc.life / npc.lifeMax)); - float speedBuff2 = 8f + (8f * (1f - npc.life / npc.lifeMax)); + float speedBuff = 3f + (3f * (1f - npc.life / (float)npc.lifeMax)); + float speedBuff2 = 8f + (8f * (1f - npc.life / (float)npc.lifeMax)); speed += num457 / 100f; if (speed < speedBuff) @@ -6754,7 +6754,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[0] = Main.player[npc.target].direction; // Set spin velocity - npc.velocity.X = 3.14159265f * npc.ai[3] / spinVelocity; + npc.velocity.X = MathHelper.Pi * npc.ai[3] / spinVelocity; npc.velocity *= -calamityGlobalNPC.newAI[0]; npc.netUpdate = true; } @@ -6762,7 +6762,7 @@ namespace CalamityMod.NPCs // 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]); + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); if (npc.ai[2] % 30f == 0f) { calamityGlobalNPC.newAI[1] += 1f; @@ -6879,7 +6879,7 @@ namespace CalamityMod.NPCs 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 = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4, default); velocity *= CalamityWorld.bossRushActive ? 7.5f : 5f; int damage = 33; if (death) @@ -7022,7 +7022,7 @@ namespace CalamityMod.NPCs float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X; float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y; float num508 = (float)Math.Sqrt(num506 * num506 + num507 * num507); - npc.rotation = (float)Math.Atan2(num507, num506) - 1.57f; + npc.rotation = (float)Math.Atan2(num507, num506) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7114,7 +7114,7 @@ namespace CalamityMod.NPCs num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); - npc.rotation = (float)Math.Atan2(num514, num513) - 1.57f; + npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7303,7 +7303,7 @@ namespace CalamityMod.NPCs float num492 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector60.X; float num493 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector60.Y; float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); - npc.rotation = (float)Math.Atan2(num493, num492) - 1.57f; + npc.rotation = (float)Math.Atan2(num493, num492) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7375,7 +7375,7 @@ namespace CalamityMod.NPCs num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); - npc.rotation = (float)Math.Atan2(num500, num499) - 1.57f; + npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -7588,7 +7588,7 @@ namespace CalamityMod.NPCs float num483 = Main.npc[(int)npc.ai[1]].position.X + (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(num483 * num483 + num484 * num484); - npc.rotation = (float)Math.Atan2(num484, num483) + 1.57f; + npc.rotation = (float)Math.Atan2(num484, num483) + MathHelper.PiOver2; return false; } @@ -7602,7 +7602,7 @@ namespace CalamityMod.NPCs float num486 = Main.npc[(int)npc.ai[1]].position.X + (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(num486 * num486 + num487 * num487); - npc.rotation = (float)Math.Atan2(num487, num486) + 1.57f; + npc.rotation = (float)Math.Atan2(num487, num486) + MathHelper.PiOver2; npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; npc.velocity.X += 0.5f; @@ -7667,7 +7667,7 @@ namespace CalamityMod.NPCs float num489 = Main.npc[(int)npc.ai[1]].position.X + (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(num489 * num489 + num490 * num490); - npc.rotation = (float)Math.Atan2(num490, num489) + 1.57f; + npc.rotation = (float)Math.Atan2(num490, num489) + MathHelper.PiOver2; npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; @@ -7891,7 +7891,7 @@ namespace CalamityMod.NPCs float num468 = Main.npc[(int)npc.ai[1]].position.X + (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(num468 * num468 + num469 * num469); - npc.rotation = (float)Math.Atan2(num469, num468) + 1.57f; + npc.rotation = (float)Math.Atan2(num469, num468) + MathHelper.PiOver2; return false; } @@ -7901,7 +7901,7 @@ namespace CalamityMod.NPCs float num471 = Main.npc[(int)npc.ai[1]].position.X + (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(num471 * num471 + num472 * num472); - npc.rotation = (float)Math.Atan2(num472, num471) + 1.57f; + npc.rotation = (float)Math.Atan2(num472, num471) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.3f; @@ -7998,7 +7998,7 @@ namespace CalamityMod.NPCs num474 = Main.npc[(int)npc.ai[1]].position.X + (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(num474 * num474 + num475 * num475); - npc.rotation = (float)Math.Atan2(num475, num474) + 1.57f; + npc.rotation = (float)Math.Atan2(num475, num474) + MathHelper.PiOver2; return false; } @@ -8021,7 +8021,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP bool phase2 = lifeRatio <= 0.5f; @@ -8033,7 +8033,7 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); // Check for Jungle and remaining Tentacles - bool surface = !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0; + bool surface = !CalamityWorld.bossRushActive && 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 @@ -8085,8 +8085,8 @@ namespace CalamityMod.NPCs break; } } - num730 /= (float)num732; - num731 /= (float)num732; + num730 /= num732; + num731 /= num732; // Velocity and acceleration float velocity = 6f; @@ -8134,7 +8134,7 @@ namespace CalamityMod.NPCs } // Enrage if target is on the surface - if (!CalamityWorld.bossRushActive && (surface || Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16))) + if (!CalamityWorld.bossRushActive && (surface || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16))) { enrage = true; velocity += 8f; @@ -8167,7 +8167,7 @@ namespace CalamityMod.NPCs // 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 + tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f // Movement relative to the target and hook positions Vector2 vector91 = new Vector2(num730, num731); @@ -8179,7 +8179,7 @@ namespace CalamityMod.NPCs num736 *= -1f; velocity += 8f; } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); // Increase speed based on nearby active tiles velocity *= tileEnrageMult; @@ -8207,7 +8207,7 @@ namespace CalamityMod.NPCs 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)); + num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); if (num738 < velocity) { @@ -8257,7 +8257,7 @@ namespace CalamityMod.NPCs 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; + npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; // Phase 1 if (!phase2) @@ -8299,9 +8299,9 @@ namespace CalamityMod.NPCs { 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)); + float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; num744 *= num745; @@ -8354,7 +8354,7 @@ namespace CalamityMod.NPCs { // Adjust stats npc.defense = 21; - npc.damage = (int)((float)npc.defDamage * 1.4f); + npc.damage = (int)(npc.defDamage * 1.4f); if (enrage) { npc.defense *= 4; @@ -8382,9 +8382,9 @@ namespace CalamityMod.NPCs // 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); + Gore.NewGore(new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); + Gore.NewGore(new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); + Gore.NewGore(new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); npc.localAI[2] = 1f; } @@ -8395,16 +8395,16 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= 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); + Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + 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); + float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); if (num760 > 0f) num759 = 0f; num760 -= num759; - float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); + float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); num761 = num757 / num761; num758 *= num761; num760 *= num761; @@ -8424,23 +8424,23 @@ namespace CalamityMod.NPCs int tentacleScale = 8 - tentacleCount; // 1 to 8 if (nearbyActiveTiles > 600) - npc.localAI[3] += 0.5f + ((float)(tentacleScale - 1) * 0.5f); + npc.localAI[3] += 0.5f + ((tentacleScale - 1) * 0.5f); else - npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (float)(tentacleScale - 1); + npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (tentacleScale - 1); if (npc.localAI[3] >= 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 + float num742 = 8f - (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)); + float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; num744 *= num745; @@ -8478,9 +8478,9 @@ namespace CalamityMod.NPCs 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)); + float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; num744 *= num745; @@ -8499,13 +8499,13 @@ namespace CalamityMod.NPCs 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 deltaAngle = rotation / numProj; double offsetAngle; for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - float ai0 = (float)Main.rand.Next(3); + float ai0 = Main.rand.Next(3); Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, 0f); } @@ -8526,9 +8526,9 @@ namespace CalamityMod.NPCs 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)); + Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; + vector *= Main.rand.Next(50, 100) * 0.04f; Main.dust[dust].velocity = vector; vector.Normalize(); vector *= 86f; @@ -8585,14 +8585,14 @@ namespace CalamityMod.NPCs } // Percent life remaining, Plantera - float lifeRatio = (float)Main.npc[NPC.plantBoss].life / (float)Main.npc[NPC.plantBoss].lifeMax; + float lifeRatio = 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)) + if (!CalamityWorld.bossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) { npc.localAI[0] -= 4f; enrage = true; @@ -8602,9 +8602,9 @@ namespace CalamityMod.NPCs if (Main.netMode == NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f) - npc.ai[0] = (float)(int)(npc.Center.X / 16f); + npc.ai[0] = (int)(npc.Center.X / 16f); if (npc.ai[1] == 0f) - npc.ai[1] = (float)(int)(npc.Center.X / 16f); + npc.ai[1] = (int)(npc.Center.X / 16f); } // Find new spot to move to after set time has passed @@ -8626,7 +8626,7 @@ namespace CalamityMod.NPCs for (int num763 = 0; num763 < Main.maxNPCs; 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); + npc.localAI[0] = Main.rand.Next(60, 301); } } @@ -8634,7 +8634,7 @@ namespace CalamityMod.NPCs if (npc.localAI[0] <= 0f) { // Reset timer - npc.localAI[0] = (float)Main.rand.Next(300, 601); + npc.localAI[0] = Main.rand.Next(300, 601); // Pick location bool flag50 = false; @@ -8659,7 +8659,7 @@ namespace CalamityMod.NPCs } int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); + num767 += (int)(100f * (num764 / 1000f)); int num768 = num765 + Main.rand.Next(-num767, num767 + 1); int num769 = num766 + Main.rand.Next(-num767, num767 + 1); @@ -8668,8 +8668,8 @@ namespace CalamityMod.NPCs 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.ai[0] = num768; + npc.ai[1] = num769; npc.netUpdate = true; } } catch @@ -8694,7 +8694,7 @@ namespace CalamityMod.NPCs 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)); + float num775 = (float)Math.Sqrt(num773 * num773 + num774 * num774); if (num775 < 12f + velocity) { npc.velocity.X = num773; @@ -8711,7 +8711,7 @@ namespace CalamityMod.NPCs 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; + npc.rotation = (float)Math.Atan2(num777, num776) - MathHelper.PiOver2; } return false; } @@ -8739,9 +8739,9 @@ namespace CalamityMod.NPCs 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.localAI[0] = Main.rand.Next(120, 480); + npc.ai[0] = Main.rand.Next(-100, 101); + npc.ai[1] = Main.rand.Next(-100, 101); npc.netUpdate = true; } } @@ -8751,7 +8751,7 @@ namespace CalamityMod.NPCs // Velocity and acceleration float num779 = CalamityWorld.bossRushActive ? 1f : 0.5f; - float num781 = death ? 1f : 1f - (float)npc.life / (float)npc.lifeMax; + float num781 = death ? 1f : 1f - npc.life / (float)npc.lifeMax; float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); // Despawn if Plantera is gone @@ -8762,14 +8762,14 @@ namespace CalamityMod.NPCs } // 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); + float num782 = Main.npc[num778].position.X + (Main.npc[num778].width / 2); + float num783 = Main.npc[num778].position.Y + (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)); + float num788 = (float)Math.Sqrt(num786 * num786 + num787 * num787); num788 = num780 / num788; num786 *= num788; num787 *= num788; @@ -8810,12 +8810,12 @@ namespace CalamityMod.NPCs if (num786 > 0f) { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num787, (double)num786); + npc.rotation = (float)Math.Atan2(num787, num786); } if (num786 < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num787, (double)num786) + 3.14f; + npc.rotation = (float)Math.Atan2(num787, num786) + MathHelper.Pi; } return false; } @@ -8828,7 +8828,7 @@ namespace CalamityMod.NPCs NPC.golemBoss = npc.whoAmI; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -8855,7 +8855,7 @@ namespace CalamityMod.NPCs // Enrage if the target isn't inside the temple bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + if (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; @@ -8885,7 +8885,7 @@ namespace CalamityMod.NPCs // Damage if (!flag40) - npc.damage = (int)((float)npc.defDamage * 1.5f); + npc.damage = (int)(npc.defDamage * 1.5f); // Phase 2, check for free head bool flag43 = NPC.AnyNPCs(NPCID.GolemHeadFree); @@ -8897,8 +8897,8 @@ namespace CalamityMod.NPCs 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; + dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; + dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.Next(10) == 0) { @@ -8907,7 +8907,7 @@ namespace CalamityMod.NPCs { Main.dust[num642].noGravity = true; dust = Main.dust[num642]; - dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + dust.scale *= 1f + Main.rand.Next(10) * 0.1f; dust.velocity.Y -= 1f; } } @@ -8918,8 +8918,8 @@ namespace CalamityMod.NPCs 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; + dust.velocity.Y -= 0.5f + Main.rand.Next(10) * 0.1f; + dust.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.Next(10) == 0) { @@ -8928,7 +8928,7 @@ namespace CalamityMod.NPCs { Main.dust[num643].noGravity = true; dust = Main.dust[num643]; - dust.scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + dust.scale *= 1f + Main.rand.Next(10) * 0.1f; dust.velocity.Y -= 1f; } } @@ -8958,9 +8958,9 @@ namespace CalamityMod.NPCs 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)); + float num674 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; + float num675 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; + float num676 = (float)Math.Sqrt(num674 * num674 + num675 * num675); num676 = num673 / num676; num674 *= num676; @@ -9018,9 +9018,9 @@ namespace CalamityMod.NPCs if (enrage) velocityX *= 1.5f; - npc.velocity.X = velocityX * (float)npc.direction; + npc.velocity.X = velocityX * npc.direction; - if (Main.player[npc.target].position.Y < npc.position.Y + (float)npc.height) + if (Main.player[npc.target].position.Y < npc.position.Y + npc.height) npc.velocity.Y = (!flag43 && !flag40) ? -15.1f : -12.1f; else npc.velocity.Y = 1f; @@ -9048,11 +9048,11 @@ namespace CalamityMod.NPCs { 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); + int num646 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + 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); + int num647 = Gore.NewGore(new Vector2(num644 - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[num647]; gore.velocity *= 0.4f; } @@ -9068,7 +9068,7 @@ namespace CalamityMod.NPCs if (Main.rand.Next(2) == 0) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 20; num623++) @@ -9080,11 +9080,11 @@ namespace CalamityMod.NPCs Main.dust[num624].velocity.X *= 2f; } - int spawnX = (int)(npc.width / 2); + int spawnX = 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); + float velocityX = Main.rand.NextBool() ? Main.rand.Next(4, 6) : Main.rand.Next(-5, -3); + float velocityY = Main.rand.Next(-1, 2); if (enrage) { @@ -9096,7 +9096,7 @@ namespace CalamityMod.NPCs if (death) damage += 3; - int proj = Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y + (float)(npc.height / 2) * 0.8f, + int proj = Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + (npc.height / 2) * 0.8f, velocityX, velocityY, ProjectileID.Fireball, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 240; } @@ -9108,17 +9108,17 @@ namespace CalamityMod.NPCs // 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))) + ((Main.player[npc.target].position.Y > npc.position.Y + npc.height && npc.velocity.Y > 0f) || (Main.player[npc.target].position.Y < npc.position.Y + 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) + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) { npc.velocity.X *= 0.9f; - if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) + if (Main.player[npc.target].position.Y > npc.position.Y + npc.height) { float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); float fallSpeed = 0.2f + fallSpeedBoost; @@ -9154,11 +9154,11 @@ namespace CalamityMod.NPCs // 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) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 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) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num649) npc.active = false; } @@ -9181,7 +9181,7 @@ namespace CalamityMod.NPCs } // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -9197,7 +9197,7 @@ namespace CalamityMod.NPCs float num652 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; num652 -= 57f; num651 -= 3f; - float num653 = (float)Math.Sqrt((double)(num651 * num651 + num652 * num652)); + float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); if (num653 < 20f) { npc.rotation = 0f; @@ -9214,7 +9214,7 @@ namespace CalamityMod.NPCs // Enrage if the target isn't inside the temple bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + if (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; @@ -9241,12 +9241,12 @@ namespace CalamityMod.NPCs { npc.ai[1] += 1f; int num654 = 180; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num654 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > (num654 - 20)) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (npc.ai[1] >= (float)num654) + if (npc.ai[1] >= num654) { npc.TargetClosest(true); @@ -9254,9 +9254,9 @@ namespace CalamityMod.NPCs 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)); + float num656 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector81.X; + float num657 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector81.Y; + float num658 = (float)Math.Sqrt(num656 * num656 + num657 * num657); num658 = num655 / num658; num656 *= num658; @@ -9278,12 +9278,12 @@ namespace CalamityMod.NPCs // 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) + if (Main.player[npc.target].Center.X < npc.Center.X - npc.width) { npc.localAI[1] = -1f; vector82.X -= 40f; } - else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) + else if (Main.player[npc.target].Center.X > npc.Center.X + npc.width) { npc.localAI[1] = 1f; vector82.X += 40f; @@ -9296,21 +9296,21 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f + shootBoost; int num662 = 240; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num662 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > (num662 - 20)) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (npc.ai[1] >= (float)num662) + if (npc.ai[1] >= 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)); + float num664 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; + float num665 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; + float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); num666 = num663 / num666; num664 *= num666; @@ -9355,9 +9355,9 @@ namespace CalamityMod.NPCs 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)); + float num674 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; + float num675 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; + float num676 = (float)Math.Sqrt(num674 * num674 + num675 * num675); num676 = num673 / num676; num674 *= num676; @@ -9384,9 +9384,9 @@ namespace CalamityMod.NPCs 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)); + float num679 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; + float num680 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; + float num681 = (float)Math.Sqrt(num679 * num679 + num680 * num680); num681 = num678 / num681; num679 *= num681; @@ -9429,8 +9429,8 @@ namespace CalamityMod.NPCs } // 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 lifeRatio = npc.life / (float)npc.lifeMax; + float golemLifeRatio = Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; float combinedRatio = lifeRatio + golemLifeRatio; // Phases @@ -9451,7 +9451,7 @@ namespace CalamityMod.NPCs // Enrage if the target isn't inside the temple bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + if (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; @@ -9552,7 +9552,7 @@ namespace CalamityMod.NPCs 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)); + float num704 = (float)Math.Sqrt(num702 * num702 + num703 * num703); // Static movement if (phase3) @@ -9630,7 +9630,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f + shootBoost; int num705 = 360; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num705 - 20)) + if (npc.ai[1] < 20f || npc.ai[1] > (num705 - 20)) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; @@ -9638,15 +9638,15 @@ namespace CalamityMod.NPCs if (flag44 && !phase3) npc.ai[1] = 20f; - if (npc.ai[1] >= (float)num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (npc.ai[1] >= num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { 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)); + float num709 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector88.X; + float num710 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector88.Y; + float num711 = (float)Math.Sqrt(num709 * num709 + num710 * num710); num711 = num706 / num711; num709 *= num711; @@ -9688,9 +9688,9 @@ namespace CalamityMod.NPCs vector89.X += 14f; float num714 = 5f + shootBoost; - 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)); + float num717 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector89.X; + float num718 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector89.Y; + float num719 = (float)Math.Sqrt(num717 * num717 + num718 * num718); num719 = num714 / num719; num717 *= num719; @@ -9726,8 +9726,8 @@ namespace CalamityMod.NPCs // Variables bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66 || death; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * (death ? 0.33 : 0.2); + bool phase2 = npc.life <= npc.lifeMax * 0.66 || death; + bool phase3 = npc.life <= npc.lifeMax * (death ? 0.33 : 0.2); bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -9735,18 +9735,18 @@ namespace CalamityMod.NPCs // Adjust stats if (phase3AI) { - npc.damage = (int)((float)npc.defDamage * 1.32f); - npc.defense = (int)((float)npc.defDefense * 0.75f); + npc.damage = (int)(npc.defDamage * 1.32f); + npc.defense = (int)(npc.defDefense * 0.75f); } else if (phase2AI) { - npc.damage = (int)((float)npc.defDamage * 1.44f); + npc.damage = (int)(npc.defDamage * 1.44f); npc.defense = npc.defDefense; } else { npc.damage = npc.defDamage; - npc.defense = (int)((float)npc.defDefense * 1.2f); + npc.defense = (int)(npc.defDefense * 1.2f); } int num2 = 30; @@ -9806,7 +9806,7 @@ namespace CalamityMod.NPCs int num14 = 4; float scaleFactor3 = 6f; float scaleFactor4 = 20f; - float num15 = 6.28318548f / (float)(num13 / 2); + float num15 = MathHelper.TwoPi / (num13 / 2); int num16 = 75; Vector2 vector = npc.Center; Player player = Main.player[npc.target]; @@ -9837,8 +9837,8 @@ namespace CalamityMod.NPCs // 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))); + (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune if (!phase3AI) @@ -9863,7 +9863,7 @@ namespace CalamityMod.NPCs 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)); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.netUpdate = true; } @@ -9883,13 +9883,13 @@ namespace CalamityMod.NPCs } // Rotation - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (npc.spriteDirection == 1) - num17 += 3.14159274f; + num17 += MathHelper.Pi; if (num17 < 0f) - num17 += 6.28318548f; - if (num17 > 6.28318548f) - num17 -= 6.28318548f; + num17 += MathHelper.TwoPi; + if (num17 > MathHelper.TwoPi) + num17 -= MathHelper.TwoPi; if (npc.ai[0] == -1f) num17 = 0f; if (npc.ai[0] == 3f) @@ -9913,14 +9913,14 @@ namespace CalamityMod.NPCs if (npc.rotation < num17) { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) + if ((num17 - npc.rotation) > MathHelper.Pi) npc.rotation -= num18; else npc.rotation += num18; } if (npc.rotation > num17) { - if ((double)(npc.rotation - num17) > 3.1415926535897931) + if ((npc.rotation - num17) > MathHelper.Pi) npc.rotation += num18; else npc.rotation -= num18; @@ -9929,9 +9929,9 @@ namespace CalamityMod.NPCs 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; + npc.rotation += MathHelper.TwoPi; + if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) npc.rotation = num17; @@ -9978,12 +9978,12 @@ namespace CalamityMod.NPCs } // Spawn dust and play sound - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == num9 - 30) { int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 dust = (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 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20, default) + npc.Center; Vector2 vector2 = dust - npc.Center; int num21 = Dust.NewDust(dust + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); Main.dust[num21].noGravity = true; @@ -9995,7 +9995,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) + if (npc.ai[2] >= num16) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -10009,7 +10009,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 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) @@ -10042,19 +10042,19 @@ namespace CalamityMod.NPCs if (num22 != 0) { if (npc.ai[2] == 0f && num22 != npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.direction = num22; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + if (npc.ai[2] >= num2) { int num23 = 0; switch ((int)npc.ai[3]) @@ -10093,7 +10093,7 @@ namespace CalamityMod.NPCs // Velocity npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num22 != 0) @@ -10101,7 +10101,7 @@ namespace CalamityMod.NPCs npc.direction = num22; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -10145,8 +10145,8 @@ namespace CalamityMod.NPCs 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); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24, default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * 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; @@ -10170,7 +10170,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 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) @@ -10202,13 +10202,13 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (npc.ai[2] % (float)num7 == 0f) + if (npc.ai[2] % 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; + Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); } } @@ -10219,12 +10219,12 @@ namespace CalamityMod.NPCs { npc.direction = num26; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num6) + if (npc.ai[2] >= num6) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -10244,15 +10244,15 @@ namespace CalamityMod.NPCs 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)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num9 - 30) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (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); + Projectile.NewProjectile(vector7.X, vector7.Y, npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); + Projectile.NewProjectile(vector7.X, vector7.Y, -(float)npc.direction * 3, velocityY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, ai1); velocityY = normal ? -4f : 8f; ai1 = normal ? -1f : 0f; @@ -10260,7 +10260,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) + if (npc.ai[2] >= num9) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -10277,11 +10277,11 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == (float)(num10 - 60)) + if (npc.ai[2] == num10 - 60) Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num10) + if (npc.ai[2] >= num10) { npc.ai[0] = 5f; npc.ai[1] = 0f; @@ -10296,7 +10296,7 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 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) @@ -10329,19 +10329,19 @@ namespace CalamityMod.NPCs if (num27 != 0) { if (npc.ai[2] == 0f && num27 != npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.direction = num27; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + if (npc.ai[2] >= num2) { int num28 = 0; switch ((int)npc.ai[3]) @@ -10376,7 +10376,7 @@ namespace CalamityMod.NPCs // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num27 != 0) @@ -10384,7 +10384,7 @@ namespace CalamityMod.NPCs npc.direction = num27; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -10395,7 +10395,7 @@ namespace CalamityMod.NPCs { // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num27 != 0) @@ -10403,7 +10403,7 @@ namespace CalamityMod.NPCs npc.direction = num27; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -10443,8 +10443,8 @@ namespace CalamityMod.NPCs 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); + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * MathHelper.Pi / num29, default) + vector; + Vector2 vector9 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * 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; @@ -10453,7 +10453,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 5f; npc.ai[1] = 0f; @@ -10470,20 +10470,20 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (npc.ai[2] % (float)num14 == 0f) + if (npc.ai[2] % 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; + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (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].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction, default) * scaleFactor3; Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = (float)Main.rand.Next(80, 121) / 100f; + Main.npc[num31].ai[3] = Main.rand.Next(80, 121) / 100f; - if (npc.ai[2] % (float)(num14 * 5) == 0f) + if (npc.ai[2] % (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; @@ -10492,11 +10492,11 @@ namespace CalamityMod.NPCs } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default); - npc.rotation -= num15 * (float)npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction, default); + npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) + if (npc.ai[2] >= num13) { npc.ai[0] = 5f; npc.ai[1] = 0f; @@ -10513,14 +10513,14 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn cthulhunado - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == 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)); + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num9 - 30) + Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) + if (npc.ai[2] >= num9) { npc.ai[0] = 5f; npc.ai[1] = 0f; @@ -10533,7 +10533,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 9f) { // Alpha adjustments - if (npc.ai[2] < (float)(num11 - 90)) + if (npc.ai[2] < num11 - 90) { if (Collision.SolidCollision(npc.position, npc.width, npc.height)) npc.alpha += 15; @@ -10557,11 +10557,11 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == (float)(num11 - 60)) + if (npc.ai[2] == num11 - 60) Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) + if (npc.ai[2] >= num11) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -10587,7 +10587,7 @@ namespace CalamityMod.NPCs // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = (float)(360 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 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); @@ -10598,7 +10598,7 @@ namespace CalamityMod.NPCs { if (npc.ai[2] == 0f && num32 != npc.direction) { - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; for (int l = 0; l < npc.oldPos.Length; l++) npc.oldPos[l] = Vector2.Zero; } @@ -10606,14 +10606,14 @@ namespace CalamityMod.NPCs npc.direction = num32; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + if (npc.ai[2] >= num2) { int num33 = 0; switch ((int)npc.ai[3]) @@ -10642,7 +10642,7 @@ namespace CalamityMod.NPCs // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction if (num32 != 0) @@ -10650,7 +10650,7 @@ namespace CalamityMod.NPCs npc.direction = num32; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -10686,8 +10686,8 @@ namespace CalamityMod.NPCs 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); + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * MathHelper.Pi / num34, default) + vector; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * 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; @@ -10696,7 +10696,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -10725,14 +10725,14 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == (float)(num12 / 2)) + if (npc.ai[2] == 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)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) { // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); // Rotation and direction Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); @@ -10742,7 +10742,7 @@ namespace CalamityMod.NPCs { if (npc.ai[2] == 0f && num36 != npc.direction) { - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; for (int n = 0; n < npc.oldPos.Length; n++) npc.oldPos[n] = Vector2.Zero; } @@ -10750,14 +10750,14 @@ namespace CalamityMod.NPCs npc.direction = num36; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) + if (npc.ai[2] >= num12) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -10793,7 +10793,7 @@ namespace CalamityMod.NPCs } // Percent life remaining - float lifeRatio = npc.life / npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -14952,7 +14952,7 @@ namespace CalamityMod.NPCs num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); if (num877 > 20f) - npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + 1.57f; + npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + MathHelper.PiOver2; } else if (npc.ai[2] == 1f) { @@ -14961,7 +14961,7 @@ namespace CalamityMod.NPCs 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.rotation = (float)Math.Atan2((double)num880, (double)num879) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; npc.velocity.Y -= 0.3f; @@ -14998,7 +14998,7 @@ namespace CalamityMod.NPCs 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.rotation = (float)Math.Atan2((double)num884, (double)num883) + MathHelper.PiOver2; npc.velocity.Y *= 0.95f; npc.velocity.X += 0.3f * -npc.ai[0]; @@ -19727,7 +19727,7 @@ namespace CalamityMod.NPCs else if (num4 < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; } } else if (npc.type == 139) @@ -19759,12 +19759,12 @@ namespace CalamityMod.NPCs if (num4 < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; } } else if (npc.type == 6 || npc.type == 94 || npc.type == 173) { - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) - 1.57f; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) - MathHelper.PiOver2; } else if (npc.type == 205) { @@ -19780,7 +19780,7 @@ namespace CalamityMod.NPCs } else { - 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) - MathHelper.PiOver2; } if (npc.type == 6 || npc.type == 23 || npc.type == 94 || npc.type == 139 || npc.type == 173 || npc.type == 205) { @@ -20316,7 +20316,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.SolarCrawltipedeHead) { - Vector2 value = npc.Center + (npc.rotation - 1.57079637f).ToRotationVector2() * 8f; + Vector2 value = npc.Center + (npc.rotation - MathHelper.PiOver2).ToRotationVector2() * 8f; Vector2 value2 = npc.rotation.ToRotationVector2() * 16f; Dust expr_1AAB = Main.dust[Dust.NewDust(value + value2, 0, 0, 6, npc.velocity.X, npc.velocity.Y, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 3f)]; expr_1AAB.noGravity = true; @@ -20513,7 +20513,7 @@ namespace CalamityMod.NPCs catch { } - npc.rotation = (float)Math.Atan2((double)num40, (double)num39) + 1.57f; + npc.rotation = (float)Math.Atan2((double)num40, (double)num39) + MathHelper.PiOver2; num52 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); int num53 = npc.width; if (npc.type >= NPCID.WyvernHead && npc.type <= NPCID.WyvernTail) @@ -20748,7 +20748,7 @@ namespace CalamityMod.NPCs } } - 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) + MathHelper.PiOver2; if (npc.type == NPCID.DevourerHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.LeechHead || npc.type == NPCID.DuneSplicerHead || npc.type == NPCID.TombCrawlerHead) { if (flag2) @@ -22257,7 +22257,7 @@ namespace CalamityMod.NPCs bool flag17 = false; if (npc.directionY < 0) { - npc.rotation = (float)(Math.Atan2((double)num272, (double)num271) + 1.57); + npc.rotation = (float)(Math.Atan2((double)num272, (double)num271) + MathHelper.PiOver2); flag17 = ((double)npc.rotation >= -1.2 && (double)npc.rotation <= 1.2); if ((double)npc.rotation < -0.8) { @@ -22508,7 +22508,7 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; for (int num1501 = 0; num1501 < 4; num1501++) { - Vector2 vector255 = new Vector2(0f, -5f).RotatedBy((double)(1.57079637f * (float)num1501), default); + Vector2 vector255 = new Vector2(0f, -5f).RotatedBy((double)(MathHelper.PiOver2 * (float)num1501), default); int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.FlamesTrap, 20, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].friendly = false; @@ -23377,7 +23377,7 @@ namespace CalamityMod.NPCs { Vector2 vector2 = npc.Center + Vector2.UnitX * (float)npc.spriteDirection * -20f; Dust arg_5A4_0 = Main.dust[Dust.NewDust(vector2, 0, 0, 242, 0f, 0f, 0, default(Color), 1f)]; - Vector2 vector3 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Vector2 vector3 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); arg_5A4_0.position = vector2 + vector3 * 20f; arg_5A4_0.velocity = -vector3 * 2f; arg_5A4_0.scale = 0.5f + vector3.X * (float)(-(float)npc.spriteDirection); @@ -23390,7 +23390,7 @@ namespace CalamityMod.NPCs { Vector2 vector4 = npc.Center + Vector2.UnitX * (float)npc.spriteDirection * -20f; Dust arg_68B_0 = Main.dust[Dust.NewDust(vector4, 0, 0, 242, 0f, 0f, 0, default(Color), 1f)]; - Vector2 vector5 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Vector2 vector5 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); arg_68B_0.position = vector4 + vector5 * 4f; arg_68B_0.velocity = vector5 * 4f + Vector2.UnitX * Main.rand.NextFloat() * (float)npc.spriteDirection * -5f; arg_68B_0.scale = 0.5f + vector5.X * (float)(-(float)npc.spriteDirection); @@ -24490,7 +24490,7 @@ namespace CalamityMod.NPCs } if (npc.type == 531) { - npc.rotation += 1.57079637f; + npc.rotation += MathHelper.PiOver2; } float num572 = 0.5f; if (npc.collideX) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 8ce6635060..4081ae93bf 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1098,23 +1098,43 @@ namespace CalamityMod.Projectiles SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); } - else if (modPlayer.godSlayerMage) + else if (projectile.magic) { - float healMult = 0.06f; - healMult -= projectile.numHits * 0.015f; - float heal = projectile.damage * healMult; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); - } - else if (modPlayer.tarraMage) - { - if (modPlayer.tarraMageHealCooldown <= 0) + if (modPlayer.godSlayerMage) { - modPlayer.tarraMageHealCooldown = 90; + float healMult = 0.06f; + healMult -= projectile.numHits * 0.015f; + float heal = projectile.damage * healMult; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } + else if (modPlayer.tarraMage) + { + if (modPlayer.tarraMageHealCooldown <= 0) + { + modPlayer.tarraMageHealCooldown = 90; + + float healMult = 0.1f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + int healAmount = (int)heal; + player.statLife += healAmount; + player.HealEffect(healAmount); + + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } + } + else if (modPlayer.ataxiaMage) + { float healMult = 0.1f; healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult; @@ -1122,36 +1142,19 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - Main.player[Main.myPlayer].lifeSteal -= heal * 3f; - int healAmount = (int)heal; - player.statLife += healAmount; - player.HealEffect(healAmount); - - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); } - } - else if (modPlayer.ataxiaMage) - { - float healMult = 0.1f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult; + else if (modPlayer.manaOverloader) + { + float healMult = 0.2f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); - } - else if (modPlayer.manaOverloader) - { - float healMult = 0.2f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult * (player.statMana / player.statManaMax2); - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 2f); + SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + } } } From 9e1b971db81a874496da60a8c90e45e00b20c4ae Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 08:47:31 -0400 Subject: [PATCH 041/137] Pet AI code thingy --- Projectiles/CalamityGlobalProjectile.cs | 75 +++++++++++++------------ 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 4081ae93bf..1affebe818 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1971,7 +1971,7 @@ namespace CalamityMod.Projectiles { Player player = Main.player[projectile.owner]; - //anti sticking movement as a backup + //anti sticking movement as a failsafe float SAImovement = 0.05f; for (int index = 0; index < Main.projectile.Length; index++) { @@ -1998,21 +1998,22 @@ namespace CalamityMod.Projectiles } } - float num16 = 0.5f; + float passiveMvtFloat = 0.5f; projectile.tileCollide = false; float range = 100f; - Vector2 vector3 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float xDist = player.position.X + (player.width / 2) - vector3.X; - float yDist = player.position.Y + (player.height / 2) - vector3.Y; - yDist += Main.rand.Next(-10, 21); - xDist += Main.rand.Next(-10, 21); - //light pets lead the player, normal pets trail the player - xDist += 60 * (lightPet ? player.direction : -player.direction); + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + //Light pets lead the player, normal pets trail the player + xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); yDist -= 60f; - float playerDist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - float num21 = 18f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + float returnSpeed = 18f; - //if player is close enough, resume normal + //If player is close enough, resume normal if (playerDist < range && player.velocity.Y == 0f && projectile.position.Y + projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) @@ -2023,11 +2024,11 @@ namespace CalamityMod.Projectiles } } - //teleport to player if too far + //Teleport to player if too far if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (projectile.width / 2); - projectile.position.Y = player.Center.Y - (projectile.height / 2); + projectile.position.X = player.Center.X - projectile.width / 2; + projectile.position.Y = player.Center.Y - projectile.height / 2; projectile.netUpdate = true; } @@ -2037,52 +2038,52 @@ namespace CalamityMod.Projectiles { projectile.velocity *= 0.99f; } - num16 = 0.01f; + passiveMvtFloat = 0.01f; } else { if (playerDist < 100f) { - num16 = 0.1f; + passiveMvtFloat = 0.1f; } if (playerDist > 300f) { - num16 = 1f; + passiveMvtFloat = 1f; } - playerDist = num21 / playerDist; - xDist *= playerDist; - yDist *= playerDist; + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; } - if (projectile.velocity.X < xDist) + if (projectile.velocity.X < playerVector.X) { - projectile.velocity.X = projectile.velocity.X + num16; - if (num16 > 0.05f && projectile.velocity.X < 0f) + projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += passiveMvtFloat; } } - if (projectile.velocity.X > xDist) + if (projectile.velocity.X > playerVector.X) { - projectile.velocity.X = projectile.velocity.X - num16; - if (num16 > 0.05f && projectile.velocity.X > 0f) + projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= passiveMvtFloat; } } - if (projectile.velocity.Y < yDist) + if (projectile.velocity.Y < playerVector.Y) { - projectile.velocity.Y = projectile.velocity.Y + num16; - if (num16 > 0.05f && projectile.velocity.Y < 0f) + projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += passiveMvtFloat * 2f; } } - if (projectile.velocity.Y > yDist) + if (projectile.velocity.Y > playerVector.Y) { - projectile.velocity.Y = projectile.velocity.Y - num16; - if (num16 > 0.05f && projectile.velocity.Y > 0f) + projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= passiveMvtFloat * 2f; } } if (projectile.velocity.X >= 0.25f) From e6c499bd425004115e95c911ac849ae8180c095f Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 09:23:25 -0400 Subject: [PATCH 042/137] resists :white_check_mark: --- Items/Weapons/Melee/AstralScythe.cs | 6 +++++ Items/Weapons/Melee/BrinyBaron.cs | 2 +- Items/Weapons/Melee/Nebulash.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 28 ++++++++++++--------- Projectiles/Melee/AstralScytheProjectile.cs | 2 +- Projectiles/Melee/NebulashFlail.cs | 4 +-- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 51794a157a..a297dfa5b9 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -33,6 +33,12 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 5f; } + 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, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + return false; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 7c09cf78f8..4cf4b19886 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 80; + item.damage = 75; item.melee = true; item.useAnimation = 20; item.useTime = 20; diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index 59e78b632a..c7467821b6 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 16; item.height = 16; - item.damage = 54; + item.damage = 60; item.rare = 7; item.noMelee = true; item.noUseGraphic = true; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c8ed906725..eda1d73f2a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3507,11 +3507,11 @@ namespace CalamityMod.NPCs } else if (DestroyerIDs.Contains(npc.type)) { - if (((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) || projectile.type == ModContent.ProjectileType()) + if (((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)) { damage = (int)(damage * 0.5); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.75); } @@ -3529,7 +3529,7 @@ namespace CalamityMod.NPCs projectile.penetrate = 3; damage = (int)(damage * 0.3); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.25); } @@ -3540,7 +3540,11 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.7); + } + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3548,11 +3552,7 @@ namespace CalamityMod.NPCs { if (projectile.penetrate == -1) projectile.penetrate = 3; - damage = (int)(damage * 0.3); - } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - damage = (int)(damage * 0.25); + damage = (int)(damage * 0.1); } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) @@ -3583,18 +3583,22 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.6); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { damage = (int)(damage * 0.75); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ProjectileID.LunarFlare) + else if (projectile.type == ProjectileID.LunarFlare) { damage = (int)(damage * 0.8); } + else if (projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.9); + } } else if (npc.type == NPCID.CultistBoss) { diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index 334ec4205f..01f07ca2dc 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; projectile.penetrate = 8; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 7; projectile.tileCollide = false; } diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index 47cba7fb60..4e889530fc 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 3; } public override Color SpecialDrawColor => new Color(255, 200, 0); public override int ExudeDustType => ModContent.DustType(); @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 120); if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage / 2, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } projectile.localAI[1] = 4f; } From c6c8433627d23be2b8fb3249714b0cb3113c2dca Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 09:40:19 -0400 Subject: [PATCH 043/137] removed some unnecessary Microsoft.Xna.Framework's also added using Terraria.ModLoader.ModContent to globalnpc --- Items/Weapons/DraedonsArsenal/GatlingLaser.cs | 2 +- Items/Weapons/DraedonsArsenal/LaserRifle.cs | 2 +- Items/Weapons/DraedonsArsenal/PlasmaCaster.cs | 2 +- Items/Weapons/DraedonsArsenal/PulseRifle.cs | 2 +- Items/Weapons/DraedonsArsenal/TeslaCannon.cs | 2 +- Items/Weapons/Magic/AquamarineStaff.cs | 2 +- Items/Weapons/Magic/DarkSpark.cs | 3 +- Items/Weapons/Magic/Downpour.cs | 2 +- Items/Weapons/Magic/Effervescence.cs | 3 +- Items/Weapons/Magic/GhastlyVisage.cs | 2 +- Items/Weapons/Magic/Hematemesis.cs | 2 +- Items/Weapons/Magic/LightGodsBrilliance.cs | 3 +- .../Magic/MadAlchemistsCocktailGlove.cs | 3 +- Items/Weapons/Magic/MagneticMeltdown.cs | 2 +- Items/Weapons/Magic/Mistlestorm.cs | 2 +- Items/Weapons/Magic/Purge.cs | 3 +- Items/Weapons/Magic/RecitationoftheBeast.cs | 3 +- Items/Weapons/Magic/ShadecrystalTome.cs | 3 +- Items/Weapons/Magic/StormSpray.cs | 2 +- Items/Weapons/Magic/T1000.cs | 3 +- Items/Weapons/Magic/TearsofHeaven.cs | 3 +- Items/Weapons/Magic/ThornBlossom.cs | 2 +- Items/Weapons/Magic/Waywasher.cs | 3 +- Items/Weapons/Magic/Wingman.cs | 3 +- Items/Weapons/Melee/AstralScythe.cs | 1 + Items/Weapons/Melee/CorpusAvertorMelee.cs | 3 +- Items/Weapons/Melee/CosmicDischarge.cs | 3 +- Items/Weapons/Melee/CrescentMoon.cs | 3 +- Items/Weapons/Melee/DevilsSunrise.cs | 3 +- Items/Weapons/Melee/FulgurationHalberd.cs | 3 +- Items/Weapons/Melee/KelvinCatalystMelee.cs | 3 +- Items/Weapons/Melee/MirrorBlade.cs | 3 +- Items/Weapons/Melee/Mourningstar.cs | 3 +- Items/Weapons/Melee/Nebulash.cs | 3 +- Items/Weapons/Melee/RedtideSword.cs | 3 +- Items/Weapons/Melee/SoulEdge.cs | 3 +- Items/Weapons/Melee/YateveoBloom.cs | 3 +- Items/Weapons/Ranged/Arbalest.cs | 3 +- Items/Weapons/Ranged/Barinade.cs | 3 +- Items/Weapons/Ranged/Barinautical.cs | 3 +- Items/Weapons/Ranged/BlossomFlux.cs | 3 +- Items/Weapons/Ranged/ChickenCannon.cs | 2 +- Items/Weapons/Ranged/Contagion.cs | 3 +- Items/Weapons/Ranged/CorrodedCaustibow.cs | 3 +- Items/Weapons/Ranged/CursedCapper.cs | 3 +- Items/Weapons/Ranged/FirestormCannon.cs | 2 +- Items/Weapons/Ranged/FlakKraken.cs | 3 +- Items/Weapons/Ranged/Hellborn.cs | 2 +- Items/Weapons/Ranged/Helstorm.cs | 2 +- Items/Weapons/Ranged/MineralMortar.cs | 2 +- Items/Weapons/Ranged/OpalStriker.cs | 3 +- Items/Weapons/Ranged/ProporsePistol.cs | 3 +- Items/Weapons/Ranged/RaidersGlory.cs | 3 +- Items/Weapons/Ranged/Scorpion.cs | 2 +- Items/Weapons/Ranged/Seabow.cs | 3 +- Items/Weapons/Ranged/Shellshooter.cs | 3 +- Items/Weapons/Ranged/SpectralstormCannon.cs | 2 +- Items/Weapons/Rogue/CorpusAvertor.cs | 3 +- Items/Weapons/Rogue/CraniumSmasher.cs | 3 +- Items/Weapons/Rogue/EclipsesFall.cs | 3 +- Items/Weapons/Rogue/Hypothermia.cs | 2 +- Items/Weapons/Rogue/KelvinCatalyst.cs | 3 +- Items/Weapons/Rogue/LunarKunai.cs | 2 +- Items/Weapons/Rogue/Malachite.cs | 3 +- Items/Weapons/Rogue/Mycoroot.cs | 2 +- Items/Weapons/Rogue/ProfanedTrident.cs | 3 +- Items/Weapons/Rogue/Quasar.cs | 3 +- .../Weapons/Rogue/ScourgeoftheCosmosThrown.cs | 3 +- Items/Weapons/Rogue/SylvanSlasher.cs | 3 +- Items/Weapons/Rogue/TimeBolt.cs | 3 +- Items/Weapons/Summon/AbandonedSlimeStaff.cs | 2 +- Items/Weapons/Summon/BensUmbrella.cs | 2 +- Items/Weapons/Summon/DreadmineStaff.cs | 3 +- Items/Weapons/Summon/EnergyStaff.cs | 3 +- Items/Weapons/Summon/GodspawnHelixStaff.cs | 3 +- Items/Weapons/Summon/InfectedRemote.cs | 2 +- Items/Weapons/Summon/LanternoftheSoul.cs | 2 +- Items/Weapons/Summon/Sirius.cs | 2 +- Items/Weapons/Summon/SunGodStaff.cs | 3 +- Items/Weapons/Summon/SunSpiritStaff.cs | 3 +- NPCs/CalamityGlobalNPC.cs | 747 +++++++++--------- 81 files changed, 505 insertions(+), 452 deletions(-) diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 95ba01c964..c5ac8b9fe2 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index f4dda677e9..38bbd2e6b6 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.useAmmo = AmmoID.Bullet; } - public override bool 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 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) diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index d2c56e9d06..e3d9745c97 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal 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) + 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); if (velocity.Length() > 5f) diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 9b25a662ec..afd41b0476 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.useAmmo = AmmoID.Bullet; } - public override bool 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 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) diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 5dbe7c8bbb..91aec7d77a 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.useAmmo = AmmoID.Bullet; } - public override bool 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 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) diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index 310d688085..b2a3f00265 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 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) + 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, 3); for (int index = 0; index < num6; ++index) diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index c1d7c22130..12d3301906 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index b946a7036c..4451a7543b 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(10, 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 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/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 7ccb16dea5..147a521634 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int randomBullets = 0; randomBullets <= 4; randomBullets++) { diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index d380e2445d..777ab102c0 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow"), 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 85e32cc9ae..d9bebc5370 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 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) + 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 < 10; x++) diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index b25236887d..c844846ad9 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Dedicated; } - public override bool 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 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) diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index cdfdce12c8..e17ace5fba 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic 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) + 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) { diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 46fe27a1bc..77556128fd 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 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) + 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 index = 0; index < 4; ++index) { diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index ea864b3ab4..3871950373 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 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) + 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 num106 = 2 + Main.rand.Next(3); for (int num107 = 0; num107 < num106; num107++) diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index fb62663478..5c9108e9ca 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -47,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 20e93320d7..fb150cfe9d 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float spread = 60f * 0.0174f; double startAngle = Math.Atan2(speedX, speedY) - spread / 2; diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalTome.cs index 3a6e52a8ff..52e676c48b 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalTome.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic 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) + 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(1, 3); for (int index = 0; index < num6; ++index) diff --git a/Items/Weapons/Magic/StormSpray.cs b/Items/Weapons/Magic/StormSpray.cs index 0865a9b195..1d39ed22ff 100644 --- a/Items/Weapons/Magic/StormSpray.cs +++ b/Items/Weapons/Magic/StormSpray.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(10, 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 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/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 314379819f..b76bc6e8d1 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 159714b8f7..53538f21bf 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 5.5f; } - public override bool 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 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) diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index fdace77015..84a18c02f6 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 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) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { player.statLife -= 5; if (player.statLife <= 0) diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index b9d608533f..6ff0f3baab 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic 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 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; diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 42bc8cd60e..6edfcd2e38 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shoot = ProjectileID.LaserMachinegunLaser; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int beamAmt = 3; for (int index = 0; index < beamAmt; ++index) diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index a297dfa5b9..90852c6093 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.cs b/Items/Weapons/Melee/CorpusAvertorMelee.cs index 768a0e7aa4..01a9f3d804 100644 --- a/Items/Weapons/Melee/CorpusAvertorMelee.cs +++ b/Items/Weapons/Melee/CorpusAvertorMelee.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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; diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 55ba0008b4..781b5bec93 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.ItemSpecific; } - public override bool 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 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); diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 3b266c61d3..20211d1cd5 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); } - public override bool 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 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); diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index e0efd6d5f8..d47472a4fe 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index 3dcb5c06b6..016a11e406 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee.Spears; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.cs b/Items/Weapons/Melee/KelvinCatalystMelee.cs index 98acc894be..4141e27668 100644 --- a/Items/Weapons/Melee/KelvinCatalystMelee.cs +++ b/Items/Weapons/Melee/KelvinCatalystMelee.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Dedicated; } - public override bool 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 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/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 9cba7693da..1714a27389 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool 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 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/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 5b68f062c5..b225ad82c4 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index c7467821b6..8bd1bc30e5 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); } - public override bool 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 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); diff --git a/Items/Weapons/Melee/RedtideSword.cs b/Items/Weapons/Melee/RedtideSword.cs index fbc46fa451..98b7af3eb5 100644 --- a/Items/Weapons/Melee/RedtideSword.cs +++ b/Items/Weapons/Melee/RedtideSword.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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 / 2, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs index 313f6f4a40..8705a97247 100644 --- a/Items/Weapons/Melee/SoulEdge.cs +++ b/Items/Weapons/Melee/SoulEdge.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool 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 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) diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index 4851938639..8f81f86c68 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Spears; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -72,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee 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) + 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) Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index dbb5d98e0b..67cb7532f5 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.RareVariant; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int i = 0; i < 3; i++) { diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 3b9a7de80b..8d74533b68 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged this.SetTag("bow"); }*/ - public override bool 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index a88256fb59..63539ad4f4 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index e3b38044c0..efe3e790f5 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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) { diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index eaf9543241..3f238644d6 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index 37fad3b6a0..a807100e39 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 4a3fd3eec9..748e92202f 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs index a5527fb801..d8e224cffa 100644 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ b/Items/Weapons/Ranged/CursedCapper.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 66688140de..fda0b30f0f 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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) { diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 633c0a71c1..8986adf70c 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index d2d838fdf8..5653451a36 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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 index = 0; index < 3; ++index) { diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 141b5ea9f3..5dc282e178 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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 index = 0; index < 2; ++index) { diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 301b2db2d3..be4953ee6a 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index a6be6ea391..672f5635f7 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/ProporsePistol.cs b/Items/Weapons/Ranged/ProporsePistol.cs index 7521cfc973..02947b9352 100644 --- a/Items/Weapons/Ranged/ProporsePistol.cs +++ b/Items/Weapons/Ranged/ProporsePistol.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/RaidersGlory.cs b/Items/Weapons/Ranged/RaidersGlory.cs index 38fb9c5a4c..0e0b3a749a 100644 --- a/Items/Weapons/Ranged/RaidersGlory.cs +++ b/Items/Weapons/Ranged/RaidersGlory.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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 projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[projectile].extraUpdates++; diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index ac327b6e9d..af08c157ad 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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) { diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index d1c96c3770..83d15e5146 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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 + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index 0dd9232071..7858e7c7f2 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 90727d9e56..60b6c0023b 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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 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) diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 2b5627bb41..755992626d 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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, 1f); return false; diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index a44cde894d..9b22d9522f 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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(0, 5) == 0) { diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index a5b5051e3c..981ad55e52 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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()) { diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 9755c7b594..1f7e04b2a3 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { counter++; if (counter >= 7) diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 4077194c6d..f8dad5bc9b 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Dedicated; } - public override bool 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 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/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index a3b0f827c8..9419c1db49 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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); diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index d7a1285cf9..5f8a435485 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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) { diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 146f84dafd..3a8af59781 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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 + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index e70882ac58..13ca758e8b 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool 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 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, 0f, 0f); Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/Quasar.cs b/Items/Weapons/Rogue/Quasar.cs index cf4e42f337..99ef2e8cd1 100644 --- a/Items/Weapons/Rogue/Quasar.cs +++ b/Items/Weapons/Rogue/Quasar.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.RareVariant; } - public override bool 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 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/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs index 07806dd396..9be81be0ae 100644 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool 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 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/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs index 9a8288fc70..f05db9a4c8 100644 --- a/Items/Weapons/Rogue/SylvanSlasher.cs +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -34,7 +35,7 @@ Does not consume stealth and cannot stealth strike"); item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool 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 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/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 31d938e9c3..616e0932df 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + 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.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 74f8643fc1..3032e41aec 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Summon return slimeSlots >= 1; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int x = 0; x < Main.projectile.Length; x++) { diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index d448b643a0..0132e1a567 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 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) + 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; speedX = 0; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 7a90d5cd13..2b873ac060 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon item.sentry = 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { position = Main.MouseWorld; speedX = 0; diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index f32e7a1133..a4a858dfa5 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { position = Main.MouseWorld; speedX = 0; diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index dab100d2ad..d1fd6b2773 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon 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) + 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; speedX = 0; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 3520ec36a4..6b379cbbb8 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Summon return viruliSlots >= 1 && player.ownedProjectileCounts[item.shoot] <= 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int x = 0; x < Main.projectile.Length; x++) { diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index 6932952940..95673a3af0 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item44; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { position = Main.MouseWorld; speedX = 0; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index d20160ce12..37e60e7d4b 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon return siriusSlots >= 1; } - public override bool 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 Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int x = 0; x < Main.projectile.Length; x++) { diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 3d402eeb60..04f4be5b65 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon 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) + 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; speedX = 0; diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 392e0d7c34..a89447ebeb 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon 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) + 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; speedX = 0; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index eda1d73f2a..c64cb791ae 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -20,6 +20,7 @@ using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; @@ -71,7 +72,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Config; -using CalamityMod.Items.Weapons.Typeless; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs { @@ -279,27 +280,27 @@ namespace CalamityMod.NPCs /// public static List AstrumDeusIDs = new List { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() }; public static List AquaticScourgeIDs = new List { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + NPCType(), + NPCType(), + NPCType(), + NPCType() }; public static List DesertScourgeIDs = new List { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + NPCType(), + NPCType(), + NPCType() }; public static List EaterofWorldsIDs = new List @@ -318,9 +319,9 @@ namespace CalamityMod.NPCs public static List StormWeaverIDs = new List { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + NPCType(), + NPCType(), + NPCType() }; #endregion @@ -353,42 +354,42 @@ namespace CalamityMod.NPCs } for (int i = 0; i < bobbitWormBottom.Length; i++) - ResetSavedIndex(ref bobbitWormBottom[i], ModContent.NPCType()); + ResetSavedIndex(ref bobbitWormBottom[i], NPCType()); - ResetSavedIndex(ref hiveMind, ModContent.NPCType(), ModContent.NPCType()); - ResetSavedIndex(ref perfHive, ModContent.NPCType()); - ResetSavedIndex(ref slimeGodPurple, ModContent.NPCType(), ModContent.NPCType()); - ResetSavedIndex(ref slimeGodRed, ModContent.NPCType(), ModContent.NPCType()); - ResetSavedIndex(ref slimeGod, ModContent.NPCType()); + ResetSavedIndex(ref hiveMind, NPCType(), NPCType()); + ResetSavedIndex(ref perfHive, NPCType()); + ResetSavedIndex(ref slimeGodPurple, NPCType(), NPCType()); + ResetSavedIndex(ref slimeGodRed, NPCType(), NPCType()); + ResetSavedIndex(ref slimeGod, NPCType()); ResetSavedIndex(ref laserEye, NPCID.Retinazer); ResetSavedIndex(ref fireEye, NPCID.Spazmatism); ResetSavedIndex(ref primeLaser, NPCID.PrimeLaser); ResetSavedIndex(ref primeCannon, NPCID.PrimeCannon); ResetSavedIndex(ref primeVice, NPCID.PrimeVice); ResetSavedIndex(ref primeSaw, NPCID.PrimeSaw); - ResetSavedIndex(ref brimstoneElemental, ModContent.NPCType()); - ResetSavedIndex(ref cataclysm, ModContent.NPCType()); - ResetSavedIndex(ref catastrophe, ModContent.NPCType()); - ResetSavedIndex(ref calamitas, ModContent.NPCType()); - ResetSavedIndex(ref leviathan, ModContent.NPCType()); - ResetSavedIndex(ref siren, ModContent.NPCType()); - ResetSavedIndex(ref scavenger, ModContent.NPCType()); - ResetSavedIndex(ref astrumDeusHeadMain, ModContent.NPCType()); - ResetSavedIndex(ref energyFlame, ModContent.NPCType()); - ResetSavedIndex(ref doughnutBoss, ModContent.NPCType()); - ResetSavedIndex(ref holyBossAttacker, ModContent.NPCType()); - ResetSavedIndex(ref holyBossDefender, ModContent.NPCType()); - ResetSavedIndex(ref holyBossHealer, ModContent.NPCType()); - ResetSavedIndex(ref holyBoss, ModContent.NPCType()); - ResetSavedIndex(ref voidBoss, ModContent.NPCType()); - ResetSavedIndex(ref signus, ModContent.NPCType()); - ResetSavedIndex(ref ghostBossClone, ModContent.NPCType()); - ResetSavedIndex(ref ghostBoss, ModContent.NPCType()); - ResetSavedIndex(ref DoGHead, ModContent.NPCType(), ModContent.NPCType()); - ResetSavedIndex(ref SCalCataclysm, ModContent.NPCType()); - ResetSavedIndex(ref SCalCatastrophe, ModContent.NPCType()); - ResetSavedIndex(ref SCal, ModContent.NPCType()); - ResetSavedIndex(ref SCalWorm, ModContent.NPCType()); + ResetSavedIndex(ref brimstoneElemental, NPCType()); + ResetSavedIndex(ref cataclysm, NPCType()); + ResetSavedIndex(ref catastrophe, NPCType()); + ResetSavedIndex(ref calamitas, NPCType()); + ResetSavedIndex(ref leviathan, NPCType()); + ResetSavedIndex(ref siren, NPCType()); + ResetSavedIndex(ref scavenger, NPCType()); + ResetSavedIndex(ref astrumDeusHeadMain, NPCType()); + ResetSavedIndex(ref energyFlame, NPCType()); + ResetSavedIndex(ref doughnutBoss, NPCType()); + ResetSavedIndex(ref holyBossAttacker, NPCType()); + ResetSavedIndex(ref holyBossDefender, NPCType()); + ResetSavedIndex(ref holyBossHealer, NPCType()); + ResetSavedIndex(ref holyBoss, NPCType()); + ResetSavedIndex(ref voidBoss, NPCType()); + ResetSavedIndex(ref signus, NPCType()); + ResetSavedIndex(ref ghostBossClone, NPCType()); + ResetSavedIndex(ref ghostBoss, NPCType()); + ResetSavedIndex(ref DoGHead, NPCType(), NPCType()); + ResetSavedIndex(ref SCalCataclysm, NPCType()); + ResetSavedIndex(ref SCalCatastrophe, NPCType()); + ResetSavedIndex(ref SCal, NPCType()); + ResetSavedIndex(ref SCalWorm, NPCType()); } #endregion @@ -415,16 +416,16 @@ namespace CalamityMod.NPCs } bool inAbyss = ((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && ((double)(npc.position.Y / 16f) <= Main.maxTilesY - 250) && abyssPosX) || CalamityWorld.abyssTiles > 200; - bool hurtByAbyss = npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && inAbyss && !npc.buffImmune[ModContent.BuffType()]; + bool hurtByAbyss = npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && inAbyss && !npc.buffImmune[BuffType()]; if (hurtByAbyss) { - npc.AddBuff(ModContent.BuffType(), 2); + npc.AddBuff(BuffType(), 2); npc.DeathSound = null; npc.HitSound = null; } if (npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 && - !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[ModContent.BuffType()]) + !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[BuffType()]) { if (npc.wet) { @@ -433,7 +434,7 @@ namespace CalamityMod.NPCs if (Main.raining) { - npc.AddBuff(ModContent.BuffType(), 2); + npc.AddBuff(BuffType(), 2); } } @@ -448,7 +449,7 @@ namespace CalamityMod.NPCs for (int j = 0; j < Main.maxProjectiles; j++) { if (Main.projectile[j].active && - (Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType()) && + (Main.projectile[j].type == ProjectileType() || Main.projectile[j].type == ProjectileType() || Main.projectile[j].type == ProjectileType() || Main.projectile[j].type == ProjectileType()) && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) { projectileCount++; @@ -477,7 +478,7 @@ namespace CalamityMod.NPCs for (int j = 0; j < Main.maxProjectiles; j++) { if (Main.projectile[j].active && - (Main.projectile[j].type == ModContent.ProjectileType() && + (Main.projectile[j].type == ProjectileType() && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI)) { projectileCount++; @@ -506,7 +507,7 @@ namespace CalamityMod.NPCs for (int j = 0; j < Main.maxProjectiles; j++) { if (Main.projectile[j].active && - (Main.projectile[j].type == ModContent.ProjectileType()) && + (Main.projectile[j].type == ProjectileType()) && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI && projectileCount < 5) { @@ -534,9 +535,9 @@ namespace CalamityMod.NPCs { if (Main.projectile[j].active && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) { - if (Main.projectile[j].type == ModContent.ProjectileType()) + if (Main.projectile[j].type == ProjectileType()) projectileCount += 2; - if (Main.projectile[j].type == ModContent.ProjectileType()) + if (Main.projectile[j].type == ProjectileType()) projectileCount++; } } @@ -674,10 +675,10 @@ namespace CalamityMod.NPCs if (npc.boss && CalamityWorld.revenge) { - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { if (Main.netMode != NetmodeID.Server) { @@ -727,12 +728,12 @@ namespace CalamityMod.NPCs { if (CalamityMod.enemyImmunityList.Contains(npc.type) || npc.boss) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; } @@ -755,10 +756,10 @@ namespace CalamityMod.NPCs if (npc.buffImmune[BuffID.Venom] == false) { - npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[BuffType()] = false; } - npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[BuffType()] = false; } #endregion @@ -767,17 +768,17 @@ namespace CalamityMod.NPCs { if (!npc.friendly) { - npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; } @@ -1260,80 +1261,80 @@ namespace CalamityMod.NPCs } else if (npc.type == thorium.NPCType("TheGrandThunderBirdv2")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.5); } else if (npc.type == thorium.NPCType("QueenJelly")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.35); } else if (npc.type == thorium.NPCType("Viscount")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.25); } else if (npc.type == thorium.NPCType("GraniteEnergyStorm")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.1); } else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.2); } else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.3); } else if (npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("BoreanStriderPopped")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.4); } else if (npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.6); } else if (npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.6); } else if (npc.type == thorium.NPCType("Abyssion") || npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.5); } else if (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")) { - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffType()] = true; + npc.buffImmune[BuffType()] = true; npc.lifeMax = (int)(npc.lifeMax * 1.3); } @@ -1597,7 +1598,7 @@ namespace CalamityMod.NPCs { SetPatreonTownNPCName(npc); - if (npc.type == NPCID.TargetDummy || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.TargetDummy || npc.type == NPCType()) { npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses; npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses; @@ -1605,7 +1606,7 @@ namespace CalamityMod.NPCs if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type)) { - npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[BuffType()] = false; } if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.Hornet || npc.type == NPCID.HornetFatty || npc.type == NPCID.HornetHoney || @@ -1755,11 +1756,11 @@ namespace CalamityMod.NPCs switch (npc.aiStyle) { case 1: - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType()) + if (npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType()) { return CalamityGlobalAI.BuffedSlimeAI(npc, mod); } @@ -1793,7 +1794,7 @@ namespace CalamityMod.NPCs } break; case 2: - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == NPCType() || npc.type == NPCType()) { return CalamityGlobalAI.BuffedDemonEyeAI(npc, mod); } @@ -1819,8 +1820,8 @@ namespace CalamityMod.NPCs } break; case 3: - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType()) + if (npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType()) { return CalamityGlobalAI.BuffedFighterAI(npc, mod); } @@ -2096,7 +2097,7 @@ namespace CalamityMod.NPCs } break; case 14: - if (npc.type == ModContent.NPCType()) + if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedBatAI(npc, mod); } @@ -2298,7 +2299,7 @@ namespace CalamityMod.NPCs } break; case 91: - if (npc.type == ModContent.NPCType()) + if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedGraniteElementalAI(npc, mod); } @@ -2557,7 +2558,7 @@ namespace CalamityMod.NPCs break; case 2: - if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != ModContent.NPCType() && + if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != NPCType() && 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) { @@ -2597,8 +2598,8 @@ namespace CalamityMod.NPCs break; case 6: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2616,7 +2617,7 @@ namespace CalamityMod.NPCs break; case 8: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2643,7 +2644,7 @@ namespace CalamityMod.NPCs break; case 11: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && + if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) { npc.active = false; @@ -2664,9 +2665,9 @@ namespace CalamityMod.NPCs break; case 13: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2684,10 +2685,10 @@ namespace CalamityMod.NPCs break; case 15: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2696,11 +2697,11 @@ namespace CalamityMod.NPCs break; case 16: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2709,11 +2710,11 @@ namespace CalamityMod.NPCs break; case 17: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2734,7 +2735,7 @@ namespace CalamityMod.NPCs break; case 19: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2753,8 +2754,8 @@ namespace CalamityMod.NPCs break; case 21: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2763,11 +2764,11 @@ namespace CalamityMod.NPCs break; case 22: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2776,9 +2777,9 @@ namespace CalamityMod.NPCs break; case 23: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2787,7 +2788,7 @@ namespace CalamityMod.NPCs break; case 24: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2796,8 +2797,8 @@ namespace CalamityMod.NPCs break; case 25: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2806,11 +2807,11 @@ namespace CalamityMod.NPCs break; case 26: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2839,8 +2840,8 @@ namespace CalamityMod.NPCs break; case 29: - if (!AstrumDeusIDs.Contains(npc.type) && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (!AstrumDeusIDs.Contains(npc.type) && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2849,8 +2850,8 @@ namespace CalamityMod.NPCs break; case 30: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2859,9 +2860,9 @@ namespace CalamityMod.NPCs break; case 31: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2870,9 +2871,9 @@ namespace CalamityMod.NPCs break; case 32: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2881,9 +2882,9 @@ namespace CalamityMod.NPCs break; case 33: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2892,11 +2893,11 @@ namespace CalamityMod.NPCs break; case 34: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2905,8 +2906,8 @@ namespace CalamityMod.NPCs break; case 35: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2915,11 +2916,11 @@ namespace CalamityMod.NPCs break; case 36: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2928,8 +2929,8 @@ namespace CalamityMod.NPCs break; case 37: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2938,8 +2939,8 @@ namespace CalamityMod.NPCs break; case 38: - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -2956,10 +2957,10 @@ namespace CalamityMod.NPCs 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 == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType() || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) + npc.type == NPCID.Plantera || npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) { CalamityWorld.spawnedHardBoss = true; CalamityMod.UpdateServerBoolean(); @@ -3091,21 +3092,21 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) { - target.AddBuff(ModContent.BuffType(), 36000); + target.AddBuff(BuffType(), 36000); } } switch (npc.type) { case NPCID.Golem: - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffType(), 300); break; case NPCID.GolemHead: case NPCID.GolemHeadFree: case NPCID.GolemFistRight: case NPCID.GolemFistLeft: - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); break; case NPCID.Lavabat: @@ -3126,7 +3127,7 @@ namespace CalamityMod.NPCs case NPCID.AngryBonesBig: case NPCID.AngryBonesBigMuscle: case NPCID.AngryBonesBigHelmet: - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); break; default: @@ -3149,7 +3150,7 @@ namespace CalamityMod.NPCs case NPCID.HellArmoredBonesSpikeShield: case NPCID.HellArmoredBonesMace: case NPCID.HellArmoredBonesSword: - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 120); break; default: @@ -3184,15 +3185,15 @@ namespace CalamityMod.NPCs npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || npc.type == thorium.NPCType("Aquaius2")) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 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(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); } } } @@ -3209,7 +3210,7 @@ namespace CalamityMod.NPCs case NPCID.FaceMonster: case NPCID.BloodCrawler: case NPCID.BloodCrawlerWall: - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); break; case NPCID.DevourerHead: @@ -3239,7 +3240,7 @@ namespace CalamityMod.NPCs case NPCID.CrimsonGoldfish: case NPCID.CrimsonPenguin: case NPCID.Drippler: - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 120); break; case NPCID.EyeofCthulhu: @@ -3267,26 +3268,26 @@ namespace CalamityMod.NPCs case NPCID.Medusa: case NPCID.SandsharkCorrupt: case NPCID.SandsharkCrimson: - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); break; case NPCID.MourningWood: case NPCID.Pumpking: - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(BuffType(), 240); break; case NPCID.WallofFlesh: case NPCID.Krampus: - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffType(), 300); break; case NPCID.DungeonGuardian: - target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(BuffType(), 1200); break; case NPCID.Creeper: - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 60); + target.AddBuff(BuffType(), 120); break; case NPCID.CursedSkull: @@ -3295,48 +3296,48 @@ namespace CalamityMod.NPCs case NPCID.TheHungryII: case NPCID.PumpkingBlade: case NPCID.BloodZombie: - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 120); + target.AddBuff(BuffType(), 120); break; case NPCID.DarkMummy: - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 120); break; case NPCID.EaterofWorldsHead: case NPCID.GiantCursedSkull: case NPCID.Butcher: case NPCID.Psycho: - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); break; case NPCID.Wraith: case NPCID.VampireBat: case NPCID.Vampire: case NPCID.Reaper: - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 240); + target.AddBuff(BuffType(), 180); break; case NPCID.AncientCultistSquidhead: - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(BuffType(), 240); + target.AddBuff(BuffType(), 240); break; case NPCID.DungeonSpirit: - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 300); + target.AddBuff(BuffType(), 180); break; case NPCID.AncientDoom: - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffType(), 300); + target.AddBuff(BuffType(), 300); break; case NPCID.Snatcher: - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); break; case NPCID.BurningSphere: @@ -3344,7 +3345,7 @@ namespace CalamityMod.NPCs case NPCID.Mummy: case NPCID.EnchantedSword: case NPCID.Werewolf: - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffType(), 120); break; case NPCID.Spazmatism: @@ -3358,22 +3359,22 @@ namespace CalamityMod.NPCs case NPCID.Sharkron2: case NPCID.ShadowFlameApparition: case NPCID.MartianDrone: - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); break; case NPCID.Mimic: case NPCID.AngryTrapper: - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(BuffType(), 240); break; case NPCID.DetonatingBubble: - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(BuffType(), 360); break; case NPCID.PrimeSaw: case NPCID.PrimeVice: target.AddBuff(BuffID.Bleeding, 300); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); break; case NPCID.SkeletronPrime: @@ -3389,7 +3390,7 @@ namespace CalamityMod.NPCs case NPCID.GolemFistRight: case NPCID.GolemFistLeft: target.AddBuff(BuffID.BrokenArmor, 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); break; default: @@ -3449,19 +3450,19 @@ namespace CalamityMod.NPCs if (AstrumDeusIDs.Contains(npc.type)) { - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.1); } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) { damage = (int)(damage * 0.2); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.3); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3470,24 +3471,24 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType()) + else if (projectile.penetrate > 1 && projectile.type != ProjectileType()) { damage /= projectile.penetrate; } } else if (StormWeaverIDs.Contains(npc.type)) { - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.9); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { if (projectile.penetrate == -1) projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; damage = (int)(damage * 0.75); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3511,25 +3512,25 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.75); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.38); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { if (projectile.penetrate == -1) projectile.penetrate = 3; damage = (int)(damage * 0.3); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.25); } @@ -3540,15 +3541,15 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.7); } - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { if (projectile.penetrate == -1) projectile.penetrate = 3; @@ -3561,33 +3562,33 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.6); } - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.7); } } else if (DesertScourgeIDs.Contains(npc.type)) { - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.7); } } - else if (npc.type == ModContent.NPCType()) + else if (npc.type == NPCType()) { - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.2); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.6); } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.75); } @@ -3595,28 +3596,28 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.8); } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.9); } } else if (npc.type == NPCID.CultistBoss) { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.75); } } else if (npc.type == NPCID.DukeFishron) { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 1.35); } } - else if (npc.type == ModContent.NPCType()) + else if (npc.type == NPCType()) { - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { damage = (int)(damage * 1.5); } @@ -3660,15 +3661,15 @@ namespace CalamityMod.NPCs switch (Main.rand.Next(3)) { case 0: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; case 1: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; case 2: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; default: @@ -3684,15 +3685,15 @@ namespace CalamityMod.NPCs switch (Main.rand.Next(3)) { case 0: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; case 1: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; case 2: - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(BuffType(), 120); break; default: @@ -3723,10 +3724,10 @@ namespace CalamityMod.NPCs public override bool CheckDead(NPC npc) { if (npc.lifeMax > 1000 && npc.type != 288 && - npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && + npc.type != NPCType() && + npc.type != NPCType() && + npc.type != NPCType() && + npc.type != NPCType() && npc.value > 0f && npc.HasPlayerTarget && NPC.downedMoonlord && Main.player[npc.target].ZoneDungeon) @@ -3739,19 +3740,19 @@ namespace CalamityMod.NPCs switch (randomType) { case 0: - randomType = ModContent.NPCType(); + randomType = NPCType(); break; case 1: - randomType = ModContent.NPCType(); + randomType = NPCType(); break; case 2: - randomType = ModContent.NPCType(); + randomType = NPCType(); break; case 3: - randomType = ModContent.NPCType(); + randomType = NPCType(); break; default: @@ -3847,7 +3848,7 @@ namespace CalamityMod.NPCs break; } - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == NPCType() || npc.type == NPCType()) { if (npc.life <= npc.lifeMax * 0.25) { @@ -4028,9 +4029,9 @@ namespace CalamityMod.NPCs { PossibleEnemies = AcidRainEvent.PossibleEnemiesAS; PossibleMinibosses = AcidRainEvent.PossibleMinibossesAS; - if (!PossibleEnemies.ContainsKey(ModContent.NPCType())) + if (!PossibleEnemies.ContainsKey(NPCType())) { - PossibleEnemies.Add(ModContent.NPCType(), new AcidRainSpawnData(1, 0f, AcidRainSpawnRequirement.Anywhere)); + PossibleEnemies.Add(NPCType(), new AcidRainSpawnData(1, 0f, AcidRainSpawnRequirement.Anywhere)); } } if (CalamityWorld.downedPolterghast) @@ -4084,7 +4085,7 @@ namespace CalamityMod.NPCs } if (CalamityWorld.downedPolterghast) { - pool.Add(ModContent.NPCType(), AcidRainEvent.BloodwormSpawnRate); + pool.Add(NPCType(), AcidRainEvent.BloodwormSpawnRate); } } } @@ -4153,7 +4154,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -4170,7 +4171,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.25f; @@ -4203,7 +4204,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; @@ -4254,7 +4255,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 3) { - int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); + int dustType = Main.rand.NextBool(2) ? DustType() : DustType(); int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, dustType, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; @@ -4444,67 +4445,67 @@ namespace CalamityMod.NPCs // Damage over time debuffs if (aFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AbyssalFlames")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/AbyssalFlames")); if (astralInfection > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff")); if (bFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames")); if (bBlood > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BurningBlood")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/BurningBlood")); if (cDepth > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/CrushDepth")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/CrushDepth")); if (dFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/DemonFlames")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/DemonFlames")); if (gsInferno > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno")); if (hFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/HolyFlames")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/HolyFlames")); if (nightwither > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Nightwither")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Nightwither")); if (pFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Plague")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Plague")); if (shellfishVore > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/ShellfishEating")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/ShellfishEating")); if (pShred > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Shred")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Shred")); if (clamDebuff > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff")); if (sulphurPoison > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning")); if (vaporfied > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Vaporfied")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Vaporfied")); // Stat debuffs if (aCrunch > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ArmorCrunch")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/ArmorCrunch")); if (enraged > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Enraged")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/Enraged")); if (eutrophication > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Eutrophication")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/Eutrophication")); if (eFreeze > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ExoFreeze")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/ExoFreeze")); if (gState > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/GlacialState")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/GlacialState")); if (irradiated > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Irradiated")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/Irradiated")); if (marked > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/MarkedforDeath")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/MarkedforDeath")); if (pearlAura > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/PearlAura")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/PearlAura")); if (relicOfResilienceWeakness > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness")); if (silvaStun > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/SilvaStun")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/SilvaStun")); if (tSad > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TemporalSadness")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/TemporalSadness")); if (tesla > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TeslaFreeze")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/TeslaFreeze")); if (timeSlow > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TimeSlow")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/TimeSlow")); if (wCleave > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WarCleave")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/WarCleave")); if (wDeath > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WhisperingDeath")); + buffTextureList.Add(GetTexture("CalamityMod/Buffs/StatDebuffs/WhisperingDeath")); // Vanilla damage over time debuffs if (electrified > 0) @@ -4603,19 +4604,19 @@ namespace CalamityMod.NPCs if (CalamityMod.CalamityConfig.TownNPCNewShopInventoryAlertDisplay && npc.townNPC) { - if (npc.type == ModContent.NPCType() && Main.LocalPlayer.Calamity().newPermafrostInventory) + if (npc.type == NPCType() && Main.LocalPlayer.Calamity().newPermafrostInventory) { DrawNewInventoryAlert(npc); } - else if (npc.type == ModContent.NPCType() && Main.LocalPlayer.Calamity().newCirrusInventory) + else if (npc.type == NPCType() && Main.LocalPlayer.Calamity().newCirrusInventory) { DrawNewInventoryAlert(npc); } - else if (npc.type == ModContent.NPCType() && Main.LocalPlayer.Calamity().newAmidiasInventory) + else if (npc.type == NPCType() && Main.LocalPlayer.Calamity().newAmidiasInventory) { DrawNewInventoryAlert(npc); } - else if (npc.type == ModContent.NPCType() && Main.LocalPlayer.Calamity().newBanditInventory) + else if (npc.type == NPCType() && Main.LocalPlayer.Calamity().newBanditInventory) { DrawNewInventoryAlert(npc); } @@ -4716,7 +4717,7 @@ namespace CalamityMod.NPCs float drawPosY = npcHeight + npc.gfxOffY + 36f; // Texture animation variables - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/NPCAlertDisplay"); + Texture2D texture = GetTexture("CalamityMod/ExtraTextures/UI/NPCAlertDisplay"); shopAlertAnimTimer++; if (shopAlertAnimTimer >= 6) { @@ -4958,10 +4959,10 @@ namespace CalamityMod.NPCs public override void GetChat(NPC npc, ref string chat) { - int fapsol = NPC.FindFirstNPC(ModContent.NPCType()); - int permadong = NPC.FindFirstNPC(ModContent.NPCType()); - int seahorse = NPC.FindFirstNPC(ModContent.NPCType()); - int thief = NPC.FindFirstNPC(ModContent.NPCType()); + int fapsol = NPC.FindFirstNPC(NPCType()); + int permadong = NPC.FindFirstNPC(NPCType()); + int seahorse = NPC.FindFirstNPC(NPCType()); + int thief = NPC.FindFirstNPC(NPCType()); int angelstatue = NPC.FindFirstNPC(NPCID.Merchant); switch (npc.type) @@ -5005,7 +5006,7 @@ namespace CalamityMod.NPCs chat = "I don't feel very safe; I think there's pigs following me around and it frightens me."; } - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(NPCType())) { chat = "Sometimes, " + Main.npc[fapsol].GivenName + " just looks at me funny and I'm not sure how I feel about that."; } @@ -5013,7 +5014,7 @@ namespace CalamityMod.NPCs break; case NPCID.Angler: - if (Main.rand.NextBool(5) && NPC.AnyNPCs(ModContent.NPCType())) + if (Main.rand.NextBool(5) && NPC.AnyNPCs(NPCType())) { chat = "Someone tell " + Main.npc[seahorse].GivenName + " to quit trying to throw me out of town, it's not going to work."; } @@ -5021,7 +5022,7 @@ namespace CalamityMod.NPCs break; case NPCID.TravellingMerchant: - if (Main.rand.NextBool(5) && NPC.AnyNPCs(ModContent.NPCType()) && NPC.AnyNPCs(NPCID.Merchant)) + if (Main.rand.NextBool(5) && NPC.AnyNPCs(NPCType()) && NPC.AnyNPCs(NPCID.Merchant)) { chat = "Tell " + Main.npc[fapsol].GivenName + " I'll take up her offer and meet with her at the back of " + Main.npc[angelstatue].GivenName + "'s house."; } @@ -5087,7 +5088,7 @@ namespace CalamityMod.NPCs } if (Main.rand.NextBool(4) && Main.LocalPlayer.ZoneSnow) { - if (NPC.AnyNPCs(ModContent.NPCType()) && Main.rand.NextBool(2)) + if (NPC.AnyNPCs(NPCType()) && Main.rand.NextBool(2)) { chat = "Think " + Main.npc[permadong].GivenName + " would let me paint him like one of his French girls?!"; } @@ -5163,7 +5164,7 @@ namespace CalamityMod.NPCs chat = "That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond?"; } - if (Main.rand.NextBool(5) && NPC.AnyNPCs(ModContent.NPCType()) && Main.LocalPlayer.ZoneGlowshroom) + if (Main.rand.NextBool(5) && NPC.AnyNPCs(NPCType()) && Main.LocalPlayer.ZoneGlowshroom) { chat = Main.npc[fapsol].GivenName + " put me up to this."; } @@ -5308,12 +5309,12 @@ namespace CalamityMod.NPCs chat = "I have to thank ye again for takin' care of that sea serpent. Or was that another one..."; } - if (Main.rand.NextBool(5) && NPC.AnyNPCs(ModContent.NPCType())) + if (Main.rand.NextBool(5) && NPC.AnyNPCs(NPCType())) { chat = "I remember legends about that " + Main.npc[seahorse].GivenName + ". He ain't quite how the stories make him out to be though."; } - if (Main.rand.NextBool(5) && NPC.AnyNPCs(ModContent.NPCType())) + if (Main.rand.NextBool(5) && NPC.AnyNPCs(NPCType())) { chat = "Twenty-nine bottles of beer on the wall..."; } @@ -5474,7 +5475,7 @@ namespace CalamityMod.NPCs chat = "Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by!"; } - if (Main.rand.NextBool(10) && CalamityUtils.InventoryHas(Main.LocalPlayer, ModContent.ItemType())) + if (Main.rand.NextBool(10) && CalamityUtils.InventoryHas(Main.LocalPlayer, ItemType())) { chat = "Goodness! That cane has swagger!"; } @@ -5500,25 +5501,25 @@ namespace CalamityMod.NPCs { if (type == NPCID.Merchant) { - SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ModContent.ItemType()) || Main.LocalPlayer.HasItem(ModContent.ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); - SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ModContent.ItemType()) || Main.LocalPlayer.HasItem(ModContent.ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); + SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); + SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.ApprenticeBait, NPC.downedBoss1); SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Vilethorn : ItemID.CrimsonRod, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); - SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(ModContent.NPCType()) != -1, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); } // Because of the defiled condition, the dye trader does not receive an alert icon when hardmode starts. if (type == NPCID.DyeTrader) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode && CalamityWorld.defiled, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode && CalamityWorld.defiled, Item.buyPrice(0, 10)); } if (type == NPCID.ArmsDealer) { - SetShopItem(ref shop, ref nextSlot, ItemID.Stake, Main.LocalPlayer.HasItem(ModContent.ItemType())); + SetShopItem(ref shop, ref nextSlot, ItemID.Stake, Main.LocalPlayer.HasItem(ItemType())); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Musket : ItemID.TheUndertaker, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.Boomstick, NPC.downedQueenBee, price: Item.buyPrice(0, 20, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.TacticalShotgun, NPC.downedGolemBoss, Item.buyPrice(0, 25)); @@ -5527,16 +5528,16 @@ namespace CalamityMod.NPCs if (type == NPCID.Stylist) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.LocalPlayer.Calamity().rogueStealthMax > 0f && Main.LocalPlayer.Calamity().wearingRogueArmor); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.LocalPlayer.wingTimeMax > 0); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.Calamity().rogueStealthMax > 0f && Main.LocalPlayer.Calamity().wearingRogueArmor); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.wingTimeMax > 0); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage); } if (type == NPCID.Cyborg) { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedPolterghast); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPolterghast); } if (type == NPCID.Pirate) @@ -5550,41 +5551,41 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.NaturesGift, price: Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemID.SlimeCrown, NPC.downedSlimeKing && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 2)); SetShopItem(ref shop, ref nextSlot, ItemID.SuspiciousLookingEye, NPC.downedBoss1 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 3)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedCrabulon, Item.buyPrice(0, 4)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedCrabulon, Item.buyPrice(0, 4)); SetShopItem(ref shop, ref nextSlot, ItemID.BloodySpine, NPC.downedBoss2 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 6)); SetShopItem(ref shop, ref nextSlot, ItemID.WormFood, NPC.downedBoss2 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 6)); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BandofStarpower : ItemID.PanicNecklace, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.WormScarf : ItemID.BrainOfConfusion, Main.expertMode && NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedPerforator, Item.buyPrice(0, 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedPerforator && Main.expertMode); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedHiveMind, Item.buyPrice(0, 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedHiveMind && Main.expertMode); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedSlimeGod, Item.buyPrice(0, 15)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPerforator, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPerforator && Main.expertMode); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedHiveMind, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedHiveMind && Main.expertMode); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedSlimeGod, Item.buyPrice(0, 15)); + SetShopItem(ref shop, ref nextSlot, ItemType()); } if (type == NPCID.GoblinTinkerer) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(1)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(1)); SetShopItem(ref shop, ref nextSlot, ItemID.GoblinBattleStandard, price: Item.buyPrice(0, 1)); } if (type == NPCID.Clothier) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); SetShopItem(ref shop, ref nextSlot, ItemID.GoldenKey, Main.hardMode, Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.PumpkinMoonMedallion, NPC.downedHalloweenKing, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.NaughtyPresent, NPC.downedChristmasIceQueen, Item.buyPrice(0, 25)); @@ -5600,35 +5601,35 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalWorm, NPC.downedMechBoss1 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalEye, NPC.downedMechBoss2 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.MechanicalSkull, NPC.downedMechBoss3 && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), price: Item.buyPrice(0, 0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 0, 5)); } if (type == NPCID.Wizard) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, Item.buyPrice(0, 20)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedAstrageldon, Item.buyPrice(0, 25)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBrimstoneElemental, Item.buyPrice(0, 20)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedAstrageldon, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.MagicMissile, price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.SpectreStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.InfernoFork, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.ShadowbeamStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.CelestialSigil, NPC.downedMoonlord && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(3)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedGuardians, Item.buyPrice(5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedGuardians, Item.buyPrice(5)); } if (type == NPCID.WitchDoctor) { - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); + SetShopItem(ref shop, ref nextSlot, ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode); SetShopItem(ref shop, ref nextSlot, ItemID.Abeemination, CalamityMod.CalamityConfig.SellBossSummons, price: Item.buyPrice(0, 8)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), NPC.downedPlantBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedPlantBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.SolarTablet, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.LihzahrdPowerCell, NPC.downedGolemBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 30)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 10)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedScavenger, Item.buyPrice(0, 50)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedPlaguebringer, Item.buyPrice(0, 50)); - SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), CalamityWorld.downedBumble, Item.buyPrice(5)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedScavenger, Item.buyPrice(0, 50)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPlaguebringer, Item.buyPrice(0, 50)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBumble, Item.buyPrice(5)); } if (type == NPCID.SkeletonMerchant) @@ -5641,7 +5642,7 @@ namespace CalamityMod.NPCs { if (Main.moonPhase == 0) { - shop[nextSlot] = ModContent.ItemType(); + shop[nextSlot] = ItemType(); nextSlot++; } } @@ -5668,19 +5669,19 @@ namespace CalamityMod.NPCs { for (int i = 0; i < types.Length; i++) { - if (types[i] == ModContent.NPCType()) + if (types[i] == NPCType()) { Main.LocalPlayer.Calamity().newPermafrostInventory = true; } - else if (types[i] == ModContent.NPCType()) + else if (types[i] == NPCType()) { Main.LocalPlayer.Calamity().newCirrusInventory = true; } - else if (types[i] == ModContent.NPCType()) + else if (types[i] == NPCType()) { Main.LocalPlayer.Calamity().newAmidiasInventory = true; } - else if (types[i] == ModContent.NPCType()) + else if (types[i] == NPCType()) { Main.LocalPlayer.Calamity().newBanditInventory = true; } @@ -5760,8 +5761,8 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; 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 == ModContent.NPCType() || - Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) + (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == NPCType() || + Main.npc[i].type == NPCType() || Main.npc[i].type == NPCType() || Main.npc[i].type == NPCType())) { return true; } @@ -5790,8 +5791,8 @@ namespace CalamityMod.NPCs if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && - target.type != ModContent.NPCType() && target.type != ModContent.NPCType() && target.type != ModContent.NPCType() && - target.type != ModContent.NPCType() && target.type != ModContent.NPCType() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } From 33827e021814bf0a2f2e48d786f9dbd79cb82b22 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 10:31:40 -0400 Subject: [PATCH 044/137] made a healing proj AI method --- Projectiles/CalamityGlobalProjectile.cs | 46 ++++++++++++++++++++ Projectiles/Healing/AtaxiaHealOrb.cs | 43 +++--------------- Projectiles/Healing/AuricOrb.cs | 34 ++------------- Projectiles/Healing/BurntSiennaProj.cs | 40 +++-------------- Projectiles/Healing/CactusHealOrb.cs | 42 +++--------------- Projectiles/Healing/EarthHealOrb.cs | 40 +++-------------- Projectiles/Healing/EssenceFlame.cs | 30 +------------ Projectiles/Healing/Exoheal.cs | 40 +++-------------- Projectiles/Healing/FungalHeal.cs | 30 +------------ Projectiles/Healing/GodSlayerHealOrb.cs | 40 +++-------------- Projectiles/Healing/ManaOverloaderHealOrb.cs | 43 +++--------------- Projectiles/Healing/PhoenixHeal.cs | 30 +------------ Projectiles/Healing/RainHeal.cs | 31 +------------ Projectiles/Healing/RoyalHeal.cs | 30 +------------ Projectiles/Healing/ShinobiHealOrb.cs | 31 +------------ Projectiles/Healing/SilvaOrb.cs | 34 ++------------- Projectiles/Healing/TerracottaProj.cs | 30 +------------ Projectiles/Healing/TransfusionTrail.cs | 30 +------------ Projectiles/Healing/XerocHealOrb.cs | 30 +------------ 19 files changed, 100 insertions(+), 574 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1affebe818..2fe5a2ce0b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1967,6 +1967,52 @@ namespace CalamityMod.Projectiles } } + public static void HealingProjectile(Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120) + { + int target = playerToHeal; + Player player = Main.player[target]; + float homingSpeed = homingVelocity; + if (player.lifeMagnet) + homingSpeed *= 1.5f; + + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + if (playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int healAmt = healing; + player.HealEffect(healAmt, false); + player.statLife += healAmt; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + if (autoHomes) + { + playerDist = homingSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); + projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + } + else if (player.lifeMagnet && projectile.timeLeft < timeCheck) + { + playerDist = homingVelocity / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f); + projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f); + } + } + public static void FloatingPetAI(Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) { Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index cd2312f5d7..98aa375101 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -24,43 +24,12 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; - 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, 127, 0f, 0f, 100, default, 2f); - Main.dust[num500].noGravity = true; - 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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[dusty]; + dust.noGravity = true; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/AuricOrb.cs b/Projectiles/Healing/AuricOrb.cs index 7fa77e8d85..74adb60d7d 100644 --- a/Projectiles/Healing/AuricOrb.cs +++ b/Projectiles/Healing/AuricOrb.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Healing if (projectile.localAI[0] == 0f) { projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) + if (projectile.scale > 1.2f) { projectile.localAI[0] = 1f; } @@ -36,41 +36,13 @@ namespace CalamityMod.Projectiles.Healing else { projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) + if (projectile.scale < 0.8f) { projectile.localAI[0] = 0f; } } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f); return; } diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 6c379fd841..6c2ed80366 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -27,42 +27,12 @@ namespace CalamityMod.Projectiles.Healing 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 && !Main.player[Main.myPlayer].moonLeech) - { - 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(); - } - if (Main.player[num487].lifeMagnet && projectile.timeLeft < 120) - { - float num488 = 6f; - 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; - } - 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, 246, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num500]; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f, false); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 03a13de375..4d919c5b6a 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -26,42 +26,12 @@ namespace CalamityMod.Projectiles.Healing { projectile.velocity.Y *= 0.98f; - int num487 = projectile.owner; - 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 = 25; - 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(); - } - if (Main.player[num487].lifeMagnet && projectile.timeLeft < 120) - { - float num488 = 12f; - 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; - } - 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, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); - Dust dust = Main.dust[num500]; - dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + CalamityGlobalProjectile.HealingProjectile(projectile, 25, projectile.owner, 12f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); + Dust dust = Main.dust[dusty]; + dust.noGravity = true; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index cf5182f33f..1b0f469446 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -24,42 +24,12 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; - 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, 74, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num500]; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 24f49646a4..4b628fbf2a 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -38,35 +38,7 @@ namespace CalamityMod.Projectiles.Healing projectile.frame = 0; } - int num487 = (int)projectile.ai[0]; - float num488 = 3.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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 = 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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 3.5f, 15f); return; } diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index 9709142587..f2e6e2b59d 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -24,42 +24,12 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; - 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Dust dust = Main.dust[num500]; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 8921a2bbc1..885829ac9e 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -40,35 +40,7 @@ namespace CalamityMod.Projectiles.Healing projectile.localAI[0] += 1f; } - int num487 = (int)projectile.ai[0]; - float num488 = 5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5f, 15f); float num494 = projectile.velocity.X * 0.334f; float num495 = -(projectile.velocity.Y * 0.334f); int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 0.5f); diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index aa21e884f8..76ab25d25d 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -24,42 +24,12 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; - 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, 173, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num500]; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[dusty]; dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/ManaOverloaderHealOrb.cs b/Projectiles/Healing/ManaOverloaderHealOrb.cs index beceb093f6..4a6a1773a8 100644 --- a/Projectiles/Healing/ManaOverloaderHealOrb.cs +++ b/Projectiles/Healing/ManaOverloaderHealOrb.cs @@ -24,43 +24,12 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 3f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.5f; - - Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + 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(num489 * num489 + num490 * num490); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + 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, 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; - 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, 175, 0f, 0f, 100, default, 1.3f); - Main.dust[num500].noGravity = true; - 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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 3f, 15f); + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1.3f); + Dust dust = Main.dust[dusty]; + dust.noGravity = true; + dust.position.X -= projectile.velocity.X * 0.2f; + dust.position.Y += projectile.velocity.Y * 0.2f; } } } diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index 2c36dc2da9..d876795420 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -25,35 +25,7 @@ namespace CalamityMod.Projectiles.Healing { 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 && !Main.player[Main.myPlayer].moonLeech) - { - 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(); - } - if (Main.player[num487].lifeMagnet && projectile.timeLeft < 360) - { - float num488 = 6f; - 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; - } + CalamityGlobalProjectile.HealingProjectile(projectile, 10, (int)projectile.ai[0], 6f, 15f, false, 360); 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, 244, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 35fb70becc..492030d13b 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -26,35 +26,8 @@ namespace CalamityMod.Projectiles.Healing { projectile.velocity.X *= 0.985f; projectile.velocity.Y *= 0.985f; - int num487 = projectile.owner; - 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 = 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(); - } - if (Main.player[num487].lifeMagnet && projectile.timeLeft < 120) - { - float num488 = 12f; - 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; - } + CalamityGlobalProjectile.HealingProjectile(projectile, 8, projectile.owner, 12f, 15f, false); + 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 5872a3d6f5..a5f7a0fea3 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -22,35 +22,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); for (int num493 = 0; num493 < 3; num493++) { float num494 = projectile.velocity.X * 0.334f * (float)num493; diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index d79d4fba0d..0361dfd5df 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -26,36 +26,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = projectile.owner; - - float num488 = 6f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], projectile.owner, 6f, 15f); for (int num468 = 0; num468 < 3; num468++) { diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index 30b293bc9f..4da5cec31c 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Healing if (projectile.localAI[0] == 0f) { projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) + if (projectile.scale > 1.2f) { projectile.localAI[0] = 1f; } @@ -36,41 +36,13 @@ namespace CalamityMod.Projectiles.Healing else { projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) + if (projectile.scale < 0.8f) { projectile.localAI[0] = 0f; } } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f); return; } diff --git a/Projectiles/Healing/TerracottaProj.cs b/Projectiles/Healing/TerracottaProj.cs index bae4b5b362..14ae4bc480 100644 --- a/Projectiles/Healing/TerracottaProj.cs +++ b/Projectiles/Healing/TerracottaProj.cs @@ -27,35 +27,7 @@ namespace CalamityMod.Projectiles.Healing 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 && !Main.player[Main.myPlayer].moonLeech) - { - 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(); - } - if (Main.player[num487].lifeMagnet && projectile.timeLeft < 300) - { - float num488 = 8f; - 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; - } + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f, false, 300); 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, 246, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index b8f10e80a9..741959f1e7 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -22,35 +22,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f); float num494 = projectile.velocity.X * 0.334f; float num495 = -(projectile.velocity.Y * 0.334f); int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.7f); diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index cd41a696c3..5ab79c1a15 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -24,35 +24,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - if (Main.player[num487].lifeMagnet) - num488 *= 1.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; + CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); 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, 58, 0f, 0f, 100, default, 2f); From 01cc11a3f0463a87374073d2d206bce57953954d Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 10:44:48 -0400 Subject: [PATCH 045/137] made a damage soft cap method --- CalPlayer/CalamityPlayer.cs | 7 +-- Projectiles/CalamityGlobalProjectile.cs | 73 ++++--------------------- Utilities/CalamityUtils.cs | 10 ++++ 3 files changed, 22 insertions(+), 68 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 24d584e853..412cbec7e0 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5403,12 +5403,7 @@ namespace CalamityMod.CalPlayer } if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || proj.Calamity().stealthStrike)) { - int newDamage = (int)(proj.damage * 0.25); - if (newDamage > 50) - { - newDamage = (int)((proj.damage * 0.25 - 50) * 0.1) + 50; - } - Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI, 0f, 0f); } if (bloodflareMelee && isTrueMelee) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2fe5a2ce0b..b8eb395504 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1164,23 +1164,13 @@ namespace CalamityMod.Projectiles (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 6) { - int newDamage = (int)(projectile.damage * 0.25); - if (newDamage > 30) - { - newDamage = (int)((projectile.damage * 0.25 - 30) * 0.1) + 30; - } - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); Main.projectile[plague].Calamity().forceTypeless = false; } if (modPlayer.reaverBlast && projectile.melee) { - int newDamage = (int)(projectile.damage * 0.2); - if (newDamage > 30) - { - newDamage = (int)((projectile.damage * 0.2 - 30) * 0.1) + 30; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); } if (projectile.magic) @@ -1223,12 +1213,7 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)(projectile.damage * 0.15); - if (newDamage > 15) - { - newDamage = (int)((projectile.damage * 0.15 - 15) * 0.1) + 15; - } - int proj = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), newDamage, 0f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 15), 0f, projectile.owner, 0f, 0f); Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } @@ -1250,12 +1235,7 @@ namespace CalamityMod.Projectiles { if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { - int newDamage = (int)(projectile.damage * 0.15); - if (newDamage > 35) - { - newDamage = (int)((projectile.damage * 0.15 - 35) * 0.1) + 35; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); } } else if (rogue) @@ -1294,23 +1274,13 @@ namespace CalamityMod.Projectiles case 2: - int newDamage = (int)(projectile.damage * 0.15); - if (newDamage > 40) - { - newDamage = (int)((projectile.damage * 0.15 - 40) * 0.1) + 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); break; case 3: - int newDamage2 = (int)(projectile.damage * 0.2); - if (newDamage2 > 40) - { - newDamage = (int)((projectile.damage * 0.2 - 40) * 0.1) + 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), newDamage2, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); break; @@ -1481,12 +1451,7 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(4)) { - int newDamage = (int)(projectile.damage * 0.25); - if (newDamage > 100) - { - newDamage = (int)((projectile.damage * 0.25 - 100) * 0.1) + 100; - } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), newDamage, projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 100), projectile.knockBack * 0.25f, projectile.owner); modPlayer.jellyDmg = 20f; } } @@ -1495,13 +1460,8 @@ namespace CalamityMod.Projectiles if (Main.rand.NextBool(3)) { int cap = modPlayer.starTaintedGenerator ? 75 : 60; - int newDamage = (int)(projectile.damage * 0.5); - if (newDamage > cap) - { - newDamage = (int)((projectile.damage * 0.5 - cap) * 0.1) + cap; - } int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), - newDamage, 3f, projectile.owner); + CalamityUtils.DamageSoftCap(projectile.damage * 0.5, cap), 3f, projectile.owner); modPlayer.jellyDmg = 20f; } } @@ -1509,13 +1469,8 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(3)) { - int newDamage = (int)(projectile.damage * 0.25); - if (newDamage > 40) - { - newDamage = (int)((projectile.damage * 0.25 - 40) * 0.1) + 40; - } Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), - newDamage, 0f, projectile.owner); + CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 40), 0f, projectile.owner); modPlayer.jellyDmg = 20f; } } @@ -1555,12 +1510,7 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)(projectile.damage * 0.33); - if (newDamage > 65) - { - newDamage = (int)((projectile.damage * 0.33 - 65) * 0.1) + 65; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), newDamage, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); } } } @@ -1739,8 +1689,7 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)(projectile.damage * 0.33); - int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.LostSoulFriendly, newDamage, 0f, projectile.owner, 0f, 0f); + int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.LostSoulFriendly, (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); Main.projectile[soul].Calamity().forceRogue = true; Main.projectile[soul].timeLeft = 300; Main.projectile[soul].tileCollide = false; diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 7ec060b2b4..4204c4d2f5 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -642,6 +642,16 @@ namespace CalamityMod } } } + + public static int DamageSoftCap(double dmgInput, int cap) + { + int newDamage = (int)(dmgInput); + if (newDamage > cap) + { + newDamage = (int)((dmgInput - cap) * 0.1) + cap; + } + return newDamage; + } #endregion #region Tile Utilities From 3de6fc83371e4ce45a79594dd88cb9d0ebbc14fb Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 14:36:40 -0400 Subject: [PATCH 046/137] forgot to remove it from this list --- CalamityMod.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index e697c98295..4e7b27a69f 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1348,7 +1348,6 @@ namespace CalamityMod ItemID.PhoenixBlaster, ItemID.DD2BetsyBow, ItemID.InfluxWaver, - ItemID.LaserMachinegun, ItemID.Xenopopper, ItemID.ElectrosphereLauncher }; From 077fa6f8e7674d93de4f1f53feaee1bf8e76f3ef Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:12:15 -0400 Subject: [PATCH 047/137] changed some projectiles to use the new spawn life steal projectile method --- Items/Weapons/Melee/RoyalKnivesMelee.cs | 7 +- Items/Weapons/Rogue/RoyalKnives.cs | 4 +- Projectiles/Hybrid/CorpusAvertorClone.cs | 8 +- Projectiles/Hybrid/CorpusAvertorProj.cs | 8 +- Projectiles/Hybrid/EmpyreanKnife.cs | 22 ++-- .../{Rogue => Hybrid}/IllustriousKnife.cs | 18 ++-- .../{Rogue => Hybrid}/IllustriousKnife.png | Bin Projectiles/Melee/Earth4.cs | 8 +- Projectiles/Melee/EssenceScythe.cs | 2 +- Projectiles/Melee/Exocomet.cs | 8 +- Projectiles/Melee/RoyalKnifeMelee.cs | 95 ------------------ Projectiles/Melee/RoyalKnifeMelee.png | Bin 253 -> 0 bytes Projectiles/Ranged/ShockblastRound.cs | 8 +- Projectiles/Rogue/ShinobiBladeProjectile.cs | 4 +- Projectiles/Summon/FungalClumpMinion.cs | 8 +- 15 files changed, 41 insertions(+), 159 deletions(-) rename Projectiles/{Rogue => Hybrid}/IllustriousKnife.cs (81%) rename Projectiles/{Rogue => Hybrid}/IllustriousKnife.png (100%) delete mode 100644 Projectiles/Melee/RoyalKnifeMelee.cs delete mode 100644 Projectiles/Melee/RoyalKnifeMelee.png diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index 9abe8467c3..c502b927d9 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 20; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; item.Calamity().customRarity = CalamityRarity.Developer; } @@ -93,7 +93,8 @@ namespace CalamityMod.Items.Weapons.Melee num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[knife].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs index 491cb3d31e..2814bc4c33 100644 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ b/Items/Weapons/Rogue/RoyalKnives.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Projectiles/Hybrid/CorpusAvertorClone.cs b/Projectiles/Hybrid/CorpusAvertorClone.cs index 1bd9edd5c9..1210f3270e 100644 --- a/Projectiles/Hybrid/CorpusAvertorClone.cs +++ b/Projectiles/Hybrid/CorpusAvertorClone.cs @@ -85,9 +85,7 @@ namespace CalamityMod.Projectiles.Hybrid 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -98,9 +96,7 @@ namespace CalamityMod.Projectiles.Hybrid 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } } } diff --git a/Projectiles/Hybrid/CorpusAvertorProj.cs b/Projectiles/Hybrid/CorpusAvertorProj.cs index 0d6d1935cb..4e41dfb165 100644 --- a/Projectiles/Hybrid/CorpusAvertorProj.cs +++ b/Projectiles/Hybrid/CorpusAvertorProj.cs @@ -90,9 +90,7 @@ namespace CalamityMod.Projectiles.Hybrid 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -103,9 +101,7 @@ namespace CalamityMod.Projectiles.Hybrid 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } } } diff --git a/Projectiles/Hybrid/EmpyreanKnife.cs b/Projectiles/Hybrid/EmpyreanKnife.cs index 0ccd843fb8..17908efb24 100644 --- a/Projectiles/Hybrid/EmpyreanKnife.cs +++ b/Projectiles/Hybrid/EmpyreanKnife.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Hybrid 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.damage = (int)(projectile.damage * 0.95); + projectile.knockBack = projectile.knockBack * 0.95f; if (projectile.alpha >= 255) { projectile.active = false; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Hybrid } if (projectile.ai[0] < 75f) { - 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) + MathHelper.PiOver2; } else { @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Hybrid { return; } - float num = (float)damage * 0.005f; - if ((int)num == 0) + float healAmt = (float)damage * 0.005f; + if ((int)healAmt == 0) { return; } @@ -109,15 +109,13 @@ namespace CalamityMod.Projectiles.Hybrid { 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) { - float num = (float)damage * 0.005f; - if ((int)num == 0) + float healAmt = (float)damage * 0.005f; + if ((int)healAmt == 0) { return; } @@ -125,9 +123,7 @@ namespace CalamityMod.Projectiles.Hybrid { 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); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/IllustriousKnife.cs b/Projectiles/Hybrid/IllustriousKnife.cs similarity index 81% rename from Projectiles/Rogue/IllustriousKnife.cs rename to Projectiles/Hybrid/IllustriousKnife.cs index 4d27eeea5e..843ec6fe90 100644 --- a/Projectiles/Rogue/IllustriousKnife.cs +++ b/Projectiles/Hybrid/IllustriousKnife.cs @@ -6,7 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Rogue +namespace CalamityMod.Projectiles.Hybrid { public class IllustriousKnife : ModProjectile { @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Rogue { return; } - float num = (float)damage * 0.015f; - if ((int)num == 0) + float healAmt = (float)damage * 0.015f; + if ((int)healAmt == 0) { return; } @@ -78,16 +78,14 @@ namespace CalamityMod.Projectiles.Rogue { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 600); - float num = (float)damage * 0.015f; - if ((int)num == 0) + float healAmt = (float)damage * 0.015f; + if ((int)healAmt == 0) { return; } @@ -95,9 +93,7 @@ namespace CalamityMod.Projectiles.Rogue { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/IllustriousKnife.png b/Projectiles/Hybrid/IllustriousKnife.png similarity index 100% rename from Projectiles/Rogue/IllustriousKnife.png rename to Projectiles/Hybrid/IllustriousKnife.png diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 4be8960038..75586af9c4 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -95,8 +95,8 @@ namespace CalamityMod.Projectiles.Melee 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) + float healAmt = (float)damage * 0.075f; + if ((int)healAmt == 0) { return; } @@ -104,9 +104,7 @@ namespace CalamityMod.Projectiles.Melee { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 3a0999fd64..d863436f56 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, ModContent.ProjectileType(), 0, 0, projectile.owner, 0f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); } } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 77f949596a..6cbfc7d942 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -103,8 +103,8 @@ namespace CalamityMod.Projectiles.Melee { return; } - float num = (float)damage * 0.01f; - if ((int)num == 0) + float healAmt = (float)damage * 0.01f; + if ((int)healAmt == 0) { return; } @@ -112,9 +112,7 @@ namespace CalamityMod.Projectiles.Melee { return; } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/RoyalKnifeMelee.cs b/Projectiles/Melee/RoyalKnifeMelee.cs deleted file mode 100644 index 6b0648ec3b..0000000000 --- a/Projectiles/Melee/RoyalKnifeMelee.cs +++ /dev/null @@ -1,95 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Healing; -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 RoyalKnifeMelee : ModProjectile - { - 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 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; - } - - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); - - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 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, ModContent.ProjectileType(), 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; - } - } -} diff --git a/Projectiles/Melee/RoyalKnifeMelee.png b/Projectiles/Melee/RoyalKnifeMelee.png deleted file mode 100644 index d8793dd62483e3a93076e0a99980c2ffa4e705de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^LO`sw)N7dHKXT_F?9oysLz`O9724`)IkmQHf5bF}p zulBcIYfSpwm2{Gi@l0&x^o|*fSARFE87X*idU!5bq+}5v}_2vSD?%V)=?u~^B+#nA!c)I$ztaD0e0sx1}U%~(Y diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index af488c6eb4..fd7f0cefa0 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Ranged { return; } - float num = (float)damage * 0.05f; - if ((int)num == 0) + float healAmt = (float)damage * 0.05f; + if ((int)healAmt == 0) { return; } @@ -99,9 +99,7 @@ namespace CalamityMod.Projectiles.Ranged { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } } } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 19d008caaa..af1ab201fa 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { if (target.life <= 0) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer, 0, 10); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue { if (target.statLife <= 0) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer, 0, 10); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } } diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index bfe0d78b96..5eeb251297 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Summon { return; } - float num = (float)damage * 0.25f; - if ((int)num == 0) + float healAmt = (float)damage * 0.25f; + if ((int)healAmt == 0) { return; } @@ -99,9 +99,7 @@ namespace CalamityMod.Projectiles.Summon { return; } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } } } From 2bce08c68a11afad7b024e9f3c8126417fb83798 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:18:09 -0400 Subject: [PATCH 048/137] removed an unnecessary second counter --- Projectiles/CalamityGlobalProjectile.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b8eb395504..27bbbd6898 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles // Counters and Timers private int counter = 0; - private int counter2 = 0; public int lineColor = 0; //Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben public bool extorterBoost = false; @@ -743,10 +742,8 @@ namespace CalamityMod.Projectiles if (modPlayer.daedalusSplit && rogue) { - counter2++; - if (counter2 >= 30) + if (counter % 30 == 0) { - counter2 = 0; if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) { for (int num252 = 0; num252 < 2; num252++) From c4f80586522fef8efeeb0575c48cccc93bcbc329 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:58:37 -0500 Subject: [PATCH 049/137] More dye changes --- Effects/Dyes/DefiledFlameDyeShader.xnb | Bin 2880 -> 3420 bytes Effects/Dyes/DragonSoulDyeShader.xnb | Bin 3128 -> 3128 bytes Effects/Dyes/ElementalDyeShader.xnb | Bin 0 -> 2972 bytes Effects/Dyes/ReaverDyeShader.xnb | Bin 2692 -> 2824 bytes Effects/Dyes/ShadowspecDyeShader.xnb | Bin 3724 -> 3880 bytes Effects/Dyes/StratusDyeShader.xnb | Bin 3620 -> 3756 bytes Items/Dyes/ElementalDye.cs | 38 +++++++++++++++++++++++++ Items/Dyes/ElementalDye.png | Bin 0 -> 427 bytes Items/Dyes/EndothermicDye.cs | 2 +- Items/Dyes/ReaverDye.cs | 1 + Items/Dyes/ShadowspecDye.cs | 2 +- 11 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Effects/Dyes/ElementalDyeShader.xnb create mode 100644 Items/Dyes/ElementalDye.cs create mode 100644 Items/Dyes/ElementalDye.png diff --git a/Effects/Dyes/DefiledFlameDyeShader.xnb b/Effects/Dyes/DefiledFlameDyeShader.xnb index 73ea1c2d223dac221614cfea809b111a499ee35e..6ffdc1214bf3c204e5cf2aa1d4295c9dd90177f5 100644 GIT binary patch delta 1175 zcmY*XJ!lj`6n-;%yE}V#a{dIpNWk-ml@Ua-P$akJL=6OqaHkQ13Kmw1omlNjunZ_; zBc#|ATAUUMu~gY2g$E~C*yRd~D=n^60$IN|<6iCthMD=^``-7xx0@X89al>?=bpK= zeBiZOlb?#4?=MK<>Ylvltaij!+4&)&r;3PVn(n3dsNT3TH-%?iSj@x0Z>-8?U~h1d zlp_wWVSmK_jO}0xM7DAA`iboT5#&+NAVj}$O7ac&5AMuWf~o*L15ThSgVQ)AxdxkI zOn>oa^t$^|%9Q|g2}rTOH0w>yjdmGQjEuY^REgs5fa$9O@n2FEa- zcfp;=HJ@3vP;UeG7^b8o)$*ws!$?k&K&-hTDQ$VwT<3hoFa+kr`~1{k%y+;?14BON zI^ZKVhAC=Bv7&a2DMQp2%|w|LfDpjQDHy?zX9Nn=kBit@9)41YwM`u>E?O{U;+P{$ z8e=i%F(<0NjNz{x@&eRio&$_)uqmGU4F;^k ceFEMuIEg!A$N9`Hm4Nk4Q4>=obLao_AJ#_DkpKVy delta 734 zcmY*XJ8Tm{5PiGnyIo%(hX6sqDGV@dXt;bt4(YER|69Bp_56Zh}G;b`pEM({%m5u@`1@%4jor2>4SUMc|;!vD98^B>t7X=^s@u`ukPuf7#WJB_+aYp~qDD zg5%>{u*x`>c!a)B%V=c@+yP>Ptl*vUjlbuwvt57w>`Yy7OMEB$mhWWC!?m@`{E}h7 ztHjmO?GF#8K7M*Tm`ks1_Ie83hZ&w}Fepw?Gdbh1hO6ilmZVD@tf6GEt75N6=@TNA95x6CjfNWz zoAjrHMx*8`s1@W!8irV{8;vN0syxi3C{ok delta 34 pcmdlXu|r~mJtJeoWCzCYK+=L~F(bp|J4}|$PfJ)gOE4>N0szij3ef-n diff --git a/Effects/Dyes/ElementalDyeShader.xnb b/Effects/Dyes/ElementalDyeShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..d1eb643a8202bd74e767152c0615e4e4b8892dc6 GIT binary patch literal 2972 zcmbVMO>7%g5T0Gzi4!|@1wuk<1Qt?6iy|ut2}(p8hd2$1Fc9JdazLtFXH#2syy<#Z zZ4d`Xa3~T;Mf{w4Fo;8OE=EAPR1l#e5mZD~ai~;|zR^QLy_7?iZ{G9Uyas}RmyCDj zdo%OCnK!#jFHD||(8U;$@viZFso>aEd&NyHRr0B6C%S8j8}F&$2wNAJlDyW`;&9t$#SXi zoVC7SpSCK;Mu&$AE2Af^!DVY?U}WS;;$__JCi*FM=gL80${(Z4-??i_9orO!^hz`M zjY9KgSM#T=0a88_!LC$xeFiB6$bh(-kHR#FI$?MjyKFlY#9Y!G{w{{OdpWCMSC;e6 zx(sGNUcbnP_~r9icy&R%7uWKIlDp2f@{cPAV7h;t{d0MAIPaqEf&bBc{JAIIyzNTw z-TdW!{5#lxp|on@scQU0^W{6xOjvSBUbg2Hta;2&5PMT|=Bw09O2GDBv7PeroLw!6 za)Nr|?R)3!9HZhe#Nv*Dzx$runa91_gJnm3yZzp3A9qYc5}{64$k06^fP88P6IdIslt%<`_PTpASRS zIt=BgGVshoike-6eo?cpK)Q=#`lAJyzE^rB{;gZ{o|e*yivX5WS$)q2tk zeN?lTpu3v=HuOuH-D>Nc@}{Q0*XDc`*p`O3Ve+w*-sIsmeSgQFq0GWFlf5v1KhcMxbWsZUJ{qH zW8g%ionP+W|Le)o6z`Ap4U02G9`R0YZZd0Tqw=p+PYj(Hpx`^5JUo9SIg`z0ler>) z!jl<$b*)r}GL{;8Dm6ATlo}cx9;O|Cn&#$@=L~acddKez`gH<_F~<2tzYI#g3Vi^g zYCZ~`=k1^PV*9@3p8G!>~)y+2R>U~uEJHAPo?Cb*DJARy|m$Di5GiczT zisd>~PM(W6i>K)&qDYt$^}deTi8t;&HjeG|=ke_{;}PJu65A8E60=*F$O)pF zz&n7$uZI6`HXBcj|9I`1z&jvO6BLN-*{`+rd(jR{CQ2M*8Q_NN5i32x!u78=2UH%Gu zo__26`7zGl1AMd5;8FgXx#O9BR9Bqr&hfOqUXk4iQMvRvu29C zoW}&dh_e?FyZ90Eg&1QScN^qjJ4}9k@A?0YALpgoUVh+$+zp)7KrQNgu1(b)7JN`c zz|Ek>hP2~iuY(S?W7%#ASrR?zgzj&|(2p4S?_!OOZeS*SIZucZB2TBlC}iS(xaJ6A zm=oJ3?x&;8N!j`y^JSZJg^-tp&ok%%_j02P98Ef;VT&74V9a;duOa;I$9!;=emn`xP;QKJpBj#oR!#jg>TEZsb(?V@x4siwIovQJ-=1-3@ B-A4cb literal 0 HcmV?d00001 diff --git a/Effects/Dyes/ReaverDyeShader.xnb b/Effects/Dyes/ReaverDyeShader.xnb index 3028da4da366609c60b34cab6338e2db638fba91..a1985cce568e1b53dc127fec386bb5b1e10c00fa 100644 GIT binary patch delta 350 zcmXYrKT88a5XIll{n@=cLK-6}Y%R1&5iEkmNw5isU=a{)vA*9MF5rDss}oWi>ECTf%&G9ck?02 zzPA*#7M8#M*fYCoWunl{@9)0S;jm0+vv3Do2S5-pUsP4PsP;PVR`E4k6w?5G~X6;%r;|ye(K%+x9_uU*g|9>8F&V>I2 X;k1Y|TOF+zXJrn8>PFT~Hx2Lyw(L?l delta 199 zcmXYruM5IZ9K`Q^x3TYAS#kaV>w;;?V44hzMKB10e}&2VgawWAior08!8Y~}SPUlZ zTU@f6=R*v4;qLfwyLKAza+Yiyq~3u~RLT4@BmrH~$Pz%&wO)dbPVu%AOHa7fWB6I= zKgOj$y#Xo)5YGWe>NR(Sr}z9EFpx18SqRt!QUVJlQD>eJ0R~KpOvZXEqkz$z8P|Vf iD?`j#-(@6R{rP$5t@?m#IJI)k(i|hOZ@woXPCR@K|q$hxvld-_MTPc`VQed?G?iioyg zuV4-wiyXn4@n-C(U@={?f0b^k$%`YGlr=NDQ$0t+(}P0?k?|A8SQIz=DDU`=>pBcQ z2-_{(_h63%Q-VD=*gL@@f~^>AT`)_qPX@cKRjgZ&#Gat{udz%^1Mu3}sUD}{@v-Sv zop$EN=02?6=)3YhA4b3ATYJw;|Ltrmgtxo0_?XW|{+gUWCU48!L_5`QG&(ard_ezp zy0qtcddW>Swiq#T3qo=(7>}0^x^NGQ1d4=0Z z>utBatsZGMQO;Dl-^+~fcj3bvj=Vx1R#&u}n=w9Ilag1MD@=_wCce4Lo=$%4<*3h+ zDK2E{nWW-Ds+J{v*2TlF{Qt&no=LB{iQfIDiYs_(Fz%|V&BAw7-}Q0@kCMS=a<#CT z99scc__#JcFolK2f#-6W!rb7jhEzNOW z{eTGwCm_ZPP!vO~Vj5|Zd_`HmfwCqZ^%HdqvZ+J?K}1p6XAzzb{xVt?lF%>mgiK&^ zqLRZHHxh2GC^g`j9TJ`-I4iz#DgpZzB~epZCituqL8B7CjHHkx1S0S~GciwNF$s)| Zhlb)hVtCXXXwn&Xi^ITRA5#UOIPKXr z=pp{6VY7-eRE4(*_fc^|ai0>drZ`=3>j_5~W?t^Ho?@Umt8u4+ z;LUF%I!!~PBgIy^YTc9T))6~@^lb6>erFLx+kv}_#=H5ik2~KF#0g&pVs~?4Bf3Gu zrO}~`d|`JSE`&Si<3s3erdquOn=5&eO@{ijkOKy|A?|7m` zj%2#z9oLhddr0o^j+Jf7h1gQzO8pYsV&~Od-x!hUfM3Zi6;^U1;3oSZ9x(5MU-;GD z4_kQfv%Meu0P~qx=L5&Rs#N;tpG+y<1K-mllj-2a$MIS4BD*Xny)j|QRj;vJNB#_M zPsdaNg4jaLgrCAy=HL(G7>)gb4O~(&hQcneOMb$|IySIPl~kUO*h?Yk0L|`H zVMPGPMX>O6BY_Jsmm=AlZ9eY6=b%6bn!w{xO=PJS*2Dfa@27Lh=^VVH|K^}3aw4u1 z@`KaJ3iK^aOXX-(3yg$g9mHWFQAkA9xVEi0hbl9y7wc$cB>UAtY+9#Wz#?SV)W%pu zr)Zog0#6W+hhkxf@C#HTLM_IxCW71ah-y{VV|@eqj75S4u%L2WkOQ<-0}#i?Z8YG+ zh#N?71tL*^D^i%xnXT)zxWG0)nub5Z4G<*klrM?Bo`~rb6CQ28A%UXNcm_CwE9L1} gz=2r&#?*>KZh%lE=6FIv!!=CCh8$Z>9Yhh)U*_`rxc~qF diff --git a/Effects/Dyes/StratusDyeShader.xnb b/Effects/Dyes/StratusDyeShader.xnb index 98f77a508ada2187cbd1156a284a84ac0a40b058..60b17c77616475b30a268f9e783bc7da18bc15e4 100644 GIT binary patch delta 1047 zcmZ8eJ!lkB5T3Vtcl&dDcgDNug^L&@0VP_PH2#2lNk9k&LGU05rnCx}PQ>D#*l1x9 zriu_)@uxTF%jtlzx17h)d!_PzOL=9~HEy&YaVAB^`7va=kuaJa{hr?zhZm- zj$f^qm7Tk>&EAiZR1Xf)Rk}GpH&fwveynQz-5=+Rq0jYTNuA&q!MGaWPr)sI9z-04 zBdW@m!u$N$4|y-h@nRTF4P@PTI7OABX5t*f#1vmW!*e)m216`Qg;h?%(bdZQ{VzvEUK#?X9_ZduvNXiH`&?ajAG(m3gcf4+hjq zPz|5bM6E7Ss(pT3JljUUna2^24q=CguF7MO#cXEZ-+@0(#=xd5n=Vl=DP#BJpb2gYgBE6<|$H> zJP>q(Xp)_^AR?`e)3jiPlP*&F+UD38-2cmosFOs8Z59yUmz4u&2c2{@B%REXENEuN z1EoegM0$TZu2I=JoQ_OFT6G}|ZDb5SXsN4!LDCT{#RQMOgv6y9lJVL5(OP!G>Cmxa zzL1)y;HA1>KROI7q<9i6!WHL8M)G91N}Fjl{ Q&=YKVRq`u_BTb3^0WIs)mH+?% delta 999 zcmZ8gziSjx5T1E^d;9B-B;FlHjTj*odR0u5aLAq)5CW$lxNwLTHnx^26z*9W%kZiQ zfdxfyO|cSGu(PncK>h#=1KU{nqfo1?Gqbnx%;O&W=9@R)%=bNR=j@9)XK#R7ocS!*A0*?g@mqHWIDor^9Y;eTlF&~_U%NGH4xESPyW>vZm-RC&zQ00q$DKd* zY)e*Hd=J9I{0Uqe^jGWVlN;i+vAs6Vm_=_LPncI;+w}dK`Qml4Y0mp?Y?^ zZRUb`^vspugV!TE;*7x7u3*Nndom}cX z-Pl-Ryl%FGu;oG&R{-dT8X!sma_yKO!MR}-ASS_NB4>bi%*G)2+J|hS3N%ucqWnK5 z&>qDeu{YS@F~|S;gz|ZOfx0VD(xXPab=p)gl*S4oYL<+N`BHR@xWEeHGCxTyvUEvY z-lGP@6U8JdrL(1EK<17_q=Jr+rMJZ!Md~tYo~1siVnqrpiX+{V;wj0ao5dVk=3}if zB-+Q+ZajL0ZbOPxK^{(E$uT*6FVV%A#n~hIrB5hhCP#93bQ+L3#U@9*c8LRqY4s?` zb@7k|AwThC%$kdsy#m_FI6otC0Oi9w+8RGRf+IO3TWrF(o-xYPFpTxsR7Zk<8Vtlo ZE@B5V@r#QrA<8u0k-wcgB_w$c@E6^<%~AjW diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs new file mode 100644 index 0000000000..793e4d343e --- /dev/null +++ b/Items/Dyes/ElementalDye.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class ElementalDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ElementalDyeShader")), "DyePass").UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Elemental Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SolarDye); + recipe.AddIngredient(ItemID.VortexDye); + recipe.AddIngredient(ItemID.StardustDye); + recipe.AddIngredient(ItemID.NebulaDye); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/ElementalDye.png b/Items/Dyes/ElementalDye.png new file mode 100644 index 0000000000000000000000000000000000000000..2308343fb6d1034ebddccbe0e6a63dd3c04b2b28 GIT binary patch literal 427 zcmV;c0aX5pP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940YFJaK~y+TWBmXB zKLZFD8oEFjM1u3@_b`HJCNPfzzyhV=Aho6)OuGhaf$80AuYqY8nB7tdWkCSNF2D!_ z9(idnUqwaY5K+WQ+! zzuEH_Ob6eGgcbE%Ah_KLEPxJ}_i{m55HRyiI+(VfEd-`1b^(R~t-?xR3Bi6Tu_{gBSxOH$Gy3X-V{NXy7KFu~COjGWH0WOsp7yz_Y VZ|sGq3UmMf002ovPDHLkV1gS^qOSk| literal 0 HcmV?d00001 diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index d4b0ea8770..c145b058cb 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Dyes { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.DyeVat); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index 64d462cce1..f437db45a9 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Dyes; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index deaeab1a52..12c84124f1 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Dyes { public class ShadowspecDye : BaseDye { - public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/DragonSoulDyeShader")), "DyePass"). + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ShadowspecDyeShader")), "DyePass"). UseColor(new Color(46, 27, 60)).UseSecondaryColor(new Color(132, 142, 191)).UseImage("Images/Misc/Perlin"); public override void SafeSetStaticDefaults() { From 98783f0b315be26611142251f5cfecb23aadce40 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 09:43:10 -0400 Subject: [PATCH 050/137] deus resist changes and some code cleanup --- NPCs/CalamityGlobalNPC.cs | 66 +++++------- Projectiles/CalamityGlobalProjectile.cs | 131 ++++++++++++------------ 2 files changed, 93 insertions(+), 104 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c64cb791ae..a4669d960c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3450,22 +3450,30 @@ namespace CalamityMod.NPCs if (AstrumDeusIDs.Contains(npc.type)) { - if (projectile.type == ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.1); } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + else if (ProjectileID.Sets.StardustDragon[projectile.type]) { - damage = (int)(damage * 0.2); + damage = (int)(damage * 0.15); } - else if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.3); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.4); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.8); + } if (projectile.penetrate == -1 && !projectile.minion) { @@ -3658,23 +3666,13 @@ namespace CalamityMod.NPCs { if (isSummon && npc.damage > 0) { - switch (Main.rand.Next(3)) - { - case 0: - player.AddBuff(BuffType(), 120); - break; - - case 1: - player.AddBuff(BuffType(), 120); - break; - - case 2: - player.AddBuff(BuffType(), 120); - break; - - default: - break; - } + int buffType = Utils.SelectRandom(Main.rand, new int[] + { + BuffType(), + BuffType(), + BuffType() + }); + player.AddBuff(buffType, 120); } } @@ -3682,23 +3680,13 @@ namespace CalamityMod.NPCs { if (isSummon && npc.damage > 0) { - switch (Main.rand.Next(3)) - { - case 0: - player.AddBuff(BuffType(), 120); - break; - - case 1: - player.AddBuff(BuffType(), 120); - break; - - case 2: - player.AddBuff(BuffType(), 120); - break; - - default: - break; - } + int buffType = Utils.SelectRandom(Main.rand, new int[] + { + BuffType(), + BuffType(), + BuffType() + }); + player.AddBuff(buffType, 120); } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 27bbbd6898..089664b141 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles { @@ -690,8 +691,8 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 30) { //Note: these don't count as true melee anymore but its useful code to keep around - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || projectile.type == ProjectileID.SolarWhipSword) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileID.SolarWhipSword) { Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; if (Main.player[projectile.owner].direction != 1) @@ -716,25 +717,25 @@ namespace CalamityMod.Projectiles } } - if (modPlayer.nanotech && rogue && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + if (modPlayer.nanotech && rogue && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { if (counter % 30 == 0) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 25) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); } } } - if (modPlayer.dragonScales && rogue && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + if (modPlayer.dragonScales && rogue && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { if (counter % 50 == 0) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 15) { //spawn a dust that does 1/5th of the original damage - int projectileID = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ModContent.ProjectileType(), + int projectileID = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); } } @@ -901,9 +902,9 @@ namespace CalamityMod.Projectiles if (modPlayer.moonCrown && !modPlayer.nanotech) { //Summon moon sigils infrequently - if (Main.rand.NextBool(300) && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + if (Main.rand.NextBool(300) && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { - Projectile.NewProjectile(projectile.position, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), 0, projectile.owner); + Projectile.NewProjectile(projectile.position, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.2), 0, projectile.owner); } } } @@ -973,7 +974,7 @@ namespace CalamityMod.Projectiles if (!projectile.melee && player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, projectile.owner, 0f, 0f); - if (rogue && stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 2) + if (rogue && stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 2) { int projTileX = (int)(projectile.Center.X / 16f); int projTileY = (int)(projectile.Center.Y / 16f); @@ -1003,7 +1004,7 @@ namespace CalamityMod.Projectiles break; } } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ModContent.ProjectileType(), 420, 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), 420, 15f, Main.myPlayer, 16f, 16f); Main.projectile[projectileIndex].Calamity().forceRogue = true; Main.projectile[projectileIndex].netUpdate = true; Main.projectile[projectileIndex].localNPCHitCooldown = 1; @@ -1036,7 +1037,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != ModContent.NPCType()) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType()) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) @@ -1082,7 +1083,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } else if (modPlayer.silvaSet) { @@ -1093,7 +1094,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } else if (projectile.magic) { @@ -1106,7 +1107,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } else if (modPlayer.tarraMage) { @@ -1139,7 +1140,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } else if (modPlayer.manaOverloader) { @@ -1150,7 +1151,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } } } @@ -1159,15 +1160,15 @@ namespace CalamityMod.Projectiles if (modPlayer.alchFlask && (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) && - player.ownedProjectileCounts[ModContent.ProjectileType()] < 6) + player.ownedProjectileCounts[ProjectileType()] < 6) { - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); + int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); Main.projectile[plague].Calamity().forceTypeless = false; } if (modPlayer.reaverBlast && projectile.melee) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); } if (projectile.magic) @@ -1217,33 +1218,33 @@ namespace CalamityMod.Projectiles } else if (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) { - SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 20f); + SpawnOrb(projectile, 1.25f, ProjectileType(), 800f, 20f); int num = (int)(projectile.damage * 0.5f); modPlayer.ataxiaDmg += num; } else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) { - SpawnOrb(projectile, modPlayer.auricSet ? 2f : 1.5f, ModContent.ProjectileType(), 800f, 20f); + SpawnOrb(projectile, modPlayer.auricSet ? 2f : 1.5f, ProjectileType(), 800f, 20f); int num = (int)(projectile.damage * 0.5f); modPlayer.godSlayerDmg += num; } } else if (projectile.melee) { - if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); } } else if (rogue) { - if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) { switch (Main.rand.Next(5)) { case 0: - SpawnOrb(projectile, 1.6f, ModContent.ProjectileType(), 800f, Main.rand.Next(15, 30)); + SpawnOrb(projectile, 1.6f, ProjectileType(), 800f, Main.rand.Next(15, 30)); int num = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += num; @@ -1251,7 +1252,7 @@ namespace CalamityMod.Projectiles case 1: - SpawnOrb(projectile, 1.25f, ModContent.ProjectileType(), 800f, 30f); + SpawnOrb(projectile, 1.25f, ProjectileType(), 800f, 30f); int num2 = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += num2; @@ -1264,26 +1265,26 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto SKIPXEROC; - SpawnLifeStealProjectile(projectile, player, heal, ModContent.ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); } break; case 2: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); break; case 3: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); break; case 4: - SpawnOrb(projectile, 1.2f, ModContent.ProjectileType(), 800f, 15f); + SpawnOrb(projectile, 1.2f, ProjectileType(), 800f, 15f); int num3 = (int)(projectile.damage * 0.5f); modPlayer.xerocDmg += num3; @@ -1304,7 +1305,7 @@ namespace CalamityMod.Projectiles float speedX = (target.Center.X - pos.X) / 30f; float speedY = (target.Center.Y - pos.Y) * 8; int dmg = (int)(15 + (projectile.damage * 0.05f)); - int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), dmg, 3, projectile.owner, 0f, Main.rand.Next(15)); + int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ProjectileType(), dmg, 3, projectile.owner, 0f, Main.rand.Next(15)); Main.projectile[feather].Calamity().forceRogue = true; modPlayer.featherCrownCooldown = 15; } @@ -1331,7 +1332,7 @@ namespace CalamityMod.Projectiles Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (target.Center - pos) / 40f; int dmg = (int)(1000 + (projectile.damage * 0.05f)); - int flare = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(),dmg, 3f, projectile.owner, 0f, 0f); + int flare = Projectile.NewProjectile(pos, velocity, ProjectileType(),dmg, 3f, projectile.owner, 0f, 0f); Main.projectile[flare].Calamity().rogue = true; modPlayer.nanoFlareCooldown = 15; } @@ -1346,12 +1347,12 @@ namespace CalamityMod.Projectiles xVector *= 10f; yVector *= 10f; int dmg = (int)(75 + (projectile.damage * 0.05f)); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); modPlayer.forbiddenCooldown = 15; } } - if (modPlayer.corrosiveSpine && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType() && projectile.type != ModContent.ProjectileType()) + if (modPlayer.corrosiveSpine && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { for (int i = 0; i < 3; i++) { @@ -1361,13 +1362,13 @@ namespace CalamityMod.Projectiles switch (Main.rand.Next(15)) { case 0: - type = ModContent.ProjectileType(); + type = ProjectileType(); break; case 1: - type = ModContent.ProjectileType(); + type = ProjectileType(); break; case 2: - type = ModContent.ProjectileType(); + type = ProjectileType(); break; } // Should never happen, but just in case- @@ -1386,12 +1387,12 @@ namespace CalamityMod.Projectiles { if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { - target.AddBuff(ModContent.BuffType(), modPlayer.profanedCrystalBuffs ? 600 : 300); + target.AddBuff(BuffType(), modPlayer.profanedCrystalBuffs ? 600 : 300); } if (modPlayer.tearMinions) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); } if (modPlayer.shadowMinions) @@ -1411,8 +1412,8 @@ namespace CalamityMod.Projectiles if (modPlayer.starTaintedGenerator) { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); } // Fearmonger set's colossal life regeneration @@ -1425,7 +1426,7 @@ namespace CalamityMod.Projectiles if (modPlayer.godSlayerSummon && modPlayer.godSlayerDmg <= 0) { - SpawnOrb(projectile, 2f, ModContent.ProjectileType(), 800f, 15f, true); + SpawnOrb(projectile, 2f, ProjectileType(), 800f, 15f, true); int num = (int)(projectile.damage * 0.5f); modPlayer.godSlayerDmg += num; } @@ -1433,11 +1434,11 @@ namespace CalamityMod.Projectiles //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery List summonExceptionList = new List() { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() }; if (summonExceptionList.TrueForAll(x => projectile.type != x)) @@ -1448,7 +1449,7 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(4)) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 100), projectile.knockBack * 0.25f, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 100), projectile.knockBack * 0.25f, projectile.owner); modPlayer.jellyDmg = 20f; } } @@ -1457,7 +1458,7 @@ namespace CalamityMod.Projectiles if (Main.rand.NextBool(3)) { int cap = modPlayer.starTaintedGenerator ? 75 : 60; - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.5, cap), 3f, projectile.owner); modPlayer.jellyDmg = 20f; } @@ -1466,14 +1467,14 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(3)) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 40), 0f, projectile.owner); modPlayer.jellyDmg = 20f; } } else if (modPlayer.jellyChargedBattery) { - SpawnOrb(projectile, 1.05f, ModContent.ProjectileType(), 800f, 15f); + SpawnOrb(projectile, 1.05f, ProjectileType(), 800f, 15f); int num = (int)(projectile.damage * 0.5f); modPlayer.jellyDmg += num; } @@ -1487,7 +1488,7 @@ namespace CalamityMod.Projectiles Vector2 spawnPosition = target.Center - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); Projectile.NewProjectile(spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * speed, - ModContent.ProjectileType(), projectile.damage / 3, 3f, projectile.owner); + ProjectileType(), projectile.damage / 3, 3f, projectile.owner); } } } @@ -1495,7 +1496,7 @@ namespace CalamityMod.Projectiles if (projectile.ranged) { - if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 20 && (projectile.timeLeft <= 2 || projectile.penetrate <= 1)) + if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ProjectileType()] <= 20 && (projectile.timeLeft <= 2 || projectile.penetrate <= 1)) { int num251 = Main.rand.Next(2, 4); for (int num252 = 0; num252 < num251; num252++) @@ -1507,7 +1508,7 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); } } } @@ -1695,25 +1696,25 @@ namespace CalamityMod.Projectiles if (modPlayer.scuttlersJewel && CalamityMod.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) { float dmgMult = 1f; - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) dmgMult = 0.5f; - int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f * dmgMult), projectile.knockBack, projectile.owner); + int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.5f * dmgMult), projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; } } if (projectile.type == ProjectileID.UnholyWater) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, 1f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); } if (projectile.type == ProjectileID.BloodWater) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, 2f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); } if (projectile.type == ProjectileID.HolyWater) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner, 3f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); } } } @@ -1892,7 +1893,7 @@ namespace CalamityMod.Projectiles Vector2 value = projectile.Center + projectile.velocity * 4f; Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - value) * homingVelocity; - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ProjectileType()) { velocity.Y += Main.rand.Next(-30, 31) * 0.05f; velocity.X += Main.rand.Next(-30, 31) * 0.05f; @@ -1902,11 +1903,11 @@ namespace CalamityMod.Projectiles { int projectile2 = Projectile.NewProjectile(value.X, value.Y, velocity.X, velocity.Y, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || (projectile.type == ModContent.ProjectileType() && projectile.melee)) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileType() || (projectile.type == ProjectileType() && projectile.melee)) Main.projectile[projectile2].Calamity().forceMelee = true; - if (projectile.type == ModContent.ProjectileType() && projectile.Calamity().rogue) + if (projectile.type == ProjectileType() && projectile.Calamity().rogue) Main.projectile[projectile2].Calamity().forceRogue = true; } } From 6ce9a93cf2c07d72751ddf419986630038604a42 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 30 Apr 2020 10:55:02 -0500 Subject: [PATCH 051/137] Removed Last Prism nerf. Deus worms spread out more. --- Items/CalamityGlobalItem.cs | 2 -- NPCs/CalamityAI.cs | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index b72d2c1480..546469238f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -108,8 +108,6 @@ namespace CalamityMod.Items item.damage = (int)(item.damage * 1.1); else if (CalamityMod.tenDamageNerfList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 0.9); - else if (item.type == ItemID.LastPrism) - item.damage = (int)(item.damage * 0.85); else if (CalamityMod.quarterDamageNerfList?.Contains(item.type) ?? false) item.damage = (int)(item.damage * 0.75); else if (item.type == ItemID.BlizzardStaff) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 0e8a726a15..eb8debe7e2 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -3328,10 +3328,10 @@ namespace CalamityMod.NPCs if (Main.npc[i].active && Main.npc[i].type == npc.type && i != npc.whoAmI) { Vector2 vector = Main.npc[i].Center - npc.Center; - if (vector.Length() < 60f) + if (vector.Length() < 80f) { vector.Normalize(); - vector *= 200f; + vector *= 300f; num191 -= vector.X; num192 -= vector.Y; } From 84ebb792afc60ddc4e692d98e1a9f9ac5ae661c8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 13:02:32 -0400 Subject: [PATCH 052/137] code cleanup thingy --- Projectiles/Summon/AquaticStarMinion.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 1fc75cb697..012c839454 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon float num634 = 800f; float num635 = 1200f; float num636 = 150f; - float num637 = 0.05f; + float SAIMovement = 0.05f; for (int num638 = 0; num638 < Main.maxProjectiles; num638++) { bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); @@ -76,19 +76,19 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.position.X < Main.projectile[num638].position.X) { - projectile.velocity.X = projectile.velocity.X - num637; + projectile.velocity.X -= SAIMovement; } else { - projectile.velocity.X = projectile.velocity.X + num637; + projectile.velocity.X += SAIMovement; } if (projectile.position.Y < Main.projectile[num638].position.Y) { - projectile.velocity.Y = projectile.velocity.Y - num637; + projectile.velocity.Y -= SAIMovement; } else { - projectile.velocity.Y = projectile.velocity.Y + num637; + projectile.velocity.Y += SAIMovement; } } } From 3f18025e431bbece0a9480197116246c1e461aa5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 13:03:13 -0400 Subject: [PATCH 053/137] buffed amalgam --- CalPlayer/CalamityPlayer.cs | 35 ++-- Items/Accessories/FungalClump.cs | 14 +- Items/Accessories/TheAmalgam.cs | 234 ++++++++++++------------ Projectiles/Summon/FungalClumpMinion.cs | 186 ++++++++++++++++++- 4 files changed, 320 insertions(+), 149 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 412cbec7e0..8d712fd6a2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -401,6 +401,7 @@ namespace CalamityMod.CalPlayer public bool pAmulet = false; public bool fBarrier = false; public bool aBrain = false; + public bool amalgam = false; public bool lol = false; public bool raiderTalisman = false; public int raiderStack = 0; @@ -1419,6 +1420,7 @@ namespace CalamityMod.CalPlayer pAmulet = false; fBarrier = false; aBrain = false; + amalgam = false; frostFlare = false; beeResist = false; uberBees = false; @@ -6432,34 +6434,41 @@ namespace CalamityMod.CalPlayer } } } - if (aBrain) + if (aBrain || amalgam) { for (int m = 0; m < Main.maxNPCs; 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) + float npcDist = (Main.npc[m].Center - player.Center).Length(); + float range = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (range > 500f) { - num10 = 500f + (num10 - 500f) * 0.75f; + range = 500f + (range - 500f) * 0.75f; } - if (num10 > 700f) + if (range > 700f) { - num10 = 700f + (num10 - 700f) * 0.5f; + range = 700f + (range - 700f) * 0.5f; } - if (num10 > 900f) + if (range > 900f) { - num10 = 900f + (num10 - 900f) * 0.25f; + range = 900f + (range - 900f) * 0.25f; } - if (arg_67A_0 < num10) + if (npcDist < range) { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); - Main.npc[m].AddBuff(BuffID.Confused, (int)num11, false); + float duration = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); + Main.npc[m].AddBuff(BuffID.Confused, (int)duration, false); + if (amalgam) + { + Main.npc[m].AddBuff(ModContent.BuffType(), (int)duration, false); + Main.npc[m].AddBuff(ModContent.BuffType(), (int)duration, false); + Main.npc[m].AddBuff(ModContent.BuffType(), (int)duration, false); + Main.npc[m].AddBuff(ModContent.BuffType(), (int)duration, false); + } } } } - //spawn the harmless brain images that are actually projectiles + //Spawn the harmless brain images that are actually projectiles 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, ProjectileID.BrainOfConfusion, 0, 0f, player.whoAmI, 0f, 0f); } if (polarisBoost) diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index 7e157a9f74..cd885de770 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Items.Accessories { public class FungalClump : ModItem { + public const int FungalClumpDamage = 10; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); @@ -24,15 +26,7 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.fungalClump) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().fungalClump; public override void UpdateAccessory(Player player, bool hideVisual) { @@ -46,7 +40,7 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(10 * player.MinionDamage()), 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(FungalClumpDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); } } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 1ca24a1b49..7338190ab6 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { @@ -18,21 +19,24 @@ namespace CalamityMod.Items.Accessories { public const int FireProjectiles = 2; public const float FireAngleSpread = 120; - public int FireCountdown = 0; + public int counter = 0; + public const int ProjectileDamage = 2000; + public const int FungalClumpDamage = 1000; + public const int AuraDamage = 300; + public bool WaterBonuses = false; public override void SetStaticDefaults() { DisplayName.SetDefault("The Amalgam"); Tooltip.SetDefault("15% increased damage\n" + - "Shade rains down when you are hit\n" + - "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" + + "Shade and brimstone fire rain down when you are hit\n" + + "Nearby enemies receive a variety of debuffs when you are hit\n" + + "Brimstone fireballs drop from the sky occasionally\n" + + "Summons a fungal clump to fight for you that leaves behind poisonous seawater\n" + + "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in any liquid\n" + + "The above bonuses also apply when passing through the clump's poisonous seawater\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" + - "If you are damaged while submerged in liquid you will gain a damaging aura for a short time\n" + + "You have a damaging aura that envenoms nearby enemies and increased movement in liquids\n" + "Provides heat protection in Death Mode"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 6)); } @@ -47,147 +51,135 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.fungalClump) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().fungalClump; public override void UpdateAccessory(Player player, bool hideVisual) { + //Counter used for aura and Gehenna effects + counter++; + CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aBrain = true; + modPlayer.amalgam = true; modPlayer.fungalClump = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1000f * player.MinionDamage()), 1f, Main.myPlayer, 0f, 0f); - } - } - player.allDamage += 0.15f; player.ignoreWater = true; player.lavaRose = true; + player.allDamage += 0.15f; player.lavaMax += 240; if (player.lavaWet) { player.allDamage += 0.15f; } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + + //emit light + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); + + //Summon the Fungal Clump, ai[0] is 1f to indicate this is from the Amalgam, not the Fungal Clump + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(FungalClumpDamage * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); + } + } + + Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.active && proj.friendly && proj.type == ProjectileType() && proj.ai[0] == 1f && proj.damage > 0) + { + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + WaterBonuses = true; + } + } + } + if (WaterBonuses || player.IsUnderwater()) { 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) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(2000 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); - } - } + if (player.immune) { if (Main.rand.NextBool(20)) { if (player.whoAmI == Main.myPlayer) { - for (int l = 0; l < 1; 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 type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int num19 = Projectile.NewProjectile(x, y, num15, num16, type, (int)(2000 * player.AverageDamage()), 1f, player.whoAmI, 0f, 0f); - Main.projectile[num19].tileCollide = false; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].usesIDStaticNPCImmunity = false; - Main.projectile[num19].Calamity().forceTypeless = true; - } + float x = player.position.X + Main.rand.NextFloat(-400, 400); + float y = player.position.Y - Main.rand.NextFloat(500, 800); + Vector2 projOrigin = new Vector2(x, y); + float xDist = player.Center.X - projOrigin.X; + float yDist = player.Center.Y - projOrigin.Y; + xDist += Main.rand.NextFloat(-100, 100); + float speed = 22f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + playerDist = speed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + int type = Main.rand.NextBool(2) ? ProjectileType() : ProjectileType(); + int rain = Projectile.NewProjectile(projOrigin, playerVector, type, (int)(ProjectileDamage * player.AverageDamage()), 1f, player.whoAmI, 0f, 0f); + Projectile proj = Main.projectile[rain]; + proj.tileCollide = false; + proj.usesLocalNPCImmunity = true; + proj.localNPCHitCooldown = 10; + proj.usesIDStaticNPCImmunity = false; + proj.Calamity().forceTypeless = true; } } } - int seaCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); - int num = BuffID.Venom; - float num2 = 300f; - bool flag = seaCounter % 60 == 0; - int num3 = (int)(320 * player.AverageDamage()); - int random = Main.rand.Next(5); + int buffType = BuffID.Venom; + float auraRange = 300f; + int auraDmg = (int)(AuraDamage * player.AverageDamage()); if (player.whoAmI == Main.myPlayer) { - if (random == 0 && player.immune && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - for (int l = 0; l < Main.maxNPCs; 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, 300, false); - } - if (flag) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); - } - } - } - } - } - } - seaCounter++; - if (seaCounter >= 180) - { - } - if (FireCountdown == 0) - { - FireCountdown = 600; - } - if (FireCountdown > 0) - { - FireCountdown--; - if (FireCountdown == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - for (int i = 0; i < FireProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(2000 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - } - } - } + for (int l = 0; l < Main.maxNPCs; l++) + { + NPC npc = Main.npc[l]; + if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= auraRange) + { + if (npc.FindBuffIndex(buffType) == -1 && !npc.buffImmune[buffType]) + { + npc.AddBuff(buffType, 300, false); + } + if (counter % 30 == 0) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ProjectileType(), auraDmg, 0f, player.whoAmI, l); + } + } + } + } } + if (counter % 480 == 0) + { + if (player.whoAmI == Main.myPlayer) + { + int speed = 25; + float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed; + for (int i = 0; i < FireProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X += i * 30 - (FireProjectiles * 15); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + velocity.X += 3 * Main.rand.NextFloat() - 1.5f; + Projectile.NewProjectile(spawn, velocity, ProjectileType(), (int)(ProjectileDamage * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); + } + } + } } public override void AddRecipes() diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index 5eeb251297..04f6c10f2b 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,8 @@ namespace CalamityMod.Projectiles.Summon { public class FungalClumpMinion : ModProjectile { + private bool returnToPlayer = false; + private bool amalgam = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); @@ -25,7 +29,6 @@ namespace CalamityMod.Projectiles.Summon projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.minionSlots = 0f; - projectile.aiStyle = 54; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.timeLeft *= 5; @@ -35,15 +38,16 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + + bool correctMinion = projectile.type == ModContent.ProjectileType(); if (!modPlayer.fungalClump) { projectile.active = false; return; } - if (flag64) + if (correctMinion) { if (player.dead) { @@ -54,6 +58,9 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } + amalgam = projectile.ai[0] == 1f; + + //Initializing dust and damage if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); @@ -71,6 +78,8 @@ namespace CalamityMod.Projectiles.Summon } projectile.localAI[0] += 1f; } + + //Flexible damage correction if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / @@ -78,11 +87,178 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } + + //Periodically create dust 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); } - } + + //Anti-sticky movement failsafe + float SAIMovement = 0.05f; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + bool typeCheck = proj.type == ModContent.ProjectileType(); + if (i != projectile.whoAmI && proj.active && proj.owner == projectile.owner && typeCheck && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < (float)projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= SAIMovement; + } + else + { + projectile.velocity.X += SAIMovement; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= SAIMovement; + } + else + { + projectile.velocity.Y += SAIMovement; + } + } + } + + //If summoned by Amalgam, trail poisonous seawater + if (Math.Abs(projectile.velocity.X) > 0.1f || Math.Abs(projectile.velocity.Y) > 0.1f) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); + } + } + + //If too far from player, increase speed to chase after player + float playerRange = 500f; + //Range is boosted if chasing after an enemy + if (projectile.ai[1] != 0f || projectile.friendly) + playerRange = amalgam ? 2000f : 1400f; + if (Math.Abs(projectile.Center.X - player.Center.X) + Math.Abs(projectile.Center.Y - player.Center.Y) > playerRange) + returnToPlayer = true; + + //Find an npc to target, or if minion targetting is used, choose that npc + Vector2 center = projectile.Center; + float range = 900f; + bool npcFound = false; + if (!returnToPlayer) + { + projectile.tileCollide = true; + NPC target = projectile.OwnerMinionAttackTargetNPC; + if (target != null && target.CanBeChasedBy(projectile, false)) + { + float extraDistance = (target.width / 2) + (target.height / 2); + + if (Vector2.Distance(target.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + { + center = target.Center; + npcFound = true; + } + } + if (!npcFound) + { + for (int index = 0; index < Main.maxNPCs; ++index) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + center = npc.Center; + npcFound = true; + } + } + } + } + } + + //Tile collision depends on if returning to the player or not + projectile.tileCollide = !returnToPlayer; + + if (!npcFound) + { + projectile.friendly = true; + float homingSpeed = amalgam ? 12f : 8f; + float turnSpeed = 20f; + if (returnToPlayer) //move faster if returning to the player + homingSpeed = amalgam ? 30f : 12f; + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y - 60f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + projectile.ai[0] = 0f; + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - projectile.width / 2; + projectile.position.Y = player.Center.Y - projectile.width / 2; + } + if (playerDist > 70f) + { + Vector2 homeInVector = projectile.DirectionTo(playerVector); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * homingSpeed) / (turnSpeed + 1f); + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + projectile.friendly = false; + projectile.rotation = projectile.velocity.X * 0.05f; + if (Math.Abs(projectile.velocity.X) <= 0f) + return; + projectile.spriteDirection = -projectile.direction; + } + else + { + if (projectile.ai[1] == -1f) + projectile.ai[1] = 17f; + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + projectile.friendly = true; + float minionSpeed = amalgam ? 20f : 8f; + float turnSpeed = 14f; + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = center.X - projPos.X; + float yDist = center.Y - projPos.Y - 60f; + Vector2 targetVector = new Vector2(xDist, yDist); + float targetDist = targetVector.Length(); + if (targetDist < 100f) + minionSpeed = amalgam ? 25f : 10f; + + Vector2 homeInVector = projectile.DirectionTo(targetVector); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * minionSpeed) / (turnSpeed + 1f); + } + else + { + projectile.friendly = false; + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + projectile.velocity *= 1.05f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + if (Math.Abs(projectile.velocity.X) <= 0.2f) + return; + projectile.spriteDirection = -projectile.direction; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -90,7 +266,7 @@ namespace CalamityMod.Projectiles.Summon { return; } - float healAmt = (float)damage * 0.25f; + float healAmt = damage * 0.25f; if ((int)healAmt == 0) { return; From 9bee95baef0a918b78a3dccc1a848a07f4705e10 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 13:51:31 -0400 Subject: [PATCH 054/137] balance (brimstone sword sucks) --- Items/Weapons/Magic/ShiftingSands.cs | 6 ++-- Items/Weapons/Magic/TearsofHeaven.cs | 2 +- Items/Weapons/Rogue/BrackishFlask.cs | 2 +- Items/Weapons/Rogue/DefectiveSphere.cs | 43 ++++++++++++++------------ Items/Weapons/Rogue/FantasyTalisman.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 22 ++++++++----- Projectiles/Melee/Brimblast.cs | 29 ++++++++--------- Projectiles/Rogue/SphereSpiked.cs | 19 ++++++++---- Projectiles/Rogue/SphereYellow.cs | 4 +++ 9 files changed, 73 insertions(+), 56 deletions(-) diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index d5360a7bbf..6882e3429a 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 95; + item.damage = 85; item.magic = true; item.channel = true; item.mana = 20; item.width = 58; item.height = 58; - item.useTime = 18; - item.useAnimation = 18; + item.useTime = 30; + item.useAnimation = 30; item.useStyle = 1; item.noMelee = true; item.knockBack = 5f; diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 53538f21bf..f919aca926 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 64; item.magic = true; item.mana = 18; item.width = 28; diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 1c0ee14aba..0d96808f74 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 28; - item.damage = 40; + item.damage = 60; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 35; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 5e994416f4..b8ffaafa67 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Rogue { @@ -39,7 +40,7 @@ Stealth strikes launch all 4 sphere types at once"); item.rare = 8; item.Calamity().rogue = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ProjectileType(); item.shootSpeed = Speed; } @@ -51,7 +52,7 @@ Stealth strikes launch all 4 sphere types at once"); { return true; } - else if ((player.ownedProjectileCounts[item.shoot] + player.ownedProjectileCounts[ModContent.ProjectileType()] + player.ownedProjectileCounts[ModContent.ProjectileType()] + player.ownedProjectileCounts[ModContent.ProjectileType()]) >= UseMax) + else if ((player.ownedProjectileCounts[item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= UseMax) { return false; } @@ -63,28 +64,30 @@ Stealth strikes launch all 4 sphere types at once"); 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 sphereType = type; - if (Main.rand.NextBool(4)) - sphereType = ModContent.ProjectileType(); - else if (Main.rand.NextBool(3)) - sphereType = ModContent.ProjectileType(); - else if (Main.rand.NextBool(2)) - sphereType = ModContent.ProjectileType(); - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedX2 = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY2 = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedX3 = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY3 = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedX4 = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY4 = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int sphereType = Utils.SelectRandom(Main.rand, new int[] + { + type, + ProjectileType(), + ProjectileType(), + ProjectileType() + }); + + //Kinda ugly but idk how to make it cleaner + float SpeedX = speedX + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedY = speedY + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedX2 = speedX + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedY2 = speedY + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedX3 = speedX + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedY3 = speedY + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedX4 = speedX + Main.rand.NextFloat(-30, 30) * 0.05f; + float SpeedY4 = speedY + Main.rand.NextFloat(-30, 30) * 0.05f; if (player.Calamity().StealthStrikeAvailable()) { int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth3 = Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, ModContent.ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth4 = Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, ModContent.ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); + int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); + int stealth3 = Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); + int stealth4 = Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; Main.projectile[stealth2].Calamity().stealthStrike = true; Main.projectile[stealth3].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index fc2b07cbb1..6da32df8f8 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -20,7 +20,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void SafeSetDefaults() { item.width = 34; - item.damage = 90; + item.damage = 93; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a4669d960c..d4358a634b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3549,19 +3549,25 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { - damage = (int)(damage * 0.7); + damage = (int)(damage * 0.9); } if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 3; + projectile.penetrate = 2; damage = (int)(damage * 0.1); + } + else if (projectile.type == ProjectileType()) + { + if (projectile.penetrate == -1) + projectile.penetrate = 2; + damage = (int)(damage * 0.05); } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) @@ -3588,15 +3594,15 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.6); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.75); } @@ -3604,7 +3610,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.8); } - else if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.9); } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 223e206483..a6c73f0f7b 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -53,26 +53,23 @@ namespace CalamityMod.Projectiles.Melee } projectile.rotation += projectile.velocity.X * 0.1f; int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 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; + Dust dust = Main.dust[num199]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity.Y -= 4f; if (Main.rand.NextBool(2)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 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; + Dust dust2 = Main.dust[num200]; + dust2.position.X -= 2f; + dust2.position.Y += 2f; + dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + dust2.noGravity = true; + dust2.velocity *= 0.2f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { projectile.velocity.X = projectile.velocity.X * 0.8f; } diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index 34d6245d01..7808ab9153 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -29,24 +29,31 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Lighting.AddLight(projectile.Center, 1f, 0f, 0f); - if (projectile.timeLeft == 300) - projectile.damage *= (int)1.2f; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); } + if (projectile.ai[0] == 1f) + { + projectile.extraUpdates = 1; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 34); - if (Main.rand.NextBool(10)) //idk if this even works + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)(damage * 1.2); + if (Main.rand.NextBool(10)) { if (!crit) crit = true; } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 34); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index cdcbe0b3f6..9ef1d54930 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -33,6 +33,10 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100); } + if (projectile.ai[0] == 1f) + { + projectile.extraUpdates = 1; + } } public override bool OnTileCollide(Vector2 oldVelocity) From c1335ce7484769e236979d75bc902c0fa072cfb7 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 14:41:50 -0400 Subject: [PATCH 055/137] king slime jewel proj is no longer dust only & temp floe sword nerf --- Items/Weapons/Melee/TemporalFloeSword.cs | 6 +++ NPCs/NormalNPCs/KingSlimeJewel.cs | 51 ++++++++++---------- NPCs/NormalNPCs/ShockstormShuttle.cs | 6 +-- Projectiles/Boss/JewelProjectile.cs | 59 +++++++++++++++++++++++ Projectiles/Boss/JewelProjectile.png | Bin 0 -> 220 bytes 5 files changed, 93 insertions(+), 29 deletions(-) create mode 100644 Projectiles/Boss/JewelProjectile.cs create mode 100644 Projectiles/Boss/JewelProjectile.png diff --git a/Items/Weapons/Melee/TemporalFloeSword.cs b/Items/Weapons/Melee/TemporalFloeSword.cs index 157e672d3e..339acd5767 100644 --- a/Items/Weapons/Melee/TemporalFloeSword.cs +++ b/Items/Weapons/Melee/TemporalFloeSword.cs @@ -37,6 +37,12 @@ namespace CalamityMod.Items.Weapons.Melee 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.65), knockBack, player.whoAmI, 0f, 0f); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 78b6cf286e..d5e7e1dd12 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; using Terraria; @@ -106,42 +107,40 @@ namespace CalamityMod.NPCs.NormalNPCs { 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 npcPos = new Vector2(npc.Center.X, npc.Center.Y); + float xDist = Main.player[npc.target].Center.X - npcPos.X; + float yDist = Main.player[npc.target].Center.Y - npcPos.Y; + Vector2 projVector = new Vector2(xDist, yDist); + float projLength = projVector.Length(); - float num509 = CalamityWorld.bossRushActive ? 18f : 9f; - int num510 = 11; + float speed = CalamityWorld.bossRushActive ? 18f : 9f; + int damage = 11; if (CalamityWorld.death) - num510 += 1; - int num511 = ProjectileID.RubyBolt; + damage += 1; + int type = ModContent.ProjectileType(); - num508 = num509 / num508; - num506 *= num508; - num507 *= num508; - vector62.X += num506 * 2f; - vector62.Y += num507 * 2f; + projLength = speed / projLength; + projVector.X *= projLength; + projVector.Y *= projLength; + npcPos.X += projVector.X * 2f; + npcPos.Y += projVector.Y * 2f; - for (int num621 = 0; num621 < 10; num621++) + for (int dusty = 0; dusty < 10; dusty++) { - 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; + Vector2 dustVel = projVector; + dustVel.Normalize(); + int ruby = Dust.NewDust(npc.Center, npc.width, npc.height, 90, dustVel.X, dustVel.Y, 100, default, 2f); + Main.dust[ruby].velocity *= 1.5f; + Main.dust[ruby].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.dust[ruby].scale = 0.5f; + Main.dust[ruby].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); - // Protection against projectile cap - if(proj < Main.maxProjectiles) - Main.projectile[proj].Calamity().forceHostile = true; + int proj = Projectile.NewProjectile(npcPos, projVector, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 5a71dd141c..a3a866540a 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -61,10 +61,10 @@ namespace CalamityMod.NPCs.NormalNPCs { num184 = 22; } - int num185 = 435; //projectile ID + int num185 = ProjectileID.MartianTurretBolt; //projectile ID if (Main.rand.NextBool(8)) { - num185 = 449; //more powerful projectile ID + num185 = ProjectileID.SaucerLaser; //more powerful projectile ID } value9.X += num180; value9.Y += num182; @@ -457,7 +457,7 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - int num185 = 449; + int num185 = ProjectileID.SaucerLaser; value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs new file mode 100644 index 0000000000..85cf65a83a --- /dev/null +++ b/Projectiles/Boss/JewelProjectile.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class JewelProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruby Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.penetrate = 2; + projectile.hostile = true; + } + + public override void AI() + { + projectile.rotation += 0.3f * (float)projectile.direction; + for (int index = 0; index < 2; ++index) + { + int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, projectile.velocity.X, projectile.velocity.Y, 90, new Color(), 1.2f); + Dust dust = Main.dust[ruby]; + dust.noGravity = true; + dust.velocity *= 0.3f; + } + } + + public override Color? GetAlpha(Color drawColor) => new Color(255, 50, 50, 0); + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + for (int index1 = 0; index1 < 15; ++index1) + { + int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, projectile.oldVelocity.X, projectile.oldVelocity.Y, 50, new Color(), 1.2f); + Dust dust = Main.dust[ruby]; + dust.noGravity = true; + dust.scale *= 1.25f; + dust.velocity *= 0.5f; + } + } + + 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/JewelProjectile.png b/Projectiles/Boss/JewelProjectile.png new file mode 100644 index 0000000000000000000000000000000000000000..c289e663a302faf7ddd217d700eaaaafaf37d60c GIT binary patch literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`i#=T&Lo9leQyiGj>(2eZxLc9= z~H_uloKoHZU-#;P{vv+HhJmzi&?R zf-dfe1he-Q-zPH8_D(Q+Sj71>u|e*a!E}{-Hiu6fXt0hA&=q^|k|A7T!Ezf3j=&4Q z{6)nN__i-)FJa*3p7H0}{QD9haLs0i+tMi=dJTD#&8@|m&1NSyB#ARHOpUUc5PGJy Q0q9%?Pgg&ebxsLQ0I2#>Gynhq literal 0 HcmV?d00001 From 3a5ce57a691f73da0c251cc97d700de997c5bbeb Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 14:43:41 -0400 Subject: [PATCH 056/137] fixed dark spark sheeting error --- Items/Weapons/Magic/DarkSpark.png | Bin 1443 -> 1438 bytes Projectiles/Magic/DarkSparkPrism.png | Bin 1443 -> 1438 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Items/Weapons/Magic/DarkSpark.png b/Items/Weapons/Magic/DarkSpark.png index df1fa170eb4435e45b46a7e6ca29e0cea50f691f..b082a2a1f49a5dfe9a6722a690cb163dc35d435c 100644 GIT binary patch delta 1310 zcmV+(1>yRm3!V#*7Yeut1^@s6k5QhTks&oXGf6~2RCr$PoIPk{RTze6Wg9W6R}n<8 znnGMbq6kICB4PUg;f&qdJ|MN2=O7&Q*0{=H}*1rTzVVJAeP(&#nIa%V4Viou6W= z6m)Ogw7T@`?^Y*OuCx3_1ZU|T4hx3eQ?3*(pP_5ZR)kN z^H#od`E@&{eCC5>>Muv9%Ej^dwV}tUVF2d*Yfq)tURTp>oLz;>Zyf= z1*_^Y_~Q1^Yo9FE^IAS0+q?a}9WgFFx-xb&B|VR+x4PY~RX8{}uiLRvLAPrmzS-=`ue(6ozD*6yJ{8scb~S(NJY6T z&pu;yY5z;BDA!uW&R6vTPzZK*hOd+wWB%*Usz>8oefit!(f`w4kLh*d?(VMDy2^lh ztS&1ne?zYg9{~=m!jisCN>C2BMU# zeG_KoDJ5NxdEO#VqI<1$um5Y6?hU_BFE{43d^}b+eS?y|DKU@r|M=4?T)8#u@5j8B zuE!=#-@<5QL{36F9>ZI)^bI_Z=~}8IGv>8)Jr*PM$GmRiC`}XJ_IoVmt?ljY>d`nP ze<{p&Cq3CGE?QN%-pnU`)6Y`?%6RBp*Zb?Y>d_E-vgDZkyH;G<>oHvu@kmqfCS7X} z?Pe#JzCG~7LguZxcN2mlUXMQz6dFxUF5Z8`4yFC`SS&k=c~7$>&`e3+4gF+Z>*ukt z6@3&&D==!6So&61AtgP<6jcy(Z7u0rG7MD`rAqo%m^J0zx4P(lj_XNpMz2eLim6gi z(l?LTPIX%H@fbVZa_?JRxXKBi-h9}T;sZ5*9gpEHFChWV1K4Tk8VWix^S}4a%aUMi zZEg7A?lO|L!kx%UlEc?pPj)lEO&>+?hO z?~_a4f@0yAHhlx_ZE!uR1f@`Gl=jbKn!eGSU=5r!eFN0ecY}NCUU+_(S+;&28(W`$ zMv3K@5KG?_9i92#`=(0hE~KPyG1!#=N|p4jFl$QsRu|pRmGsR+m4cGKofi3c3~!b6 zttlmai=o}1lDoLz;>M2Gj=bFBiZ=M8iJ_FLXmpXkr>XM$v)LSKetB5|a zSo#(eLZwkk`lg)O^vz916w){SJU;7xBtG1G@j0uSzTr1j&ZGSvi|x0(9fYQD^kB<3 zPkP^Rr#)HD^Z({a<|9o&yzaB2-wKFwvA^f{O8OR*3P(^xeK<-!_r7`Qn|kKNBTo9} zsl~gZqn&)9{fa57;KTM@fs(#?sDkP(DCt`ab|rvP*`{yjj*rJ)aBFC(Vx7(vf9)Z! U$GwzYNdN!<07*qoM6N<$f~97)lK=n! delta 1315 zcmV+;1>E|c3!@8=7Yeor1^@s6wOjw~ks&oWI7vi7RCr$PoIPk{RTzdxu@RG6MG(Pi z3ULLAA{Y&r$|4KeWhBBDiUbQ?3r(?DM4Q1vf@rb2k&hgIo6mFa%&usOrSb&CQug`}_NL{@y#ES^fE!!BqddeTu14 z(Eawh)ums5w>qhE$tqT!SW_Cm|9ER_Ys=2BUH!@GSKoYMl~K9({-aixzWm#2Q?H$$ zxAN^vuh}twE%|$Fb#>LewXv~b=XeS581ow5+xxNd+8fQh)?Saz%2P_d9`n4Vo?2K~ zu&N$|&um;L6uaXp$%U`kBe(Q-R?Z=(v>m zGf!Jx+W*2T$|bAVLsh*86oQ?d;VY%anE(3I>d`n?Uiz+j^#7#mF}+UQ-QBfXR~b-` z)n#RWW$3lRV;@?@YxyV!jJCQQ9v)hqpP#o{7xf&YHvM@F<)Ep8brr)?pk6*YI!b#U z8(W`7Q3V-w%I4;#Rn}G%Q)R$YNXbtzMHK{;WS86P^{jgHpr??MzhWMql695wNLR7r z<5OSonUkzyGb8MP*#*yn_Kr&LS|Qf|iqSrQ#Z)OM>DyV+9*=pWu%vI35|l%|X~^GW zp0_|%I`LXb--KCtO3Bw_p0~)8=w2(`tN&W1d&BS3%Z+)hJszu@zClUfl$gi*fBb0` zF5ejT_hVkm*JG2WZ(%etA}1jqkKwIY`UalIbS>498S`4c9*YtBV_vs$l%|Pq`W}ma zd24%nyLvPZNec7bNl*6i3sx1bH`|lG>E|f`Wju7Q>;3gx^=Jq^S#r$&Z7VM6dQ8_u zJkk`rN!Qv#yV=>LZ}&X0ka=tF-Grcs*W(Wag+^183wJNtp`<^L#j>NA_cTia&6M=r z&`;(iKaY*A=%X-Nfl;f((zm(_DfuZrrl^9TYimj0VyKcRRnoWnO|pv3jB@W=U35Rk z^`tkW*QI@msZvnVH;>p(bz0ivF?PD;-nY7Nl@mU_dD@fL12umikKrvZApy+;*lFk* z3OX{|fA5=@CBfR-+VH_geJkhh-Z$-9dyp}qFdfD7lfD5;&~=WbZwl#~UVFCZ-Zwnu zB_Q5aH~oCC&kxbR&n|rniiKm^^bNGP!S$#TltQgh(x1mPeWN$Q8aQeC2B@X)2KUrG z|J*RMOnx34Tc3YMiRG6NOWzb7o$bH(O_k7HNJ-yfuqy$SD(Tz(CRxR1MoHi5qWig$ zzImupP|~-vqCFnNTP1yKN=e^hXg8>&Z<8`BPbv9&%=4CdiV@1Wrf=n&C&8P~fb{Lf zPT!8Yp|aC(C*Jzj>1RND~mR`>g1<0-{{(@AA_>077s ZAFrOZ$N3NL$Pxem002ovPDHLkV1lVvx#|D_ diff --git a/Projectiles/Magic/DarkSparkPrism.png b/Projectiles/Magic/DarkSparkPrism.png index df1fa170eb4435e45b46a7e6ca29e0cea50f691f..b082a2a1f49a5dfe9a6722a690cb163dc35d435c 100644 GIT binary patch delta 1310 zcmV+(1>yRm3!V#*7Yeut1^@s6k5QhTks&oXGf6~2RCr$PoIPk{RTze6Wg9W6R}n<8 znnGMbq6kICB4PUg;f&qdJ|MN2=O7&Q*0{=H}*1rTzVVJAeP(&#nIa%V4Viou6W= z6m)Ogw7T@`?^Y*OuCx3_1ZU|T4hx3eQ?3*(pP_5ZR)kN z^H#od`E@&{eCC5>>Muv9%Ej^dwV}tUVF2d*Yfq)tURTp>oLz;>Zyf= z1*_^Y_~Q1^Yo9FE^IAS0+q?a}9WgFFx-xb&B|VR+x4PY~RX8{}uiLRvLAPrmzS-=`ue(6ozD*6yJ{8scb~S(NJY6T z&pu;yY5z;BDA!uW&R6vTPzZK*hOd+wWB%*Usz>8oefit!(f`w4kLh*d?(VMDy2^lh ztS&1ne?zYg9{~=m!jisCN>C2BMU# zeG_KoDJ5NxdEO#VqI<1$um5Y6?hU_BFE{43d^}b+eS?y|DKU@r|M=4?T)8#u@5j8B zuE!=#-@<5QL{36F9>ZI)^bI_Z=~}8IGv>8)Jr*PM$GmRiC`}XJ_IoVmt?ljY>d`nP ze<{p&Cq3CGE?QN%-pnU`)6Y`?%6RBp*Zb?Y>d_E-vgDZkyH;G<>oHvu@kmqfCS7X} z?Pe#JzCG~7LguZxcN2mlUXMQz6dFxUF5Z8`4yFC`SS&k=c~7$>&`e3+4gF+Z>*ukt z6@3&&D==!6So&61AtgP<6jcy(Z7u0rG7MD`rAqo%m^J0zx4P(lj_XNpMz2eLim6gi z(l?LTPIX%H@fbVZa_?JRxXKBi-h9}T;sZ5*9gpEHFChWV1K4Tk8VWix^S}4a%aUMi zZEg7A?lO|L!kx%UlEc?pPj)lEO&>+?hO z?~_a4f@0yAHhlx_ZE!uR1f@`Gl=jbKn!eGSU=5r!eFN0ecY}NCUU+_(S+;&28(W`$ zMv3K@5KG?_9i92#`=(0hE~KPyG1!#=N|p4jFl$QsRu|pRmGsR+m4cGKofi3c3~!b6 zttlmai=o}1lDoLz;>M2Gj=bFBiZ=M8iJ_FLXmpXkr>XM$v)LSKetB5|a zSo#(eLZwkk`lg)O^vz916w){SJU;7xBtG1G@j0uSzTr1j&ZGSvi|x0(9fYQD^kB<3 zPkP^Rr#)HD^Z({a<|9o&yzaB2-wKFwvA^f{O8OR*3P(^xeK<-!_r7`Qn|kKNBTo9} zsl~gZqn&)9{fa57;KTM@fs(#?sDkP(DCt`ab|rvP*`{yjj*rJ)aBFC(Vx7(vf9)Z! U$GwzYNdN!<07*qoM6N<$f~97)lK=n! delta 1315 zcmV+;1>E|c3!@8=7Yeor1^@s6wOjw~ks&oWI7vi7RCr$PoIPk{RTzdxu@RG6MG(Pi z3ULLAA{Y&r$|4KeWhBBDiUbQ?3r(?DM4Q1vf@rb2k&hgIo6mFa%&usOrSb&CQug`}_NL{@y#ES^fE!!BqddeTu14 z(Eawh)ums5w>qhE$tqT!SW_Cm|9ER_Ys=2BUH!@GSKoYMl~K9({-aixzWm#2Q?H$$ zxAN^vuh}twE%|$Fb#>LewXv~b=XeS581ow5+xxNd+8fQh)?Saz%2P_d9`n4Vo?2K~ zu&N$|&um;L6uaXp$%U`kBe(Q-R?Z=(v>m zGf!Jx+W*2T$|bAVLsh*86oQ?d;VY%anE(3I>d`n?Uiz+j^#7#mF}+UQ-QBfXR~b-` z)n#RWW$3lRV;@?@YxyV!jJCQQ9v)hqpP#o{7xf&YHvM@F<)Ep8brr)?pk6*YI!b#U z8(W`7Q3V-w%I4;#Rn}G%Q)R$YNXbtzMHK{;WS86P^{jgHpr??MzhWMql695wNLR7r z<5OSonUkzyGb8MP*#*yn_Kr&LS|Qf|iqSrQ#Z)OM>DyV+9*=pWu%vI35|l%|X~^GW zp0_|%I`LXb--KCtO3Bw_p0~)8=w2(`tN&W1d&BS3%Z+)hJszu@zClUfl$gi*fBb0` zF5ejT_hVkm*JG2WZ(%etA}1jqkKwIY`UalIbS>498S`4c9*YtBV_vs$l%|Pq`W}ma zd24%nyLvPZNec7bNl*6i3sx1bH`|lG>E|f`Wju7Q>;3gx^=Jq^S#r$&Z7VM6dQ8_u zJkk`rN!Qv#yV=>LZ}&X0ka=tF-Grcs*W(Wag+^183wJNtp`<^L#j>NA_cTia&6M=r z&`;(iKaY*A=%X-Nfl;f((zm(_DfuZrrl^9TYimj0VyKcRRnoWnO|pv3jB@W=U35Rk z^`tkW*QI@msZvnVH;>p(bz0ivF?PD;-nY7Nl@mU_dD@fL12umikKrvZApy+;*lFk* z3OX{|fA5=@CBfR-+VH_geJkhh-Z$-9dyp}qFdfD7lfD5;&~=WbZwl#~UVFCZ-Zwnu zB_Q5aH~oCC&kxbR&n|rniiKm^^bNGP!S$#TltQgh(x1mPeWN$Q8aQeC2B@X)2KUrG z|J*RMOnx34Tc3YMiRG6NOWzb7o$bH(O_k7HNJ-yfuqy$SD(Tz(CRxR1MoHi5qWig$ zzImupP|~-vqCFnNTP1yKN=e^hXg8>&Z<8`BPbv9&%=4CdiV@1Wrf=n&C&8P~fb{Lf zPT!8Yp|aC(C*Jzj>1RND~mR`>g1<0-{{(@AA_>077s ZAFrOZ$N3NL$Pxem002ovPDHLkV1lVvx#|D_ From 64b0d6b2f59b4908a9c37ecaebc39d2bf675ff5b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:51:32 -0400 Subject: [PATCH 057/137] fixed celestial shell/stone not stacking rogue crit & some weapon nerfs --- Items/CalamityGlobalItem.cs | 7 +++++-- Items/Weapons/Ranged/BarracudaGun.cs | 7 +++---- Items/Weapons/Ranged/ClockGatlignum.cs | 10 +++++----- Items/Weapons/Ranged/LeadWizard.cs | 10 +++++----- NPCs/CalamityGlobalNPC.cs | 2 +- Projectiles/Ranged/MechanicalBarracuda.cs | 2 +- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 546469238f..de3ae8848c 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -3098,11 +3098,14 @@ Provides heat and cold protection in Death Mode"; if (item.type == ItemID.HandWarmer) modPlayer.handWarmer = true; - if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || - (item.type == ItemID.SunStone && Main.dayTime)) + if ((item.type == ItemID.MoonStone && !Main.dayTime) || (item.type == ItemID.SunStone && Main.dayTime)) { player.Calamity().throwingCrit += 2; } + if (item.type == ItemID.CelestialStone) + player.Calamity().throwingCrit += 2; + if (item.type == ItemID.CelestialShell) + player.Calamity().throwingCrit += 2; if (item.type == ItemID.DestroyerEmblem) player.Calamity().throwingCrit += 8; if (item.type == ItemID.EyeoftheGolem) diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 057bd01801..7af724d86d 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 76; + item.damage = 63; item.channel = true; item.ranged = true; item.width = 54; @@ -43,12 +43,11 @@ namespace CalamityMod.Items.Weapons.Ranged 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, 3); - for (int index = 0; index < num6; ++index) + for (int index = 0; index < 2; ++index) { 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); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 92693f929d..3963e48f50 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 60; + item.damage = 55; item.ranged = true; item.width = 66; item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 6; + item.useTime = 3; + item.reuseDelay = 12; + item.useAnimation = 9; item.useStyle = 5; item.noMelee = true; item.knockBack = 3.75f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged { 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); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; } diff --git a/Items/Weapons/Ranged/LeadWizard.cs b/Items/Weapons/Ranged/LeadWizard.cs index dcaa615f70..681067bed5 100644 --- a/Items/Weapons/Ranged/LeadWizard.cs +++ b/Items/Weapons/Ranged/LeadWizard.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 70; + item.damage = 65; item.crit += 30; item.ranged = true; item.width = 66; item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 6; + item.useTime = 3; + item.reuseDelay = 12; + item.useAnimation = 9; item.useStyle = 5; item.noMelee = true; item.knockBack = 5f; @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d4358a634b..a41e4941f0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -754,7 +754,7 @@ namespace CalamityMod.NPCs } } - if (npc.buffImmune[BuffID.Venom] == false) + if (!npc.buffImmune[BuffID.Venom]) { npc.buffImmune[BuffType()] = false; } diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index 39d87dcbf0..e57ef9f6f0 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -16,7 +17,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 22; projectile.friendly = true; projectile.aiStyle = 39; - aiType = 190; projectile.penetrate = -1; projectile.alpha = 255; projectile.ranged = true; From 26b2fcb3954bf0a47ca8323c4dbb4a869246779a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:58:32 -0400 Subject: [PATCH 058/137] buffed lazinator --- Items/Weapons/Magic/Zapper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index d67c18c73a..33808b6d71 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 50; + item.damage = 55; item.magic = true; item.mana = 4; item.width = 46; item.height = 22; - item.useTime = 10; - item.useAnimation = 10; + item.useTime = 7; + item.useAnimation = 7; item.useStyle = 5; item.noMelee = true; item.knockBack = 2f; From b5eb4133e971c28c6b6516b88e75040c2bc1a069 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 30 Apr 2020 18:52:24 -0400 Subject: [PATCH 059/137] cleaned up hote code --- Items/Accessories/HeartoftheElements.cs | 226 +++++++++++++----------- 1 file changed, 120 insertions(+), 106 deletions(-) diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 5ac11c2e5b..ff56822c8e 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -2,10 +2,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { @@ -48,165 +50,177 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + //Don't do anything if the player fucked up somehow, somewhere + if (player.whoAmI != Main.myPlayer || player is null || player.dead) + return; + 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; + + player.lifeRegen += hideVisual ? 2 : 1; + player.statLifeMax2 += hideVisual ? 25 : 20; + player.moveSpeed += hideVisual ? 0.12f : 0.1f; + player.jumpSpeedBoost += hideVisual ? 1.1f : 1f; + player.endurance += hideVisual ? 0.06f : 0.05f; + player.statManaMax2 += hideVisual ? 60 : 50; + player.manaCost *= hideVisual ? 0.93f : 0.95f; + player.allDamage += hideVisual ? 0.1f : 0.08f; + + int brimmy = ProjectileType(); + int siren = ProjectileType(); + int healer = ProjectileType(); + int sandy = ProjectileType(); + int cloudy = ProjectileType(); + if (!hideVisual) { - player.lifeRegen += 1; - player.statLifeMax2 += 20; - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.0f; - player.endurance += 0.05f; - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.allDamage += 0.08f; - - int damage = NPC.downedMoonlord ? 150 : 90; - float damageMult = CalamityWorld.downedDoG ? 2f : 1f; + Vector2 velocity = new Vector2(0f, -1f); + int damage = NPC.downedMoonlord ? 150 : 90; + float damageMult = CalamityWorld.downedDoG ? 2f : 1f; int elementalDmg = (int)(damage * damageMult * player.MinionDamage()); + float kBack = 2f + player.minionKB; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 1) - { - player.ClearBuff(ModContent.BuffType()); - } - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), elementalDmg, 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), elementalDmg, 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), elementalDmg, 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), elementalDmg, 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), elementalDmg, 2f, Main.myPlayer, 0f, 0f); - } + if (player.ownedProjectileCounts[brimmy] > 1 || player.ownedProjectileCounts[siren] > 1 || + player.ownedProjectileCounts[healer] > 1 || player.ownedProjectileCounts[sandy] > 1 || + player.ownedProjectileCounts[cloudy] > 1) + { + player.ClearBuff(BuffType()); + } + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[brimmy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[siren] < 1) + { + Projectile.NewProjectile(player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[healer] < 1) + { + Projectile.NewProjectile(player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[sandy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[cloudy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI, 0f, 0f); + } } else { - player.lifeRegen += 2; - player.statLifeMax2 += 25; - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 1.1f; - player.endurance += 0.06f; - player.statManaMax2 += 60; - player.manaCost *= 0.93f; - player.allDamage += 0.1f; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[brimmy] > 0 || player.ownedProjectileCounts[siren] > 0 || + player.ownedProjectileCounts[healer] > 0 || player.ownedProjectileCounts[sandy] > 0 || + player.ownedProjectileCounts[cloudy] > 0) { - player.ClearBuff(ModContent.BuffType()); + player.ClearBuff(BuffType()); } } + + //Flower Boots code 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) + int x = (int)player.Center.X / 16; + int y = (int)(player.position.Y + (float)player.height - 1f) / 16; + Tile tile = Main.tile[x, y]; + if (tile == null) { - Main.tile[num4, num5] = new Tile(); + tile = 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)) + if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 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) + tile.frameY = 0; + tile.slope(0); + tile.halfBrick(false); + //On dirt blocks, there's a small chance to grow a dye plant + if (Main.tile[x, y + 1].type == TileID.Dirt) { 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) + tile.active(true); + tile.type = TileID.DyePlants; + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - if (Main.tile[num4, num5 + 1].type == 2) + //On grass, grow flowers + if (Main.tile[x, y + 1].type == TileID.Grass) { 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) + tile.active(true); + tile.type = TileID.Plants; + tile.frameX = (short)(18 * Main.rand.Next(6, 11)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + tile.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) + tile.active(true); + tile.type = TileID.Plants2; + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - else if (Main.tile[num4, num5 + 1].type == 109) + //On hallowed grass, grow hallowed flowers + else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) { 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) + tile.active(true); + tile.type = TileID.HallowedPlants; + tile.frameX = (short)(18 * Main.rand.Next(4, 7)); + while (tile.frameX == 90) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + tile.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) + tile.active(true); + tile.type = TileID.HallowedPlants2; + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); + while (tile.frameX == 90) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - else if (Main.tile[num4, num5 + 1].type == 60) + //On jungle grass, grow jungle flowers + else if (Main.tile[x, y + 1].type == TileID.JungleGrass) { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + tile.active(true); + tile.type = TileID.JunglePlants2; + tile.frameX = (short)(18 * Main.rand.Next(9, 17)); if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } } @@ -216,15 +230,15 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); From 86d016add04d48fa0684ab985ca44df93b347d07 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 30 Apr 2020 18:04:18 -0500 Subject: [PATCH 060/137] Providence AI slight refactor. Brimmy arc projectile spread. --- NPCs/CalamityAI.cs | 56 +++++----- NPCs/Providence/Providence.cs | 193 ++++++++++++++++++++++------------ 2 files changed, 150 insertions(+), 99 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index eb8debe7e2..fb95ce1654 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -943,49 +943,45 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) projectileSpeed = 12f; - float num180 = player.position.X + player.width * 0.5f - vectorCenter.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - vectorCenter.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - npc.netUpdate = true; - num183 = projectileSpeed / num183; - num180 *= num183; - num182 *= num183; + int damage = expertMode ? 25 : 30; - int num184 = expertMode ? 25 : 30; - int num185 = ModContent.ProjectileType(); - vectorCenter.X += num180; - vectorCenter.Y += num182; + vectorCenter = player.Center - vectorCenter; - for (int num186 = 0; num186 < 6; num186++) + float radialOffset = 0.2f; + float diameter = 80f; + + vectorCenter.Y -= Math.Abs(vectorCenter.X) * radialOffset; + vectorCenter = Vector2.Normalize(vectorCenter) * projectileSpeed; + + Vector2 velocity = vectorCenter; + velocity.Normalize(); + velocity *= diameter; + + int totalProjectiles = 6; + float offsetAngle = (float)Math.PI * radialOffset; + + for (int j = 0; j < totalProjectiles; j++) { - num180 = player.position.X + player.width * 0.5f - vectorCenter.X; - num182 = player.position.Y + player.height * 0.5f - vectorCenter.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = projectileSpeed / num183; - num180 += Main.rand.Next(-80, 81); - num182 += Main.rand.Next(-80, 81); - num180 *= num183; - num182 *= num183; - int projectile = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - Main.projectile[projectile].timeLeft = 300; - Main.projectile[projectile].tileCollide = false; + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians, default); + int proj = Projectile.NewProjectile(npc.Center + offset, vectorCenter, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].tileCollide = false; } vectorCenter = npc.Center; - int totalProjectiles = 12; + 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 / totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle; - float velocity = CalamityWorld.bossRushActive ? 9f : 6f; + double offsetAngle2; int i; for (i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + offsetAngle2 = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; // Used to be 32 + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(Math.Sin(offsetAngle2) * projectileSpeed), (float)(Math.Cos(offsetAngle2) * projectileSpeed), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-Math.Sin(offsetAngle2) * projectileSpeed), (float)(-Math.Cos(offsetAngle2) * projectileSpeed), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 7540faac35..f857b43490 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs.Providence bool normalAttackRate = true; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); @@ -327,17 +327,17 @@ namespace CalamityMod.NPCs.Providence // Guardian spawn if (bossLife == 0f && npc.life > 0) - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { int num660 = (int)(npc.lifeMax * 0.66); - if ((float)(npc.life + num660) < bossLife) + if ((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)); + bossLife = npc.life; + int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); NPC.NewNPC(x - 100, y - 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC(x + 100, y - 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC(x, y + 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); @@ -417,13 +417,13 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) { - npc.velocity.X += (float)flightPath * acceleration; + npc.velocity.X += 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); + float num855 = player.position.Y - (npc.position.Y + npc.height); if (num855 < (firingLaser ? 150f : 200f)) // 150 npc.velocity.Y -= 0.2f; if (num855 > (firingLaser ? 200f : 250f)) // 200 @@ -637,7 +637,7 @@ namespace CalamityMod.NPCs.Providence phase = 0; // Reset arrays - npc.ai[0] = (float)phase; + npc.ai[0] = phase; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -661,15 +661,15 @@ namespace CalamityMod.NPCs.Providence num856 = (int)(num856 * attackRateMult); - if (npc.ai[3] >= (float)num856) - npc.ai[3] = (float)-(float)num856; + if (npc.ai[3] >= num856) + npc.ai[3] = -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 num857 = player.position.X + player.width * 0.5f - vector.X; float num858 = player.Center.Y - vector.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); float velocityBoost = death ? 2.5f : 2.5f * (1f - lifeRatio); float num860 = (expertMode ? 10.25f : 9f) + velocityBoost; @@ -712,11 +712,11 @@ namespace CalamityMod.NPCs.Providence num864 = (int)(num864 * attackRateMult); - if (npc.ai[3] >= (float)num864) + if (npc.ai[3] >= num864) { npc.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); float num865 = npc.velocity.Y; if (num865 < 0f) @@ -743,13 +743,13 @@ namespace CalamityMod.NPCs.Providence 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 num866 = Main.rand.Next(-1000, 1001); + float num867 = Main.rand.Next(-1000, 1001); + float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); float num869 = 3f; if (!targetDead) - npc.velocity *= 0.95f; + npc.velocity *= 0.9f; num868 = num869 / num868; num866 *= num868; @@ -763,29 +763,7 @@ namespace CalamityMod.NPCs.Providence num867 *= -1f; } - npc.ai[3] += 1f; - - int shootBoost = (int)(4f * (1f - lifeRatio)); - - int num870 = (expertMode ? 3 : 4) - shootBoost; - - if (attackRateMult > 1D) - num870 += (int)Math.Ceiling(attackRateMult * 1.6); - - if (npc.ai[3] >= (float)num870) - { - npc.ai[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Main.rand.NextBool(4) && !death) - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - else - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - - if (npc.ai[1] == 0f) + if (npc.ai[3] == 0f) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -800,9 +778,86 @@ namespace CalamityMod.NPCs.Providence } } + npc.ai[3] += 1f; + + /*if (npc.velocity.Length() <= 2f) + npc.velocity = Vector2.Zero; + if (npc.velocity.Length() > 2f) + return; + + float divisor = (expertMode ? 2f : 3f) + (float)Math.Floor(3f * lifeRatio) + (attackRateMult > 1D ? (float)Math.Ceiling(attackRateMult * 1.6) : 0f); + int totalProjectiles = 36; + int chains = 4; + float interval = totalProjectiles / chains * divisor; + double patternInterval = Math.Floor(npc.ai[3] / interval); + float velocity = 3f; + + if (patternInterval % 2 == 0) + { + if (npc.ai[3] % divisor == 0f) + { + double radians = (patternInterval % 4 == 0 ? MathHelper.TwoPi + MathHelper.Pi / 3 : MathHelper.TwoPi) / chains; + float radialOffset = MathHelper.ToRadians(npc.ai[2]); + Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); + + for (int i = 0; i < chains; i++) + { + Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i + radialOffset); + + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(4) && !death) + projectileType = ModContent.ProjectileType(); + + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + } + + // Radial offset + npc.ai[2] += 10f; + } + } + else + { + npc.ai[2] = 0f; + + totalProjectiles = 16; + if (npc.ai[3] % (divisor * totalProjectiles) == 0f) + { + double radians = MathHelper.TwoPi / totalProjectiles; + Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); + + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i); + + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(4) && !death) + projectileType = ModContent.ProjectileType(); + + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + } + } + }*/ + + int shootBoost = (int)(4f * (1f - lifeRatio)); + + int num870 = (expertMode ? 3 : 4) - shootBoost; + + if (attackRateMult > 1D) + num870 += (int)Math.Ceiling(attackRateMult * 1.6); + + if (npc.ai[3] % num870 == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Main.rand.NextBool(4) && !death) + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + else + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + // Air is burning text - npc.ai[1] += 1f; - if (npc.ai[1] >= 450f && !text) + if (npc.ai[3] >= 450f && !text) { text = true; string key = "Mods.CalamityMod.ProfanedBossText"; @@ -815,7 +870,7 @@ namespace CalamityMod.NPCs.Providence } // Inflict Icarus Folly - if (npc.ai[1] >= 600f) + if (npc.ai[3] >= 600f) { if (Main.netMode != NetmodeID.Server) { @@ -835,7 +890,7 @@ namespace CalamityMod.NPCs.Providence 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].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } @@ -875,15 +930,15 @@ namespace CalamityMod.NPCs.Providence num856 = (int)(num856 * attackRateMult); - if (npc.ai[3] >= (float)num856) - npc.ai[3] = (float)-(float)num856; + if (npc.ai[3] >= num856) + npc.ai[3] = -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 num857 = player.position.X + player.width * 0.5f - vector.X; float num858 = player.Center.Y - vector.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); float shootBoost2 = death ? 2.5f : 2.5f * (1f - lifeRatio); float num860 = (expertMode ? 10.25f : 9f) + shootBoost2; @@ -926,11 +981,11 @@ namespace CalamityMod.NPCs.Providence num864 = (int)(num864 * attackRateMult); - if (npc.ai[3] >= (float)num864) + if (npc.ai[3] >= num864) { npc.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + (float)npc.height - 14f); + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); float num865 = npc.velocity.Y; if (num865 < 0f) @@ -957,7 +1012,7 @@ namespace CalamityMod.NPCs.Providence npc.TargetClosest(true); if (!targetDead) - npc.velocity *= 0.95f; + npc.velocity *= 0.9f; if (npc.ai[1] == 0f) { @@ -987,11 +1042,11 @@ namespace CalamityMod.NPCs.Providence { npc.ai[2] = 0f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); + Vector2 vector93 = vector; 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -1002,7 +1057,7 @@ namespace CalamityMod.NPCs.Providence int seeProjFilesforDmg = 0; int num747 = ModContent.ProjectileType(); Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, seeProjFilesforDmg, 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, ModContent.ProjectileType(), seeProjFilesforDmg, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + Main.rand.Next(-100, 100), 0f, 0f, ModContent.ProjectileType(), seeProjFilesforDmg, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); } } @@ -1020,7 +1075,7 @@ namespace CalamityMod.NPCs.Providence npc.TargetClosest(true); if (!targetDead) - npc.velocity *= 0.95f; + npc.velocity *= 0.9f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1042,7 +1097,7 @@ namespace CalamityMod.NPCs.Providence Vector2 value19 = new Vector2(27f, 59f); - float rotation = 450f + (float)(guardianAmt * 18); + float rotation = 450f + (guardianAmt * 18); npc.ai[2] += 1f; if (npc.ai[2] < 120f) @@ -1064,9 +1119,9 @@ namespace CalamityMod.NPCs.Providence if (num1221 % 2 == 1) num1223 = 2.8f; - Vector2 vector199 = vector + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; + Vector2 vector199 = vector + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).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].velocity = Vector2.Normalize(vector - vector199) * 3.5f * (10f - num1220 * 2f) / 10f; Main.dust[num1224].noGravity = true; Main.dust[num1224].scale = num1223; } @@ -1093,13 +1148,13 @@ namespace CalamityMod.NPCs.Providence 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, ModContent.ProjectileType(), 100, 0f, Main.myPlayer, num1225 * 6.28318548f / rotation, (float)npc.whoAmI); + vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f, default); + Projectile.NewProjectile(vector.X, vector.Y - 32f, vector200.X, vector200.Y, ModContent.ProjectileType(), 100, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); if (revenge) - Projectile.NewProjectile(vector.X, vector.Y - 32f, -vector200.X, -vector200.Y, ModContent.ProjectileType(), 100, 0f, Main.myPlayer, -num1225 * 6.28318548f / rotation, (float)npc.whoAmI); + Projectile.NewProjectile(vector.X, vector.Y - 32f, -vector200.X, -vector200.Y, ModContent.ProjectileType(), 100, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); - npc.ai[3] = (vector200.ToRotation() + 9.424778f) * num1225; + npc.ai[3] = (vector200.ToRotation() + MathHelper.TwoPi + MathHelper.Pi) * num1225; npc.netUpdate = true; } } @@ -1108,12 +1163,12 @@ namespace CalamityMod.NPCs.Providence if (npc.localAI[1] > 1f) npc.localAI[1] = 1f; - float num1226 = (float)(npc.ai[3] >= 0f).ToDirectionInt(); + float num1226 = (npc.ai[3] >= 0f).ToDirectionInt(); float num1227 = npc.ai[3]; if (num1227 < 0f) num1227 *= -1f; - num1227 += -9.424778f; - num1227 += num1226 * 6.28318548f / rotation; + num1227 += -(MathHelper.TwoPi + MathHelper.Pi); + num1227 += num1226 * MathHelper.TwoPi / rotation; npc.localAI[0] = num1227; } From 5a323d4ef7d71b00bb8f959fe42480eb53f5ae1b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 1 May 2020 08:58:54 -0400 Subject: [PATCH 061/137] fixed mirage jelly not being hit by summons --- NPCs/Abyss/MirageJelly.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 1460a8f817..4703c5b19f 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -162,7 +162,9 @@ namespace CalamityMod.NPCs.Abyss public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - return false; + { + return hasBeenHit; + } return null; } From c5f1ef35a0c88e00c561087d0aaf46fae7bdda66 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 1 May 2020 08:01:47 -0500 Subject: [PATCH 062/137] Fixed Perforator Cyst Sheet --- NPCs/Perforator/PerforatorCyst.cs | 2 +- NPCs/Perforator/PerforatorCyst.png | Bin 2902 -> 2042 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index b168dd21ae..049bc41fbe 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Perforator aiType = -1; npc.damage = 0; npc.width = 30; //324 - npc.height = 30; //216 + npc.height = 26; //216 npc.defense = 0; npc.lifeMax = 1000; npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorCyst.png b/NPCs/Perforator/PerforatorCyst.png index 718dddd8729f16ec3b3cafeb3b0ab00e2b411625..34a7b4997dfa7b4f90f6c1ef7fe809681aa38d8b 100644 GIT binary patch literal 2042 zcmeAS@N?(olHy`uVBq!ia0vp^PC%T&!3-pe_Fn4(QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn~YUU}gyL32_CAYs<)6vPoNt$=hkFd-KV9i>t(l>Su|GWhod3dD~~FhqtS$ z_G@c5sTs^Pv!CUld?-iyOkm)YNu}Rs@gF!i^Z)NanMU|~`2>Eaj?;eK=mWAP#bfmZ$|UY3JN z{{R2mzy0_#LU`iKlD^U!E-LxPR3C{{N*}*Npzui7#69>z^!#o{f0u)$7-_ z1yY+tZQOp{JH@c%Nxz1E&!v6)V>)=cMf^R@Cw^V_a+g3JYhTCd)~Bnu7G`>+n(Z@uHWP;t`9!<(DmPwf|BKdUR;F-mxhjrU$f!XU!Qw^dFAY- zYkw#>U0AEM^tIpSV}>nN*Gy{fnfR98-KIDvy>#x=iBCH(s0yhxZV}*X-^SX+Aj7Ai zA?B2<5XZ5*CNHq(0gI*FO}|+A{v2n^CXR#m1!@Ewl9trWIogqukXyZ{GxtT~qBBJ^ zioI(EzMc5wzwE5RV||Gu9YK?g81B43>gU2CFF!3QF>T888K+dD1DEkP-QMZ{-uc43 zX$zGX@np75d+D3n!uF>B$6QXESr@ehj2Pv<eD&Ey>P+S%Xezdb~)HY3+`+c zwN$tg(IU{3y5@w6^a8_8%j8ol6?3$=7~TyCN_ACZ_}RQ;rhnLz289*621}_VNdsJq}m&a5(+N z)1*CIp@>o0Izlt)M5N#<^-pr^0U^*38@S|91|6l7ae7| zV-aDg@Fv@7tAnx2niKohOcDGT_3_X}h7*o<9bd1vY+96fpee9m}ECw;T`$IULCWk#ObQacr#ez3cxh8|gz6;uK$TRmOPx=5J^NqRCt{2oXc-qR~^T{*Pii=AMuRs#GWJ$&I1u3QOr0{Q2{DcMTk_&jv}!l zsEX*KVn-w-{(y9Yph86fr3*wBVa1}YDxj@|C=pR&1;wIiXp=M#Cvj?zO~x8~9+$=M ze6MqUbC2iYaZs!C-8lEoeVm;0J&*hQ+}{oGDba!P2>`&h?ZW_ox!L(p9TEV*%&i-- z=XY&h(LPy9xPD*_yX30bjjGXo8{MBy_~x@;1pvJB+PS8#=N(~G=ZI!oWTWRb;V9k5 z0Ra2A}pfJA_ z+mh5&swV(|sdP{5?|)q`0RXO*D^_1;3%~NxSpdMc?ZW{8%+1d8)DQq(_~~;1fVbZK zCjj8erRxBIkuVtmK)GB70Q}>=?MUwkqq;GIPGHTl1qL$x0D#g$QBLfZIxK~?5C97E zO90kd@OwXa8US$l(toV$Or?9)b<7i^K>z?<#Vr8sXtGXnsC!`~_Z0KRhQp>_QEf64C`-p+;qFkUOl7_ch8vxTYsle+-` zv*)je0FV!}0D!T#uK)lJWu-j#s*3=CrHY(4T1x@|o*b1ikz<8-gi(SuQ6^V859Ah?!k3+?Lto?rOJHZjKdDv!Hi`Q9wt)%)?7&dS@Tp zJ}!NYeQzwA0RUXOFD*McI$&M!UP1cg8-)egQK(qIpFA#q-@BZSEfAe?;*@OXvoh~b zLmct)*QTuFPfyD%k?X0hTRvT`fi78BJgmv}y(5h3W{vOn4FPzhFZRf=eZkZ;YZmCX zwvQax0{}RE-<}PI(^A(H=@kILiBmFapFCcQEs%D?jZ#W>Ciq>7gvZQrKg!FfeR^7cpT-0EhiTcP6VkLNPA$h4 z=;%Zr0O01L+;84E>W8~`$ChVu)E*O{9IM5#BoBKQ@s2Qx9FYxD0kBp>OV?zy=lskX zW{pxy^60VFB1X|{a^D;m%Jpt8&H@0APGn*WL?>`;*q4%Z3LU^%VN8u#IWybQp@Z^h zROcX`7dgim(>uZ_(PI`^g>WSVfPH4o{<$I9KbAEsLo@nPug_cq@Tg-%bv19acHAxi zz>Hd7tQ{wD4Kq~KIdE;(iWl#r&(jXlW1V+|QSjvGL?5wYL;@^@(pNF8_Aq$P)XE8+stwX*?Z4bBWjuHHVF=Vm*L91#X!t-aAyI3y0@kyZcZ89XeY!{&oxr$7v!v_C zKatU$go`S@`T~G@hfrtFCPDyss!w8!m(6{?bXA^G2Mrq~kI^(dzar(EP8C7`NL4)z zUsn<7N}8v>kAre-UpzD|HO$x~pZmYD$L`ZE(nZ3>mjC^kt=4%YTog&zpDs$1Gn)O~ ztZ)}{lo$Vg5de@kj$zzlEp{oUXWSv35W-ce*l*5wM;Jw8M7dnH`eM%X!6Q93DO!sZ z*~1HCnl93H;*`V{P9C>esY|cED-I#?nm6o|PN1|C81cHh`q0|1IR*(AdxUp{QQfSe zYqk+%jAD$&5t?U^bmbNM1Qh#x*WT2`ON&u-O}fU^aS;dM4wlQa&v-?S7*5E_>y3g8 zw|NykUW@*&&ptU;+*2g!hGL(ML?`gQ2+kICsE&TKoPWC}D_71I5e+xzdG^^rkt3EF zOg8H-t`m3&Ym%cjYnUyd*(Y0!&eH6Y+Lg(e{q|U(*(aq*S|jr1*=LK2*k>uIG{rvk zEaGCHR4#huT8>*PZnu7)Dezx?*7aQM({&$R9?w48RALpO#Xbl7q(<+Wr#kkf*Bvd8 zQ!m+TR;igJ)hq*Tmwo08;c~H5E$;}UrrD=vj#@m9tWvYjM7MpNMhuipHJd1}TMo}Y zJFJee&y8m1J+5+i_Srxic0>~yxYoTkJ72U}_UWV84%M;GRz(7)nWN6i)A!jZRri^| zo1{dueT)1cWmceb$@03)lY~r*oCBG78s01g*YcUb9a1z#xcU}rdf}Q$;HZfcNRU3- zDzQiAWolNsFDv<*6K3VOW2eL}@7zvVExu#tN=p=6X9C~3ITxD=OpS!%WM%?uc}E!4 zMX}k(bqj3I3xz(VxJsS#!U!lZ?ZQ8fIGM4JhD*gH@_SY0bt66 zH2a4WO=SX)q$CsgAcUOl(eLNSBuizLYJr6^^SLh(Wd2n zQuXg#wU_tl$|tQqzd0v(_UTa5?DK*;QNL%v8g9fs=`^y*R`Whx6x_4V4yhsgB!eWI zO!p+MZJ+n~DU;9pH1duxa^`Eas!jO9Xl z#0-;tv10(glRYvf4+np4z&r;{n4>=_$IoKby1&o+Y*SIpvS_?fHGPeFpX~GOqhz0y z<_2%d;2kl^FJ`1~9_&enKz&9qGl6w(`1LLFxH!Eivyx_>xfz*d$UA)AXNMGx5&adL zeNyam5dq7_v&ATv%fvF7r$Z<7Zxgb`mVeJsaG2aG*H@6=FUt2M`2FiB6F5)yDTn*K z&km_$-@J9P&$Cxe3tyE#$IQoTUAf?O=W(T(<#(^`OyEZHd7mxnv9ZtLlEfaF^Q|*~ zb!M>s9(KFz)8~D*sE&X0mX2_J^A?bn`TAJ=8#AtN-code|K{x`=`pa+=vL~nIox%VCF-qmu*v(FCce|MX`u0nX;WB>pF07*qoM6N<$g2lh8 A;s5{u From 67e35c1c21c779d05988f1e4261d8a7a26f75aca Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Fri, 1 May 2020 14:47:54 +0100 Subject: [PATCH 063/137] Removed ravager message from golem due to non-linearity changes --- Localization/CalamityLocalization.cs | 1 - NPCs/CalamityGlobalNPCLoot.cs | 4 ---- 2 files changed, 5 deletions(-) diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 1cdc52e742..83cd81c3f9 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Localization new [] { "PlantBossText", "The ocean depths are trembling." }, 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..." }, diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 55666aee33..e4b11e3824 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -284,18 +284,14 @@ namespace CalamityMod.NPCs { 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); } } } From 4566392ca80afaad37222090ecb8a2d1e2c2aff1 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 1 May 2020 08:51:15 -0500 Subject: [PATCH 064/137] Polterghast slight refactor. Moon Lord rev+ true eyes adjusted to move towards the player again. Added timed DR scaling for bosses. --- CalamityMod.cs | 104 +++++++++++++++++++++++++++++--- NPCs/CalamityGlobalAI.cs | 16 +---- NPCs/CalamityGlobalNPC.cs | 64 ++++++++++++++++---- NPCs/Polterghast/Polterghast.cs | 78 ++++++++++++------------ 4 files changed, 188 insertions(+), 74 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 4e7b27a69f..b43109e16d 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -123,9 +123,10 @@ namespace CalamityMod // DR data structure public static SortedDictionary DRValues; + public static SortedDictionary bossKillTimes; - // Lists - public static IList donatorList; + // Lists + public static IList donatorList; public static List rangedProjectileExceptionList; public static List projectileDestroyExceptionList; public static List projectileMinionList; @@ -237,6 +238,7 @@ namespace CalamityMod SetupLists(); SetupVanillaDR(); + SetupBossKillTimes(); SetupThoriumBossDR(thorium); CalamityLocalization.AddLocalizations(); @@ -338,6 +340,8 @@ namespace CalamityMod DRValues?.Clear(); DRValues = null; + bossKillTimes?.Clear(); + bossKillTimes = null; donatorList = null; rangedProjectileExceptionList = null; @@ -2541,13 +2545,14 @@ namespace CalamityMod { NPCID.Crab, 0.05f }, { NPCID.Crawdad, 0.2f }, { NPCID.Crawdad2, 0.2f }, - { NPCID.CultistBoss, 0.05f }, + { NPCID.CultistBoss, 0.1f }, { NPCID.DD2Betsy, 0.1f }, { NPCID.DD2OgreT2, 0.1f }, { NPCID.DD2OgreT3, 0.15f }, { NPCID.DeadlySphere, 0.4f }, { NPCID.DiabolistRed, 0.2f }, { NPCID.DiabolistWhite, 0.2f }, + { NPCID.DukeFishron, 0.1f }, { NPCID.DungeonGuardian, 0.999999f }, { NPCID.DungeonSpirit, 0.2f }, { NPCID.ElfCopter, 0.15f }, @@ -2592,7 +2597,9 @@ namespace CalamityMod { NPCID.Paladin, 0.45f }, { NPCID.PirateCaptain, 0.05f }, { NPCID.PirateShipCannon, 0.15f }, - { NPCID.PossessedArmor, 0.25f }, + { NPCID.Plantera, 0.15f }, + { NPCID.PlanterasTentacle, 0.1f }, + { NPCID.PossessedArmor, 0.25f }, { NPCID.PresentMimic, 0.3f }, { NPCID.PrimeCannon, 0.2f }, { NPCID.PrimeLaser, 0.2f }, @@ -2633,7 +2640,7 @@ namespace CalamityMod #region Thorium Boss DR private void SetupThoriumBossDR(Mod thorium) { - if (thorium is null || !CalamityMod.CalamityConfig.RevengeanceAndDeathThoriumBossBuff) + if (thorium is null || !CalamityConfig.RevengeanceAndDeathThoriumBossBuff) return; void ThoriumDR(string npcName, float dr) { @@ -2666,10 +2673,91 @@ namespace CalamityMod ThoriumDR("Omnicide", 0.3f); ThoriumDR("Abyssion", 0.35f); } - #endregion + #endregion - #region Music - public override void UpdateMusic(ref int music, ref MusicPriority priority) + #region Vanilla Enemy DR + private void SetupBossKillTimes() + { + bossKillTimes = new SortedDictionary { + { NPCID.KingSlime, 3600 }, + { NPCID.EyeofCthulhu, 5400 }, + { NPCID.EaterofWorldsHead, 7200 }, + { NPCID.EaterofWorldsBody, 7200 }, + { NPCID.EaterofWorldsTail, 7200 }, + { NPCID.BrainofCthulhu, 5400 }, + { NPCID.QueenBee, 7200 }, + { NPCID.WallofFlesh, 10800 }, + { NPCID.WallofFleshEye, 10800 }, + { NPCID.Spazmatism, 10800 }, + { NPCID.Retinazer, 10800 }, + { NPCID.TheDestroyer, 10800 }, + { NPCID.TheDestroyerBody, 10800 }, + { NPCID.TheDestroyerTail, 10800 }, + { NPCID.SkeletronPrime, 10800 }, + { NPCID.Plantera, 10800 }, + { NPCID.Golem, 10800 }, + { NPCID.GolemHead, 3600 }, + { NPCID.DukeFishron, 9000 }, + { NPCID.CultistBoss, 9000 }, + { NPCID.MoonLordCore, 14400 }, + { NPCID.MoonLordHand, 7200 }, + { NPCID.MoonLordHead, 7200 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 1800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 1200 }, + { ModContent.NPCType(), 11400 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 14400 }, + { ModContent.NPCType(), 1200 }, + { ModContent.NPCType(), 1200 }, + { ModContent.NPCType(), 1200 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 14400 } + }; + } + #endregion + + #region Music + public override void UpdateMusic(ref int music, ref MusicPriority priority) { Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (Main.musicVolume != 0) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 9c2a1a35df..c6330b50f7 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -13643,7 +13643,7 @@ namespace CalamityMod.NPCs float velocity = CalamityWorld.bossRushActive ? 38f : 30f; Vector2 center23 = npc.Center; - Vector2 center24 = Main.npc[(int)Main.npc[(int)npc.ai[3]].localAI[2]].Center; + Vector2 center24 = Main.player[npc.target].Center; Vector2 value24 = center24 - center23; value24 = Vector2.Normalize(value24) * velocity; @@ -13657,19 +13657,7 @@ namespace CalamityMod.NPCs { if (Main.npc[num1248].active) { - if (Main.npc[num1248].type == NPCID.MoonLordHead && Vector2.Distance(npc.Center, Main.npc[num1248].Center) > 600f) - { - if (npc.position.X < Main.npc[num1248].position.X) - npc.velocity.X = npc.velocity.X - num1247; - else - npc.velocity.X = npc.velocity.X + num1247; - - if (npc.position.Y < Main.npc[num1248].position.Y) - npc.velocity.Y = npc.velocity.Y - num1247; - else - npc.velocity.Y = npc.velocity.Y + num1247; - } - else if (num1248 != npc.whoAmI && Main.npc[num1248].type == npc.type) + if (num1248 != npc.whoAmI && Main.npc[num1248].type == npc.type) { if (Vector2.Distance(npc.Center, Main.npc[num1248].Center) < 150f) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a41e4941f0..1823876fe3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -81,10 +81,12 @@ namespace CalamityMod.NPCs #region Variables public float DR { get; set; } = 0f; - /// - /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. - /// - public bool unbreakableDR = false; + public int KillTime { get; set; } = 0; + + /// + /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. + /// + public bool unbreakableDR = false; /// /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.

@@ -104,6 +106,7 @@ namespace CalamityMod.NPCs // NewAI internal const int maxAIMod = 4; public float[] newAI = new float[maxAIMod]; + public int AITimer = 0; // Town NPC Patreon private bool setNewName = true; @@ -667,11 +670,20 @@ namespace CalamityMod.NPCs // Apply DR to vanilla NPCs. No vanilla NPCs have DR except in Rev+. // This also applies DR to other mods' NPCs who have set up their NPCs to have DR in Rev+. - if (CalamityWorld.revenge && CalamityMod.DRValues.ContainsKey(npc.type)) + if (CalamityWorld.revenge) { - CalamityMod.DRValues.TryGetValue(npc.type, out float revDR); - DR = revDR; - } + if (CalamityMod.DRValues.ContainsKey(npc.type)) + { + CalamityMod.DRValues.TryGetValue(npc.type, out float revDR); + DR = revDR; + } + + if (CalamityMod.bossKillTimes.ContainsKey(npc.type)) + { + CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); + KillTime = revKillTime; + } + } if (npc.boss && CalamityWorld.revenge) { @@ -1137,6 +1149,7 @@ namespace CalamityMod.NPCs effects, 0f); } + public static void DrawAfterimage(NPC npc, SpriteBatch spriteBatch, Color startingColor, Color endingColor, Texture2D texture = null, Func rotationCalculation = null, bool directioning = false, bool invertedDirection = false) { @@ -1215,6 +1228,7 @@ namespace CalamityMod.NPCs case 1: scalar = 1.0; break; + case 2: scalar = 0.76; break; @@ -1475,7 +1489,7 @@ namespace CalamityMod.NPCs /// private double ApplyDR(NPC npc, double damage) { - if (DR <= 0f || damage <= 1.0) + if ((DR <= 0f && KillTime == 0) || damage <= 1.0) return damage; // If the NPC currently has unbreakable DR, it cannot be reduced by any means. @@ -1486,7 +1500,28 @@ namespace CalamityMod.NPCs if (effectiveDR <= 0f) effectiveDR = 0f; - double newDamage = (1f - effectiveDR) * damage; + // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac + if (KillTime > 0 && AITimer < KillTime) + { + // The limit for how much extra DR the boss can have + float extraDRLimit = 1f - effectiveDR; + + // Ranges from 1 to 0 + float currentHPRatio = npc.life / (float)npc.lifeMax; + + // Ranges from 0 to 1 + float killTimeRatio = AITimer / (float)KillTime; + + // If the player is damaging the boss too quickly + float extraDRScalar = currentHPRatio + killTimeRatio; + if (extraDRScalar < 1f) + { + // Ranges from 0 to (extraDRLimit / 2) + effectiveDR += extraDRLimit - (extraDRLimit / (1f + (1f - extraDRScalar))); + } + } + + double newDamage = (1f - effectiveDR) * damage; return newDamage < 1.0 ? 1.0 : newDamage; } @@ -1577,7 +1612,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.BrainofCthulhu) { - if ((float)npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f)) + if (npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f)) index = -1; } @@ -1585,7 +1620,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.DukeFishron) { - if ((float)npc.life / (float)npc.lifeMax < 0.15f) + if (npc.life / (float)npc.lifeMax < 0.15f) index = -1; } } @@ -1598,7 +1633,10 @@ namespace CalamityMod.NPCs { SetPatreonTownNPCName(npc); - if (npc.type == NPCID.TargetDummy || npc.type == NPCType()) + if (KillTime > 0 && AITimer < KillTime) + AITimer++; + + if (npc.type == NPCID.TargetDummy || npc.type == NPCType()) { npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses; npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 5e41ac1b95..7a8b222ab1 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.Polterghast 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.1f, 0.5f, 0.5f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.1f, 0.5f, 0.5f); // whoAmI variable CalamityGlobalNPC.ghostBoss = npc.whoAmI; @@ -121,10 +121,10 @@ namespace CalamityMod.NPCs.Polterghast bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool phase2 = (double)npc.life < (double)npc.lifeMax * (death ? 0.9 : 0.75); //hooks fire beams - bool phase3 = (double)npc.life < (double)npc.lifeMax * (revenge ? (death ? 0.8 : 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 ? (death ? 0.5 : 0.33) : 0.2); //starts spitting ghost dudes - bool phase5 = (double)npc.life < (double)npc.lifeMax * (revenge ? (death ? 0.25 : 0.1) : 0.05); //starts moving incredibly fast + bool phase2 = npc.life < npc.lifeMax * (death ? 0.9 : 0.75); //hooks fire beams + bool phase3 = npc.life < npc.lifeMax * (revenge ? (death ? 0.8 : 0.5) : 0.33); //hooks stop shooting and polter begins charging with ghosts spinning around player + bool phase4 = npc.life < npc.lifeMax * (revenge ? (death ? 0.5 : 0.33) : 0.2); //starts spitting ghost dudes + bool phase5 = npc.life < npc.lifeMax * (revenge ? (death ? 0.25 : 0.1) : 0.05); //starts moving incredibly fast // Target npc.TargetClosest(true); @@ -176,15 +176,15 @@ namespace CalamityMod.NPCs.Polterghast } num = num733; } - num730 /= (float)num732; - num731 /= (float)num732; + num730 /= num732; + num731 /= num732; // Velocity and acceleration bool charging = npc.ai[2] >= 300f; bool reset = npc.ai[2] >= 600f; float num734 = 2.5f; float num735 = 0.025f; - if (!player.ZoneDungeon && !CalamityWorld.bossRushActive && (double)player.position.Y < Main.worldSurface * 16.0) + if (!player.ZoneDungeon && !CalamityWorld.bossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; if (despawnTimer <= 0) @@ -283,16 +283,16 @@ namespace CalamityMod.NPCs.Polterghast num734 += 10f; } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); int num739 = 500; if (speedBoost) num739 += 250; if (expertMode) num739 += 150; - if (num738 >= (float)num739) + if (num738 >= num739) { - num738 = (float)num739 / num738; + num738 = num739 / num738; num736 *= num738; num737 *= num738; } @@ -302,7 +302,7 @@ namespace CalamityMod.NPCs.Polterghast vector91 = new Vector2(vector.X, vector.Y); num736 = num730 - vector91.X; num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); if (num738 < num734) { @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 vector92 = new Vector2(vector.X, vector.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; + npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; if (npc.velocity.X < num736) { @@ -381,9 +381,9 @@ namespace CalamityMod.NPCs.Polterghast num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); - 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -415,9 +415,9 @@ namespace CalamityMod.NPCs.Polterghast num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); - 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -459,7 +459,7 @@ namespace CalamityMod.NPCs.Polterghast 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].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) @@ -474,8 +474,8 @@ namespace CalamityMod.NPCs.Polterghast npc.GivenName = "Necroghast"; - npc.damage = (int)((float)npc.defDamage * 1.2f); - npc.defense = (int)((float)npc.defDefense * 0.8f); + npc.damage = (int)(npc.defDamage * 1.2f); + npc.defense = (int)(npc.defDefense * 0.8f); if (speedBoost || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { @@ -507,9 +507,9 @@ namespace CalamityMod.NPCs.Polterghast num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); - 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -541,9 +541,9 @@ namespace CalamityMod.NPCs.Polterghast num742 *= 2f; Vector2 vector93 = new Vector2(vector.X, vector.Y); - 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -602,7 +602,7 @@ namespace CalamityMod.NPCs.Polterghast 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].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) @@ -617,8 +617,8 @@ namespace CalamityMod.NPCs.Polterghast npc.GivenName = "Necroplasm"; - npc.damage = (int)((float)npc.defDamage * 1.4f); - npc.defense = (int)((float)npc.defDefense * 0.5f); + npc.damage = (int)(npc.defDamage * 1.4f); + npc.defense = (int)(npc.defDefense * 0.5f); if (speedBoost || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { @@ -632,9 +632,9 @@ namespace CalamityMod.NPCs.Polterghast npc.ai[1] = 0f; Vector2 vector93 = new Vector2(vector.X, vector.Y); float num742 = CalamityWorld.bossRushActive ? 7f : 5f; - 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)); + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); num745 = num742 / num745; num743 *= num745; @@ -648,7 +648,7 @@ namespace CalamityMod.NPCs.Polterghast 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 deltaAngle = rotation / numProj; double offsetAngle; int type = ModContent.ProjectileType(); for (int i = 0; i < numProj; i++) @@ -668,15 +668,15 @@ namespace CalamityMod.NPCs.Polterghast 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 = player.position.X + (float)player.width * 0.5f - vector94.X; + Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num758 = player.position.X + player.width * 0.5f - vector94.X; float num759 = Math.Abs(num758 * 0.2f); - float num760 = player.position.Y + (float)player.height * 0.5f - vector94.Y; + float num760 = player.position.Y + player.height * 0.5f - vector94.Y; if (num760 > 0f) num759 = 0f; num760 -= num759; - float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); + float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); num761 = num757 / num761; num758 *= num761; num760 *= num761; From 363b933ab8cfcd345a3995f496a08cc7fafdf8c3 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 1 May 2020 08:53:22 -0500 Subject: [PATCH 065/137] Changed a region name. --- CalamityMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index b43109e16d..8b421ddd49 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2675,7 +2675,7 @@ namespace CalamityMod } #endregion - #region Vanilla Enemy DR + #region Boss Kill Times private void SetupBossKillTimes() { bossKillTimes = new SortedDictionary { From 73717f16438e41736b4831d5f800f7ed069a8e97 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 1 May 2020 09:07:08 -0500 Subject: [PATCH 066/137] Moon Lord Free Eye AI edit. --- NPCs/CalamityGlobalAI.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index c6330b50f7..d3982ca548 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -13641,15 +13641,24 @@ namespace CalamityMod.NPCs npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); - float velocity = CalamityWorld.bossRushActive ? 38f : 30f; + float velocity = CalamityWorld.bossRushActive ? 42f : 36f; Vector2 center23 = npc.Center; Vector2 center24 = Main.player[npc.target].Center; Vector2 value24 = center24 - center23; value24 = Vector2.Normalize(value24) * velocity; - int num1246 = 30; - npc.velocity.X = (npc.velocity.X * (num1246 - 1) + value24.X) / num1246; - npc.velocity.Y = (npc.velocity.Y * (num1246 - 1) + value24.Y) / num1246; + if (Vector2.Distance(center23, center24) > 300f) + { + int num1246 = 30; + npc.velocity.X = (npc.velocity.X * (num1246 - 1) + value24.X) / num1246; + npc.velocity.Y = (npc.velocity.Y * (num1246 - 1) + value24.Y) / num1246; + } + else + { + npc.velocity *= 0.8f; + if (npc.velocity.Length() < 1f) + npc.velocity = Vector2.Zero; + } // Fly towards Moon Lord Head and stay away from other True Eyes float num1247 = 0.5f; From 2ce2d4463b5a3375e58e7349394a0d18c1ddd83c Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 1 May 2020 09:16:38 -0500 Subject: [PATCH 067/137] Perforator glow (derp) --- NPCs/Perforator/PerforatorCystGlow.png | Bin 453 -> 1261 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/NPCs/Perforator/PerforatorCystGlow.png b/NPCs/Perforator/PerforatorCystGlow.png index 1d107bc654ce39dd4414a49e24f436a7ce5a2df6..ad3d4d78c2af52f4de500a46170429f674cc651b 100644 GIT binary patch delta 1254 zcmVPx#1ZP1_K>z@;j|==^ z1poj532;bRa{vGi!vFvd!vV){sAK>D1cFIKK~#8N?VMXnR8bg)XIoC7HIPyyM~*$>J1 zH)KHGdme^V5q~3GqTL9U<9Ydz+kB~zD$TzlkhgogA??_|Ya8U(f$xxZ1~H+)X2^+& z3CI^;qRkK^2;)XLaj^`~+^aDkz#Fv5wrmw_3OP|*Z$wX*Rapd`f_j5e@^Zb3QQ}OHkeVha1 zZkoCu^aNmvo;?#JCYoG*)0w@nmos z@>+Knq#YHdC6He4GRTLoUPG#g5iT)qgxg+&sej&C1lbsFgIp|S*?EwoDfs?GHA9Rb zj2RJWSOYJ@eFhV`T0Lvav%sf5QMQEDyLoKrQ&wVkC8n~ z8-I)&!PuFhd&-XyBW$o{kEGK)R4m{#Qk@pPORcil&eQFbA0tNCpxub0#l?`paojbo z$icr*Id=CwBy;mH?k?Zy!FwO4&QqrRG@;#y+Tu-+b*(*+3^!kl@6>SAZE(%5Ldg1; z?T~ha@~}OB-0g14Pu;ziUPHku^#?s~K7Z@KYN$<*5F-eg>5`eQ zXyEYZTqo4sW5%x6SS;LY$V}G~(Qbr_-I?Jt>K41_+wH%K5iW_F5o+VL*oKRd|9@v0 zBa9hwVqY0#+R!j$u6H>k(-Oh!x>LgyD#59~(QiK>r|@lo<4(NHbh$*k5!`)NW{p9f zeK7yK*zcT;@_1K3a8@1Nf!MrOJk(7r=eosYkpja~RZY}IK$p7K-YKF^h7 z_j&on{N3k5k(n+BjPF@4bf&8+h+k_!Q=hvvz%6rjpImYzGhoClrgyT{rpt80#mG#T zLfniPx$e@R3^RCt{2+_6dn zK@^4IqgVvAu+YlVMu^ymt!Uwc*ocB4K7h|4f*@#NA@~}Kt=NbQHg?*lNRe(Wyf<-2 zqoC}aDgLh=!YrG^1mU_KI$yh&q@)q&o$Q5?$evFo!b}Ah)BhBpJ^iKJ^=s# z000000Qu%M(pEfI3+}kZHm!G`E=_=Up+hHm6G9>kbDxGpm}0t5$J}RT%zYXX0RR91 z000001!6YbaEooiXT#HpV4no$UyutC)`m~de{`DOZ882f_emR`N%#qUzOh(K<7dHL i)J(V|5dZ)H|MU)rB$0t?*O6KP0000 Date: Fri, 1 May 2020 09:17:11 -0500 Subject: [PATCH 068/137] Relic of Deliverance charge fix --- Items/Weapons/Typeless/RelicOfDeliverance.cs | 1 + Projectiles/Typeless/RelicOfDeliveranceSpear.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 4bffd8e0d6..3d62533d92 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Typeless DisplayName.SetDefault("Relic of Deliverance"); Tooltip.SetDefault("Summons a spear that causes you to lunge towards the mouse position\n" + "The spear requires a charge-up. The longer the charge, the more strong the lunge\n" + + "The spear disappears immediately if you are not holding this item while charging" + "If enough time has passed or the spear collides into a wall, the spear dies and the lunge ends"); } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 327311bba7..09f206ccff 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -77,6 +78,17 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0]++; if (projectile.velocity == Vector2.Zero) { + // Immediately die if the player is not holding the spear + if (player.HeldItem == null) + { + projectile.Kill(); + return; + } + if (player.HeldItem.type != ModContent.ItemType()) + { + projectile.Kill(); + return; + } projectile.rotation = projectile.AngleTo(Main.MouseWorld); projectile.Center = player.Center; if (projectile.ai[0] >= WaitTimeRequiredForCharge) From 4268412777f6b453cc1e31e313e36c249c4a6224 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 1 May 2020 09:18:59 -0500 Subject: [PATCH 069/137] Added a line break --- Items/Weapons/Typeless/RelicOfDeliverance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 3d62533d92..481b20a897 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Typeless DisplayName.SetDefault("Relic of Deliverance"); Tooltip.SetDefault("Summons a spear that causes you to lunge towards the mouse position\n" + "The spear requires a charge-up. The longer the charge, the more strong the lunge\n" + - "The spear disappears immediately if you are not holding this item while charging" + + "The spear disappears immediately if you are not holding this item while charging\n" + "If enough time has passed or the spear collides into a wall, the spear dies and the lunge ends"); } From 70a44076c7d496fc66ab02604d0675eda17c6a54 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 1 May 2020 10:24:49 -0500 Subject: [PATCH 070/137] Small timed DR fix. --- NPCs/CalamityGlobalNPC.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1823876fe3..4eb3c711d7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1504,7 +1504,7 @@ namespace CalamityMod.NPCs if (KillTime > 0 && AITimer < KillTime) { // The limit for how much extra DR the boss can have - float extraDRLimit = 1f - effectiveDR; + float extraDRLimit = 1f - DR; // Ranges from 1 to 0 float currentHPRatio = npc.life / (float)npc.lifeMax; From 3544c6e1bda71af7361a392413bbedb8e1adc9b9 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 1 May 2020 13:43:09 -0500 Subject: [PATCH 071/137] AR MP lag fix(?) + Dye MP load fix --- Items/Dyes/BaseDye.cs | 6 +++++- World/CalamityWorld.cs | 38 ++++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Items/Dyes/BaseDye.cs b/Items/Dyes/BaseDye.cs index bb2837aa67..65d718738e 100644 --- a/Items/Dyes/BaseDye.cs +++ b/Items/Dyes/BaseDye.cs @@ -1,3 +1,4 @@ +using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,10 @@ namespace CalamityMod.Items.Dyes } public sealed override void SetStaticDefaults() { - GameShaders.Armor.BindShader(item.type, ShaderDataToBind); + if (!Main.dedServ) + { + GameShaders.Armor.BindShader(item.type, ShaderDataToBind); + } SafeSetStaticDefaults(); } public sealed override void SetDefaults() diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 1eed03e300..5c5f53b36e 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -968,17 +968,31 @@ namespace CalamityMod.World if (rainingAcid) { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - if (Main.player[playerIndex].Calamity().ZoneSulphur) - { - startAcidicDownpour = true; - CalamityMod.UpdateServerBoolean(); - } - } - } + if (!startAcidicDownpour) + { + int sulphSeaWidth = Abyss.BiomeWidth; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + // A variable named "player" already exists above, which retrieves the player who is closest to the map center. + Player player2 = Main.player[playerIndex]; + if (player2.active) + { + // An artificial biome can be made, and therefore, the event could be started by an artificial biome. + // While fighting the event in an artificial biome is not bad, having it be started by a patch of Sulphurous Sand + // would definitely be strange. + // Because of this, this code is executed based on if the player is in the sea (based on tile count) AND position relative to the naturally generated sea. + if (((player2.Center.X <= (sulphSeaWidth + 60f) * 16f && abyssSide) || + (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) && + player2.Calamity().ZoneSulphur) + { + startAcidicDownpour = true; + CalamityMod.UpdateServerBoolean(); + break; + } + } + } + } + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! if (startAcidicDownpour || forcedDownpourWithTear) @@ -994,7 +1008,7 @@ namespace CalamityMod.World } // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 2f) + if (downedPolterghast && acidRainPoints == 2) { if (!NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) From 1d5e9492351f8916f1522bf47be8308329813a75 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 1 May 2020 15:28:20 -0400 Subject: [PATCH 072/137] resprites and shit --- Items/Materials/DepthCells.png | Bin 525 -> 522 bytes Items/Materials/Lumenite.png | Bin 551 -> 725 bytes Items/Weapons/Magic/AquamarineStaff.cs | 2 +- NPCs/Cryogen/IceMass.cs | 32 +++++++++++++++++++++++-- NPCs/Cryogen/IceMass.png | Bin 1344 -> 1482 bytes Projectiles/Magic/AquamarineBolt.cs | 30 ++++++++++++----------- Projectiles/Magic/AquamarineBolt.png | Bin 136 -> 306 bytes Projectiles/Magic/AuraRain.cs | 29 +++++++++++++++------- Projectiles/Magic/AuraRain.png | Bin 136 -> 183 bytes Projectiles/Summon/SolarGod.cs | 10 ++------ 10 files changed, 69 insertions(+), 34 deletions(-) diff --git a/Items/Materials/DepthCells.png b/Items/Materials/DepthCells.png index 1475b534ef8fe6cb1fd64a6da71b1a4366bacc11..75d3fe54a65caeb8a19ea7a97ac97e6a30032ac6 100644 GIT binary patch delta 497 zcmVPx$#7RU!R7i=ou&o^wZ|O7(=N72B>-`*(iQ-2r7id|Rj2mF^DKRJZD zM*z@0EdUsqClerRWB>?{jh3Ak+u2gc=pCIJKqzkuiJBA8Dh){F4W3p2-ZGCSKxAf4 z@k^hl%g*oW?NaR6&K6K4VO(DUb|N4V<7`qraxW%8+t5f=3r6SFYKg~A6UhSmNc)gtR2Zmt7%AmDWcOn|=eS)iC(QE8_W5|d#c0Ex?-GQP54ou#9M_1sT3 zD&w{zP`C>u@`>&b0H&fY0FDx8z}HCrO7s~fKX_=4Z( zUJrEIqZ4X={{R5*&xQ%$?T-N93x*WO`?z&~m-YcsslP}fmp+g@*e>i1b|Bz&1pugT n)`234|B~Bp+foP00000NkvXXu0mjf^w;A( delta 500 zcmVQD2%Qfr6NR<7@RIdP=vwz%_};X1VuA0eCC|*o0;>T%Y2&r z@;4M7t2TSYT`{LM^E-WQPRD=SKZ>$GD5v7y_*nh2R7!WStACaWKA9!(@vYqSU9M-K zy&?P-29;BBC=zP1Tcl#I_HdUe=oM!syq^Io4;X{cLglgO5Ve8%f~q~&tJXdImIT4? zGU2@pP;rAi5z+JkxSYyguCL&qFgiigd<2X57vVH8gPaO`S-g`0Do@PLF*xvi{{Xz% z*#@U)CP6BX41Xx)iK!U;4~JV|R(l6I4a}fFnt)#lYAW2%0F`sToi#3=9IJ@!$k&z@ zU@tDugH)bLAHhD&eSi`FCs=w_QvgFm^zIH^s!kCP^#CIzlf%!r>>DkB8y8WKk+a)b zb1Hv(R`-cd^#-5E??ci4KG5%e4=@s*Vw)>DxXN)|v2B_J!>JMQ_DuCeI+KT;^#Q_~ zQ~BPdg$4GO+9ksKc_z4?f!Z1E@9M{C#W`iShEwARes_Hp>Px%k4Z#9R7i=fW@8G88*_GFSkdhZ6H6rZ*Y%EP%2tA>G#|Ac6 z#`TMFPyu)vI|1+>2U3hYdpUwZ;T(A%K^{AHgm@aPx{Y1@r!jvXxw zjhF!bSWvHpy<_-08MW9PadZ$;QPIo+@P2j*fd1awj`doTJpg=4>%5kkm>V20!A)X& zY~}_BfckmsH4Few9P75&C3ZptcP!;AV^fxI_lWBiRP(hmv~Y6^0LzPc6ToX23TkU0 zkk#eQT^DWSwhklhF0bm{Ixa8ffvw~sf23Ohls-<1N#UT4rDFE^ zUnkN)ja=-a)y%L7(0J;C0{Ask1YkUS&#`0oPN(yiALtRNkO>gFr1MkqS!O`&Z||oZ z8|u6H7=VSL5di!hF-@ME0k)F67vpl_Cjg~_UTs2_c%}(5S5pNpIhQxxVOVcmI|t=W6&|F96H0vL-|Q*Bv$e6{U7FNsDr$8=;c0=-0$7J%S)-4pSQU6_2cs9i;)PwU61My2dRi5 zMoGum|K04!CxXP?E|IIBeN0Qk<-%eIo35SLY4Fp%_XjlW{>&w<6BiVbIbVQ3_qB z=GN)mZnq_JVKwMJ(S;wp{b{zzhgc(WK!O<+>aGhW7bqzZW;5eDNuD4kW4#j46R(k( z-r>qDB{gX9WN^EjqqDS67axrck|2AZStZ@9guY+ZxCh?h0Nc@F;M pYlKXsG=y;I>5Z8uNf2g@=o?UxxN6Z&zsCRo002ovPDHLkV1h5Q00000 diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index b2a3f00265..ffcd12cb7b 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic public override Vector2? HoldoutOrigin() { - return new Vector2(15, 15); + return new Vector2(10, 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) diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index ea66820ec8..2680500612 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.cs @@ -1,4 +1,5 @@ using CalamityMod.World; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.NPCs.Cryogen public override void SetStaticDefaults() { DisplayName.SetDefault("Aurora Spirit"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 5; } public override void SetDefaults() @@ -27,13 +28,40 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = 30000; } npc.knockBackResist = 0f; - animationType = 472; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; npc.coldDamage = true; } + public override void FindFrame(int frameHeight) + { + int num1 = 1; + if (!Main.dedServ) + { + if (!Main.NPCLoaded[npc.type] || Main.npcTexture[npc.type] == null) + return; + num1 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + } + 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 * (double)npc.direction, (double)npc.velocity.X * (double)npc.direction); + npc.frameCounter++; + if (npc.frameCounter > 4) + { + npc.frame.Y += num1; + npc.frameCounter = 0; + } + if (npc.frame.Y / num1 >= Main.npcFrameCount[npc.type]) + npc.frame.Y = 0; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Frostburn, 90, true); diff --git a/NPCs/Cryogen/IceMass.png b/NPCs/Cryogen/IceMass.png index 894d99756864a9e7e635b1378b1176657fba5c3d..f85f260eba07602c8f1e1e51a8bc87630b4c32aa 100644 GIT binary patch literal 1482 zcmV;*1vUDKP)Px)gh@m}RCt{2oKI*RRUF4ZQ?@qUByFg6+h9$KLI`OzSWJaTN(m{VMNoRMpv8kx zu)WRc8Ur&kp%I zf2&GIUqMkWm1+fGe7sjvth4h=0QR*uI$mH;OO>yV20s4{ow0esqXKJR_J);;4`|M45uKpYixqwA|Q zu&$6_M9D9H(CerBbS1BRb{2q3{g(mw{>n8AVB&By0O#xVCEGzcxqk~{s-PpaO=@=i zx4%~#qjqjg{iv0*!x^o7;-j}6&y#ghloKuvuis;C{nQ^z0A&7K0budg%9>NV_$cVr zKoqV&)B(WK{0+xnHp29@KD$l~sdenH(F*|7?rU)D=ech$JJt(})9PM#?NMWG=+dmc zi8l5Gqo82lT_h^@128=DlcwmgV;A#Y=jzqd0PIbsEP%$7PXciN$tM7)yr+2$HqO?Q zf9vI(S=e#x2}VIT?6Yrm^$`GOX3~E5ix$B6cs~H|e5X#^S*Z>#&pEHlqFiEc!UD)n zWr2;#2}VJ`c&(>yh=PJBX=iy-DYcqe1z>SZt%q*P36WROQ0{n+!Jzz5!T6#9vq8Zk z_@Rz{8DBIYHtYw3@s3_4KCM(dTEoe9@X!b#J4Ss+_s4JR1Ahb^9BPvu&r?zG&U?HUR36Kc=;pF}OIY zJecgPdM2?lx8gSY$L#6SW={;-7xjzV6J0w-!9oej7Y&-oD`+TpLia@laqqRrXZ_=t-Wd$^xIs?E59mZ92Bs5=C@avDB`b6yycUGz~yF91r z3so}u3YNMrD*HiEvhtuR`}IfTqo5aI`=V~H+T@>E3t&2}T)WsuS(KbFD#|7AIN2j3 zdc>387&RgK3VJmN%NOl<@mUL?qf7mA`E5Ye&-|mD>xIEgUKdR;(S~jm%NI>n)M&@; zyNf*0^>$3eZ$Sj@i^?~|ZGTv(A1W9H{bGDkgJDyIo<}bjUo;@X%%gYg(@n__2lZ~2 z?rb7f)q`F#x7DYYM-v|fOC@f!u3h<}4Ns|DrUNa_TK_pYOqz6VN=9G7u=3~yzrLtF zZpNN{Cd?0H^5!r_UcrR?LzF9e9(|v>ZhNcR;k)^wa(+%OuSSkHEb_H3-WWeeikZi#~Mr zj8^aU6v@1e#Bamx@a5T-ABLXFw(o(o#Fn=jh=`YY-ND^z_pqdb>g z2k!#b-|2+MS{``?OV$^)$BWv}v%gnOzESq4OtDhXk?qc-7evYBNfq(CFlZuvffDjX zy<)YOX4SpUkEycX{0XC=5VSA)W^dZ@xP8{#Y`%nG6m(;&zG&M^=PZD>mtO_e<6xHM kb53t>vd>&F@uKC<|1T#X;|LLHS^xk507*qoM6N<$f(Iq#+5i9m literal 1344 zcmV-G1;6@4Zz2@ZpnNgBe#YULSs6-MPDD4v*1e2M?|cKdsZ!P{ohCILW>fP7ZPBO^L{VcBa@j zJ3g6kDMUz+Hpcn*8{GmMYa<-ZkdzHli#&VvC@P#+9(NJrr88u=!nbdpS{k2}A<{j9D@}K2l2wb~tU!peLy1Jy@)dr(QRhr2+zSX9 zM>)8=8&`?O5d2Eqg!2POUC3z7iN{T);q~^=PFSEND3wTf11)JcgM+rXy@T#xfTf35-K$MNXPBI zCQB{6S0Kb&X5@HU;k^JMDfY!GxOBq3NfydQ&}bsuYmxyx*$O9F zVZvvURodH(+pD<>ZyA2x)^T3HWOX7mV?A!mT8Wk22)2 zcBxm)RU|r#@^n;87B1XMvQYhaZQm51bwf_qJ{DP z9m%Q|9!0VcH`nIhJV^^DS>eK4ku0slXrgLPvfPBvBn!2z^Y?JE%+EL1WEopP?f6Wx zj80EZvaI@Hs6>&hFyY=L3$a6#-oj_y5MPOU!IxRMm1I$AQ)!y2U8{~(`N(N4$!ab< zswNACKy4>=2SQv(x5Bl&yVhB0KeOYL3HN%sFe)TO$Ja)9Ym!wP`;(I_H{nx}tkMhU z<~>=}!lOu5sUWodh#jUC?nSc50F>>aJI7M~zF4~PaoqZztY*TaNEW{_t9{x8#rSBk z?EQkTX2P{sI+HA|Q^Ix-Pe@BT`v3gK_rex{j;8}cQi$xE_hixCGU?H;!U$Px9{$Gn zX2Pu`D{9K;E#v;4tmeX_NEV7=ZI;MG&dgO%`ntBl>B2bOm1=Lr?2r}|G+vj!wFx;a zeP1lx3WQoCII&)(wwTNs>)MtQh4)Uf)=zk^Bx_U@%sXc~;a)(9>c`PIj5;GK$Z@a9 zYA)Q1WJyn8p+^n0IZGJHY9>62WT6 new Color(200, 200, 200, 200); + 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Magic/AquamarineBolt.png b/Projectiles/Magic/AquamarineBolt.png index 0056fc1e2479e11bd6391fc4ccd1fe54fa0d671f..bfb8c86d2a917c127b7d4849ae31e4f8e86fbdf7 100644 GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!Q-ATjv*HQ$te!ZTHAj9U+7~{@$ZG!6jsJ~ z`FD;N53?*i$yRVV!A#n%wdtplRsBH|o;^Dc@hsb3YSNH7!&{@Aao5=>$!Q5vY;m%d zOsS3s_L)vFsN9q&J7d`mR-FK;cj+^F4Q78a`EtOdYQ_PEr+N-YiUnr0+ERLtq&YyCgAGU?;osK{q}Y|gW!U_%O_8? zldxqk@$_|Nf56Vf$ijPbS(!Odm8hqSV~E7%W;Cpa)Ki)#GuDB(M! zku#P-d_Johqp_=R7{AV!f48+atSpz4NoC=jkf(GeMRK8t!Dp4jax(;GsNHj!aeK}e z^@TGO)U#L~H{bQz(pk{zfA4G}Lt+fWI)Uj-Gc0Um5}AJMJv%r new Color(200, 200, 200, 200); - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } From e89ff5d96ab3d6a6c8ab48aeb9f289b54a5dce06 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 1 May 2020 16:28:09 -0500 Subject: [PATCH 073/137] Extra DR doesn't apply in Boss Rush. Eater of Worlds splitting extra DR fix. --- NPCs/CalamityGlobalAI.cs | 8 ++++++-- NPCs/CalamityGlobalNPC.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index d3982ca548..0c6276be10 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1524,25 +1524,29 @@ namespace CalamityMod.NPCs int whoAmI = npc.whoAmI; float num25 = npc.life / (float)npc.lifeMax; float num26 = npc.ai[0]; + int aiTimer = calamityGlobalNPC.AITimer; npc.SetDefaultsKeepPlayerInteraction(npc.type); npc.life = (int)(npc.lifeMax * num25); npc.ai[0] = num26; npc.TargetClosest(true); npc.netUpdate = true; npc.whoAmI = whoAmI; + calamityGlobalNPC.AITimer = aiTimer; } 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 = npc.life / (float)npc.lifeMax; float num28 = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); + int aiTimer = calamityGlobalNPC.AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); npc.life = (int)(npc.lifeMax * num27); npc.ai[1] = num28; npc.TargetClosest(true); npc.netUpdate = true; npc.whoAmI = whoAmI2; - } + calamityGlobalNPC.AITimer = aiTimer; + } if (!npc.active && Main.netMode == NetmodeID.Server) NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4eb3c711d7..c9537a7058 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1501,7 +1501,7 @@ namespace CalamityMod.NPCs effectiveDR = 0f; // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac - if (KillTime > 0 && AITimer < KillTime) + if (KillTime > 0 && AITimer < KillTime && !CalamityWorld.bossRushActive) { // The limit for how much extra DR the boss can have float extraDRLimit = 1f - DR; From 1afb5b91aac923b49003348f3a91a3def1832819 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 1 May 2020 20:52:02 -0400 Subject: [PATCH 074/137] Added some extra checks for stealth consumption, should cover everything --- CalPlayer/CalamityPlayer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 412cbec7e0..5dee64a05f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9289,7 +9289,14 @@ namespace CalamityMod.CalPlayer // 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. // Using any item which deals no damage or is a tool doesn't consume stealth. - bool playerUsingWeapon = player.HeldItem.damage > 0 && player.HeldItem.pick <= 0 && player.HeldItem.hammer <= 0 && player.HeldItem.axe <= 0; + Item it = player.HeldItem; + bool hasDamage = it.damage > 0; + bool isPickaxe = it.pick > 0; + bool isAxe = it.axe > 0; + bool isHammer = it.hammer > 0; + bool isPlaced = it.createTile != 0; + bool producesNoHitboxes = it.shoot == 0 && it.useStyle == ItemUseStyleID.SwingThrow && it.noMelee; + bool playerUsingWeapon = hasDamage && !(isPickaxe || isAxe || isHammer || isPlaced || producesNoHitboxes); if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) ConsumeStealthByAttacking(); } From cfa36299d563a6d2da6d9eb75f26b80ef847fe4f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 1 May 2020 21:20:09 -0400 Subject: [PATCH 075/137] DoG won't respawn if killed insanely fast. --- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index e13dca68ca..c19edecb2a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1041,6 +1041,9 @@ namespace CalamityMod.NPCs.DevourerofGods public override void NPCLoot() { + // Stop the countdown -- if you kill DoG in less than 60 frames, this will stop another one from spawning. + CalamityWorld.DoGSecondStageCountdown = 0; + DropHelper.DropBags(npc); DropHelper.DropItem(npc, ModContent.ItemType(), 8, 14); From 18cb8d9e4417f056bed884e2780c2f174b4e8397 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 1 May 2020 20:30:43 -0500 Subject: [PATCH 076/137] Ripper UI position clamp --- UI/RipperUI.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index 95a6f46f9f..d8ead9eb62 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.World; using Microsoft.Xna.Framework.Input; +using System.Collections.Generic; namespace CalamityMod.UI { @@ -257,10 +258,14 @@ namespace CalamityMod.UI private static void CheckGarbageCornerPos() { - if (rageDrawPos.X <= 60f && rageDrawPos.Y <= 20f) + // This should only happen if something happens to the config file. + if (rageDrawPos == Vector2.Zero) rageDrawPos = new Vector2(DefaultRagePosX, DefaultRagePosY); - if (adrenDrawPos.X <= 60f && adrenDrawPos.Y <= 20f) + rageDrawPos = Vector2.Clamp(rageDrawPos, Vector2.Zero, new Vector2(Main.screenWidth - 104f, Main.screenHeight - 24f)); + + if (adrenDrawPos == Vector2.Zero) adrenDrawPos = new Vector2(DefaultAdrenPosX, DefaultAdrenPosY); + adrenDrawPos = Vector2.Clamp(adrenDrawPos, Vector2.Zero, new Vector2(Main.screenWidth - 104f, Main.screenHeight - 24f)); } private static Vector2 GetShakeOffset() From b4624c6cd8995f2f4de21c1872c8425b24196324 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 1 May 2020 22:36:07 -0400 Subject: [PATCH 077/137] Rogue weapons benefit from throwing crit. --- Buffs/CalamityGlobalBuff.cs | 3 +++ CalPlayer/CalamityPlayer.cs | 3 ++- Items/Weapons/Rogue/RogueWeapon.cs | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 5a3d336517..c4852c0263 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Buffs { player.lavaMax += 420; } + // Rogue weapons benefit from vanilla throwing crit, so don't double-increase rogue crit chance with these buffs. + /* else if (type == BuffID.Rage) { player.Calamity().throwingCrit += 10; @@ -34,6 +36,7 @@ namespace CalamityMod.Buffs { player.Calamity().throwingCrit += 2; } + */ else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) { float nebulaDamage = 0.075f * (float)player.nebulaLevelDamage; //7.5% to 22.5% diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5dee64a05f..c9e7083053 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9228,7 +9228,8 @@ namespace CalamityMod.CalPlayer player.rangedCrit += boost; player.magicCrit += boost; player.thrownCrit += boost; - throwingCrit += boost; + // Rogue weapons benefit from throwing crit AND rogue crit, so don't add both. + // throwingCrit += boost; } #endregion diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index f088ae1b35..ba11775685 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -20,16 +20,19 @@ namespace CalamityMod.Items.Weapons.Rogue item.summon = false; } + // Simply add the player's dedicated rogue damage. + // Rogue weapons are internally throwing so they already benefit from throwing damage boosts. // 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. + // Simply add the player's dedicated rogue crit chance. + // Rogue crit isn't boosted by Calamity universal crit boosts, so this won't double-add universal crit. public override void GetWeaponCrit(Player player, ref int crit) { - crit = item.crit + player.Calamity().throwingCrit; + crit += player.Calamity().throwingCrit; } public override float UseTimeMultiplier(Player player) From f3d6dc3cf3573a25de8ad378d62a7adaec09c689 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 2 May 2020 10:51:11 -0400 Subject: [PATCH 078/137] tundra flame blossom fixes --- Items/Weapons/Summon/SunGodStaff.cs | 2 +- Items/Weapons/Summon/TundraFlameBlossomsStaff.cs | 15 +++++++++++++-- ModSupport/WeakReferenceSupport.cs | 1 + Projectiles/Summon/TundraFlameBlossom.cs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 04f4be5b65..dd305b8186 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; speedX = 0; speedY = 0; - for (int x = 0; x < 1000; x++) + for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; if (projectile.active && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType()) diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index ec545e62b5..bfd4852479 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Tundra Flame Blossoms Staff"); - Tooltip.SetDefault("Summons three unusual flowers over your head"); + Tooltip.SetDefault("Summons three unusual flowers over your head\n" + + "Each flower consumes one minion slot"); } public override void SetDefaults() @@ -32,9 +33,19 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 10f; item.summon = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < 3; //If you already have all 3, no need to resummon + 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 x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) + { + proj.Kill(); + } + } for (int i = 0; i < 3; i++) { Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index df400c6cb5..93e95f268a 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -836,6 +836,7 @@ namespace CalamityMod sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType(), ProjectileType()}, new List() {1-(1f/3f), 2f/3f, 2f/3f}); diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index 72c66de54c..3833bfeb96 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.Center = Main.player[projectile.owner].Center + (projectile.ai[1] / 32f).ToRotationVector2() * 95f; + projectile.Center = player.Center + (projectile.ai[1] / 32f).ToRotationVector2() * 95f; projectile.scale = 1f + (float)Math.Sin(projectile.ai[1] / 40f) * 0.085f; projectile.Opacity = 1f - (float)Math.Sin(projectile.ai[1] / 45f) * 0.1f - 0.1f; // Range of 1f to 0.8f projectile.rotation += MathHelper.ToRadians(5f); From 924661bea401942ebf93c55daee750f281a92f82 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 2 May 2020 10:07:44 -0500 Subject: [PATCH 079/137] Flame Pillar damage fix? --- NPCs/Ravager/FlamePillar.cs | 47 +++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 16e58f39f9..6e3706c2fa 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -55,37 +55,34 @@ namespace CalamityMod.NPCs.Ravager npc.netUpdate = true; return; } - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.5f); + if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.5f, 0.5f); if (npc.alpha > 0) { npc.alpha -= 3; if (npc.alpha < 0) - { - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - { - npc.damage = 400; - } - else - { - npc.damage = Main.expertMode ? 180 : 100; - } - npc.alpha = 0; - } + npc.alpha = 0; } + if (npc.ai[0] == 0f) { npc.noTileCollide = false; + npc.ai[1] += 1f; + if (npc.ai[1] >= 85f) + { + if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + npc.damage = 400; + else + npc.damage = Main.expertMode ? 180 : 100; + } + if (npc.ai[1] >= 180f) - { npc.ai[0] = 1f; - } } else if (npc.ai[0] == 1f) { @@ -126,9 +123,9 @@ namespace CalamityMod.NPCs.Ravager spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -150,12 +147,12 @@ namespace CalamityMod.NPCs.Ravager { 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 + (npc.width / 2); + npc.position.Y = npc.position.Y + (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); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (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); @@ -163,7 +160,7 @@ namespace CalamityMod.NPCs.Ravager 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].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) From 3a893a9a128c2e670b0b45d5622812be74701901 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 2 May 2020 11:36:15 -0400 Subject: [PATCH 080/137] aurora spirit gore resprite --- Gores/CryoSpirit.png | Bin 285 -> 406 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Gores/CryoSpirit.png b/Gores/CryoSpirit.png index 91cf54199d966d57df99990a33d524c23c77de2e..2ca4fe1bb5718950357402f52717968bf6a5419d 100644 GIT binary patch literal 406 zcmV;H0crk;P)Px$P)S5VR7i>4lrc-gKp2Lf69*~Q7QsLVMG&MUg+kE|;^5HH!B}t;7pG1I7xh;- z2@Ve8EVvY$L{NmbQ0NeGaH@h5L9lgj5aJMyav@18NFu(|efPch-aXuL@ZTjgO?Sc! znaTOkfJ|XY06e#D0chW!hx$i;bi7~Cs2r3^CrV>>dts=6TE%prPb%dl&1ctu7zjl! zw*`Q0HywbDy}DwU$d3;dRI8W(7>kAgu$q>yFM2{v(*c;8DFE==X*tlp)2H_v0G4;E z0Ho*Kh2?4gz;)dW-7r4FWYPej*RvEtDM`9|SXJgF>G72s+--j-_4Uyv5GNtv02GU7 zzQ(R|q10cGpGv)Qub%TgUxT9$rp?(7!i+LPg$JD>aC?(I^9u zN@xNgF_u>P(GvzWyyQW|gR*V=4uJhjcUk0w-vz5$WI`ar!vFvP07*qoM6N<$f~`-j A@c;k- literal 285 zcmV+&0pk9NP);xEjL70B9AfOCy1_65HGB(D?7y*j0+>&>i>Yofx`EG6Zv(sV Date: Sat, 2 May 2020 12:13:05 -0500 Subject: [PATCH 081/137] Bosses have increased extra DR if they haven't been defeated once. Added GetDownedBossVariable method. --- CalamityMod.cs | 1 + NPCs/CalamityGlobalNPC.cs | 171 +++++++++++++++++++++++++++++++++++++- 2 files changed, 168 insertions(+), 4 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 8b421ddd49..b1dc9e1ef6 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2744,6 +2744,7 @@ namespace CalamityMod { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c9537a7058..95ae81d87b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1504,7 +1504,7 @@ namespace CalamityMod.NPCs if (KillTime > 0 && AITimer < KillTime && !CalamityWorld.bossRushActive) { // The limit for how much extra DR the boss can have - float extraDRLimit = 1f - DR; + float extraDRLimit = (1f - DR) * (GetDownedBossVariable(npc.type) ? 1f : 1.5f); // Ranges from 1 to 0 float currentHPRatio = npc.life / (float)npc.lifeMax; @@ -5801,10 +5801,173 @@ namespace CalamityMod.NPCs } return false; } - #endregion + #endregion - #region Any Living Players - public static bool AnyLivingPlayers() + #region Get Downed Boss Variable + public static bool GetDownedBossVariable(int type) + { + switch (type) + { + case NPCID.KingSlime: + return NPC.downedSlimeKing; + + case NPCID.EyeofCthulhu: + return NPC.downedBoss1; + + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + case NPCID.BrainofCthulhu: + return NPC.downedBoss2; + + case NPCID.QueenBee: + return NPC.downedQueenBee; + + case NPCID.SkeletronHead: + return NPC.downedBoss3; + + case NPCID.WallofFlesh: + case NPCID.WallofFleshEye: + return Main.hardMode; + + case NPCID.TheDestroyer: + case NPCID.TheDestroyerBody: + case NPCID.TheDestroyerTail: + return NPC.downedMechBoss1; + + case NPCID.Spazmatism: + case NPCID.Retinazer: + return NPC.downedMechBoss2; + + case NPCID.SkeletronPrime: + return NPC.downedMechBoss3; + + case NPCID.Plantera: + return NPC.downedPlantBoss; + + case NPCID.Golem: + case NPCID.GolemHead: + return NPC.downedGolemBoss; + + case NPCID.DukeFishron: + return NPC.downedFishron; + + case NPCID.CultistBoss: + return NPC.downedAncientCultist; + + case NPCID.MoonLordCore: + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + return NPC.downedMoonlord; + } + + if (type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedDesertScourge; + } + else if (type == NPCType()) + { + return CalamityWorld.downedCrabulon; + } + else if (type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedHiveMind; + } + else if (type == NPCType()) + { + return CalamityWorld.downedPerforator; + } + else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedSlimeGod; + } + else if (type == NPCType()) + { + return CalamityWorld.downedCryogen; + } + else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedAquaticScourge; + } + else if (type == NPCType()) + { + return CalamityWorld.downedBrimstoneElemental; + } + else if (type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedCalamitas; + } + else if (type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedLeviathan; + } + else if (type == NPCType()) + { + return CalamityWorld.downedAstrageldon; + } + else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedStarGod; + } + else if (type == NPCType()) + { + return CalamityWorld.downedPlaguebringer; + } + else if (type == NPCType()) + { + return CalamityWorld.downedScavenger; + } + else if (type == NPCType()) + { + return CalamityWorld.downedGuardians; + } + else if (type == NPCType()) + { + return CalamityWorld.downedBumble; + } + else if (type == NPCType()) + { + return CalamityWorld.downedProvidence; + } + else if (type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedSentinel1; + } + else if (type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedSentinel2; + } + else if (type == NPCType()) + { + return CalamityWorld.downedSentinel3; + } + else if (type == NPCType()) + { + return CalamityWorld.downedPolterghast; + } + else if (type == NPCType()) + { + return CalamityWorld.downedBoomerDuke; + } + else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedDoG; + } + else if (type == NPCType()) + { + return CalamityWorld.downedYharon; + } + else if (type == NPCType()) + { + return CalamityWorld.downedSCal; + } + + return false; + } + #endregion + + #region Any Living Players + public static bool AnyLivingPlayers() { for (int i = 0; i < Main.maxPlayers; i++) { From 62b87663082b91991ff446e197027172ad172bb3 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 2 May 2020 12:21:52 -0500 Subject: [PATCH 082/137] Added config option to enable the extra boss DR at all times, regardless if you've defeated the boss already or not. --- Configs.cs | 5 +++++ NPCs/CalamityGlobalNPC.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Configs.cs b/Configs.cs index 2970ba31be..f24a56915c 100644 --- a/Configs.cs +++ b/Configs.cs @@ -88,6 +88,11 @@ namespace CalamityMod [Tooltip("Boosts the player's mining speed by 75%")] public bool MiningSpeedBoost { get; set; } + [DefaultValue(false)] + [Label("Extra Damage Reduction for Bosses")] + [Tooltip("Grants extra damage reduction for bosses for every boss encounter, regardless if you've defeated the boss already or not")] + public bool ExtraBossDR { get; set; } + [Label("Boss Health Percentage Boost")] [Tooltip("Boosts the health of bosses to a maximum of +900% health")] [Range(0f, 900f)] diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 95ae81d87b..8c998861f5 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1504,7 +1504,7 @@ namespace CalamityMod.NPCs if (KillTime > 0 && AITimer < KillTime && !CalamityWorld.bossRushActive) { // The limit for how much extra DR the boss can have - float extraDRLimit = (1f - DR) * (GetDownedBossVariable(npc.type) ? 1f : 1.5f); + float extraDRLimit = (1f - DR) * (!GetDownedBossVariable(npc.type) || CalamityMod.CalamityConfig.ExtraBossDR ? 1.5f : 1f); // Ranges from 1 to 0 float currentHPRatio = npc.life / (float)npc.lifeMax; From 3b85e385949771e19e08ccdc7c4de4d7bd8998e1 Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Sat, 2 May 2020 23:04:58 +0100 Subject: [PATCH 083/137] adjusted bloodworm spawning --- NPCs/AcidRain/BloodwormNormal.cs | 7 +++++++ NPCs/CalamityGlobalNPC.cs | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index ce4cdfc89b..430b4314ab 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.SummonItems; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -98,6 +99,12 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return (spawnInfo.player.Calamity().ZoneSulphur && CalamityWorld.downedPolterghast && !CalamityWorld.rainingAcid) ? SpawnCondition.WormCritter.Chance * 1.569f : 0f; + } + public override void OnCatchNPC(Player player, Item item) { try diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c9537a7058..9b29f04f30 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4115,10 +4115,6 @@ namespace CalamityMod.NPCs } } } - if (CalamityWorld.downedPolterghast) - { - pool.Add(NPCType(), AcidRainEvent.BloodwormSpawnRate); - } } } } From 5ebc8044832080fadc99b85dda7979aa739967fd Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 2 May 2020 17:53:41 -0500 Subject: [PATCH 084/137] Dyes are less pricey --- Items/Dyes/AstralBlueDye.cs | 2 +- Items/Dyes/AstralOrangeDye.cs | 2 +- Items/Dyes/AstralSwirlDye.cs | 2 +- Items/Dyes/CeaselessDye.cs | 2 +- Items/Dyes/DragonSoulDye.cs | 2 +- Items/Dyes/ElementalDye.cs | 2 +- Items/Dyes/EndothermicDye.cs | 2 +- Items/Dyes/NightmareDye.cs | 2 +- Items/Dyes/ReaverDye.cs | 2 +- Items/Dyes/ShadowspecDye.cs | 2 +- Items/Dyes/StratusDye.cs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index a2444ed0b8..602f7341f4 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { item.rare = 9; - item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.value = Item.sellPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index 4e8588dee7..4945847a5e 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { item.rare = 9; - item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.value = Item.sellPrice(0, 2, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index f657ac43b8..33ff3d0f06 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { item.rare = 9; - item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.value = Item.sellPrice(0, 3, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index 46e236aa59..c865caa946 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + item.value = Item.sellPrice(0, 4, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index c59c6eaca3..e5ff29b85c 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.value = Item.sellPrice(0, 8, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index 793e4d343e..a53145c467 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + item.value = Item.sellPrice(0, 2, 50, 0); } public override void AddRecipes() diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index c145b058cb..6630a5ac20 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 53386334ec..9807c284bb 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + item.value = Item.sellPrice(0, 5, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index f437db45a9..80379e10db 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { item.rare = 7; - item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.value = Item.sellPrice(0, 1, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 12c84124f1..03e6b1997f 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.Developer; - item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + item.value = Item.sellPrice(0, 10, 0, 0); } public override void AddRecipes() diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index 70917b52d7..f7e57b0be3 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes { item.rare = 10; item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + item.value = Item.sellPrice(0, 4, 50, 0); } public override void AddRecipes() From 4a030054e41b554566fbe0caaf5cece6367d7246 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 2 May 2020 19:28:48 -0400 Subject: [PATCH 085/137] fixed stealth consumption logic, whoops --- CalPlayer/CalamityPlayer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c9e7083053..2954015149 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9296,8 +9296,9 @@ namespace CalamityMod.CalPlayer bool isAxe = it.axe > 0; bool isHammer = it.hammer > 0; bool isPlaced = it.createTile != 0; - bool producesNoHitboxes = it.shoot == 0 && it.useStyle == ItemUseStyleID.SwingThrow && it.noMelee; - bool playerUsingWeapon = hasDamage && !(isPickaxe || isAxe || isHammer || isPlaced || producesNoHitboxes); + bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced; + bool producesNoHitboxes = it.shoot == 0 && it.noMelee; + bool playerUsingWeapon = hasDamage && !producesNoHitboxes && !hasNonWeaponFunction; if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) ConsumeStealthByAttacking(); } From dfa94a232a71935cb73ff7bc96456ee1f8fcda10 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 3 May 2020 08:34:37 -0500 Subject: [PATCH 086/137] Slime God Core final phase changed to be more exciting. --- NPCs/SlimeGod/SlimeGodCore.cs | 102 ++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8daeaf3609..e34674ac77 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SlimeGod bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; npc.TargetClosest(true); Player player = Main.player[npc.target]; @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.velocity.Y > 16f) npc.velocity.Y = 16f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < 200; x++) { @@ -208,14 +208,14 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.Calamity().newAI[2] == 0f && npc.life > 0) { - npc.Calamity().newAI[2] = (float)npc.lifeMax; + npc.Calamity().newAI[2] = npc.lifeMax; } if (npc.life > 0) { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.Calamity().newAI[2]) + int num660 = (int)(npc.lifeMax * 0.05); + if ((npc.life + num660) < npc.Calamity().newAI[2]) { - npc.Calamity().newAI[2] = (float)npc.life; + npc.Calamity().newAI[2] = npc.life; npc.Calamity().newAI[3] = 1f; } } @@ -281,8 +281,8 @@ namespace CalamityMod.NPCs.SlimeGod int playerPosX = (int)player.Center.X / 16 + teleportX; int playerPosY = (int)player.Center.Y / 16 - teleportY; - npc.ai[2] = (float)playerPosX; - npc.ai[3] = (float)playerPosY; + npc.ai[2] = playerPosX; + npc.ai[3] = playerPosY; npc.localAI[1] = 1f; npc.netUpdate = true; } @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.SlimeGod // Teleport to location if (npc.alpha == 255) { - Vector2 position = new Vector2(npc.ai[2] * 16f - (float)(npc.width / 2), npc.ai[3] * 16f - (float)(npc.height / 2)); + Vector2 position = new Vector2(npc.ai[2] * 16f - (npc.width / 2), npc.ai[3] * 16f - (npc.height / 2)); npc.position = position; } @@ -304,7 +304,7 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.alpha < 55) { npc.alpha = 55; - npc.localAI[0] = (vectorCenter.X - player.Center.X < 0 ? 1f : -1f); + npc.localAI[0] = vectorCenter.X - player.Center.X < 0 ? 1f : -1f; npc.localAI[1] = 2f; } npc.netUpdate = true; @@ -315,7 +315,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.damage = 0; // Rotation - npc.rotation += (float)npc.direction * 0.3f; + npc.rotation += npc.direction * 0.3f; // Velocity boost if (npc.localAI[1] == 2f) @@ -325,11 +325,11 @@ namespace CalamityMod.NPCs.SlimeGod } // Spin velocity - float velocity = (float)(Math.PI * 2D) / (360f - (npc.ai[1] - ai1)); - npc.velocity = npc.velocity.RotatedBy((double)(-(double)velocity * npc.localAI[0])); + float velocity = MathHelper.TwoPi / (180f - (npc.ai[1] - ai1)); + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[0]); // Reset and charge at target - if (npc.ai[1] >= ai1 + 200f) + if (npc.ai[1] >= ai1 + 100f) { npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -343,18 +343,18 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] % 20f == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) + if (npc.ai[1] % 10f == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) { if (expertMode && Main.rand.NextBool(2)) { 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + 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)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -372,9 +372,9 @@ namespace CalamityMod.NPCs.SlimeGod } 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)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; num182 *= num183; @@ -385,11 +385,11 @@ namespace CalamityMod.NPCs.SlimeGod 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + 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)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -407,9 +407,9 @@ namespace CalamityMod.NPCs.SlimeGod } 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)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; num182 *= num183; @@ -432,11 +432,11 @@ namespace CalamityMod.NPCs.SlimeGod 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + 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)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -454,9 +454,9 @@ namespace CalamityMod.NPCs.SlimeGod } 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)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; num180 *= num183; num182 *= num183; @@ -467,11 +467,11 @@ namespace CalamityMod.NPCs.SlimeGod 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; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + 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)); + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; @@ -491,12 +491,12 @@ namespace CalamityMod.NPCs.SlimeGod 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)); + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += (float)Main.rand.Next(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); + num180 += Main.rand.Next(-30, 31); + num182 += Main.rand.Next(-30, 31); num180 *= num183; num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); @@ -524,11 +524,15 @@ namespace CalamityMod.NPCs.SlimeGod { num1372 += 8f; } + if (hyperMode) + { + num1372 *= 1.25f; + } - Vector2 vector167 = new Vector2(vectorCenter.X + (float)(npc.direction * 20), vectorCenter.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + Vector2 vector167 = new Vector2(vectorCenter.X + (npc.direction * 20), vectorCenter.Y + 6f); + float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; @@ -548,7 +552,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.direction = 1; } - npc.rotation += (float)npc.direction * 0.3f; + npc.rotation += npc.direction * 0.3f; return; } From f268ec77b9d11286129493855d395110fd331cf0 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 4 May 2020 19:11:27 -0400 Subject: [PATCH 087/137] Fixed double rogue crit shenanigans. --- Buffs/CalamityGlobalBuff.cs | 11 ---------- CalPlayer/CalamityPlayer.cs | 2 +- Items/CalamityGlobalItem.cs | 40 ------------------------------------- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index c4852c0263..d8d9834430 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -26,17 +26,6 @@ namespace CalamityMod.Buffs { player.lavaMax += 420; } - // Rogue weapons benefit from vanilla throwing crit, so don't double-increase rogue crit chance with these buffs. - /* - else if (type == BuffID.Rage) - { - player.Calamity().throwingCrit += 10; - } - else if (type == BuffID.WellFed) - { - player.Calamity().throwingCrit += 2; - } - */ else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) { float nebulaDamage = 0.075f * (float)player.nebulaLevelDamage; //7.5% to 22.5% diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ff818d43b0..fd691464e7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -224,7 +224,7 @@ namespace CalamityMod.CalPlayer public float throwingDamage = 1f; public float throwingVelocity = 1f; - public int throwingCrit = 4; + public int throwingCrit = 0; public bool throwingAmmoCost75 = false; public bool throwingAmmoCost66 = false; public bool throwingAmmoCost50 = false; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index de3ae8848c..8f9ad88a04 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -2787,35 +2787,11 @@ Provides heat and cold protection in Death Mode"; #region Body if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) player.Calamity().throwingCrit += 3; - 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; #endregion #region Legs if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) player.Calamity().throwingVelocity += 0.03f; - 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; #endregion } #endregion @@ -3098,21 +3074,6 @@ Provides heat and cold protection in Death Mode"; if (item.type == ItemID.HandWarmer) modPlayer.handWarmer = true; - if ((item.type == ItemID.MoonStone && !Main.dayTime) || (item.type == ItemID.SunStone && Main.dayTime)) - { - player.Calamity().throwingCrit += 2; - } - if (item.type == ItemID.CelestialStone) - player.Calamity().throwingCrit += 2; - if (item.type == ItemID.CelestialShell) - 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 == PrefixID.Hard) { @@ -3158,7 +3119,6 @@ Provides heat and cold protection in Death Mode"; player.rangedCrit -= 1; player.magicCrit -= 1; player.thrownCrit -= 1; - player.Calamity().throwingCrit += item.prefix == PrefixID.Lucky ? 3 : 1; } } #endregion From 2ff2a199b4f4d28565649956addf6d714a1ac3b0 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 4 May 2020 23:40:46 -0400 Subject: [PATCH 088/137] goddamn it base 4% reset effects --- CalPlayer/CalamityPlayer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fd691464e7..73c55c3cf8 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1245,7 +1245,7 @@ namespace CalamityMod.CalPlayer throwingDamage = 1f; throwingVelocity = 1f; - throwingCrit = 4; + throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; throwingAmmoCost50 = false; @@ -1931,7 +1931,7 @@ namespace CalamityMod.CalPlayer throwingDamage = 1f; throwingVelocity = 1f; - throwingCrit = 4; + throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; throwingAmmoCost50 = false; From 4e2e12d5237c910cf8f49815c6b5de607d630de4 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 4 May 2020 23:50:42 -0400 Subject: [PATCH 089/137] fixed stealth again for real i swear --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 73c55c3cf8..e7b5fc9ee5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9296,7 +9296,7 @@ namespace CalamityMod.CalPlayer bool isPickaxe = it.pick > 0; bool isAxe = it.axe > 0; bool isHammer = it.hammer > 0; - bool isPlaced = it.createTile != 0; + bool isPlaced = it.createTile != -1; bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) From 101c421c5ebb414e9ac90f95fb0a0f094377708e Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 5 May 2020 09:51:01 -0500 Subject: [PATCH 090/137] Skeletron Prime rev+ fixes and HP buff. --- NPCs/CalamityGlobalAI.cs | 32 ++++++++++++-------------------- NPCs/CalamityGlobalNPC.cs | 5 +++-- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 0c6276be10..7cec0eefd7 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -6377,24 +6377,16 @@ namespace CalamityMod.NPCs // Kill all arms if Prime Head enters phase 2 if (phase2 && !allArmsDead) { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - KillNPC(Main.npc[CalamityGlobalNPC.primeCannon]); - - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - KillNPC(Main.npc[CalamityGlobalNPC.primeLaser]); - - if (Main.npc[CalamityGlobalNPC.primeVice].active) - KillNPC(Main.npc[CalamityGlobalNPC.primeVice]); - - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - KillNPC(Main.npc[CalamityGlobalNPC.primeSaw]); - - void KillNPC(NPC npc2) + for (int i = 0; i < Main.maxNPCs; i++) { - npc2.life = -1; - npc2.HitEffect(0, 10.0); - npc2.active = false; - npc2.netUpdate = true; + NPC npc2 = Main.npc[i]; + if (npc2.type == NPCID.PrimeCannon || npc2.type == NPCID.PrimeLaser || npc2.type == NPCID.PrimeSaw || npc2.type == NPCID.PrimeVice) + { + npc2.life = -1; + npc2.HitEffect(0, 10.0); + npc2.active = false; + npc2.netUpdate = true; + } } } @@ -6489,11 +6481,11 @@ namespace CalamityMod.NPCs // Spread of rockets if cannon is dead if (!cannonAlive) { - npc.localAI[2] += allArmsDead ? 2f : 1f; + npc.localAI[2] += allArmsDead ? 1.5f : 1f; if (phase3) - npc.localAI[2] += 1f; + npc.localAI[2] += 0.5f; - if (npc.localAI[2] >= 240f) + if (npc.localAI[2] >= 300f) { npc.localAI[2] = 0f; float num502 = CalamityWorld.bossRushActive ? 12f : 8f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bda56ad8ba..501485d045 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -839,7 +839,7 @@ namespace CalamityMod.NPCs break; case NPCID.SkeletronPrime: - npc.lifeMax = (int)(npc.lifeMax * 1.45); + npc.lifeMax = (int)(npc.lifeMax * 1.9); npc.npcSlots = 12f; break; @@ -978,7 +978,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronPrime) { - npc.npcSlots = 12f; + npc.lifeMax = (int)(npc.lifeMax * 1.45); + npc.npcSlots = 12f; } else if (npc.type == NPCID.Retinazer) { From 6ada194f944eba6b1862a33a4e9e45d9e27e2c7f Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 12:09:26 -0400 Subject: [PATCH 091/137] adjusted brimstone sword --- NPCs/Bumblebirb/Bumblefuck2.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 16 +++++++--------- Projectiles/Boss/RedLightning.cs | 2 +- Projectiles/Melee/ProfanedSwordProj.cs | 11 ++++++++++- Projectiles/Summon/RadiantResolutionAura.cs | 6 +++--- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 7b6a4556f1..0ac40a6f9f 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (npc.ai[0] == 2.1f) { - npc.damage = (int)((double)npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.5); if (npc.velocity.X < 0f) { npc.direction = -1; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bda56ad8ba..1f38ee611d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3569,16 +3569,15 @@ namespace CalamityMod.NPCs else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.38); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 3; - damage = (int)(damage * 0.3); } else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.25); + } + else if (projectile.type == ProjectileType()) + { + if (projectile.penetrate == -1) + projectile.penetrate = 3; } } else if (AquaticScourgeIDs.Contains(npc.type)) @@ -3595,7 +3594,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) { if (projectile.penetrate == -1) projectile.penetrate = 2; @@ -3604,8 +3603,7 @@ namespace CalamityMod.NPCs else if (projectile.type == ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 2; - damage = (int)(damage * 0.05); + projectile.penetrate = 3; } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index aef7436204..a53b1b96fb 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num859].scale = 1.2f; num3 = num856; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { Vector2 value39 = projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num860 = Dust.NewDust(projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 05009bac76..c1cf5da794 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Melee { public class ProfanedSwordProj : ModProjectile { + private int explosionCount = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Sword"); @@ -65,8 +66,16 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 180); if (Main.myPlayer == projectile.owner) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), knockback, projectile.owner); + if (explosionCount < 3) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), knockback, projectile.owner); + explosionCount++; + } } + if (projectile.damage > 1) + projectile.damage = (int)(projectile.damage * 0.6); + if (projectile.damage <= 0) + projectile.damage = 1; } } } diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index 986feb0960..cd6bd7719b 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -91,18 +91,18 @@ namespace CalamityMod.Projectiles.Summon { float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f, - ModContent.ProjectileType(), radiantOrbDamage / 2, 1f, projectile.owner); + ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } if (projectile.ai[1] % radiantOrbAppearRate == radiantOrbAppearRate - 1) { Projectile.NewProjectile(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(100f, 360f), - projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, 4f, projectile.owner); + projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); for (int i = 0; i < 4; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(40f), MathHelper.ToRadians(40f), i / 4f); Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f, - ModContent.ProjectileType(), radiantOrbDamage / 2, 1f, projectile.owner); + ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } } From fdca8c94c264a19058377bed9315e984fff55e48 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 12:12:47 -0400 Subject: [PATCH 092/137] brimstone sword change again --- NPCs/CalamityGlobalNPC.cs | 10 ---------- Projectiles/Melee/BrimstoneSwordExplosion.cs | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 235aa9c898..0e286c22a2 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3574,11 +3574,6 @@ namespace CalamityMod.NPCs else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.25); - } - else if (projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 3; } } else if (AquaticScourgeIDs.Contains(npc.type)) @@ -3600,11 +3595,6 @@ namespace CalamityMod.NPCs if (projectile.penetrate == -1) projectile.penetrate = 2; damage = (int)(damage * 0.1); - } - else if (projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 3; } } else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index 5d99bf64c6..01105d1fc3 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.penetrate = 3; projectile.timeLeft = 60; projectile.melee = true; projectile.usesLocalNPCImmunity = true; From cc07df666cad502008dc1127b5e583f6c25fe4a6 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 12:33:04 -0400 Subject: [PATCH 093/137] balancing --- Items/CalamityGlobalItem.cs | 4 +++- Items/Weapons/Melee/Roxcalibur.cs | 2 +- Items/Weapons/Ranged/LeadWizard.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 22 +++++++++------------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8f9ad88a04..086302aebc 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -112,7 +112,9 @@ namespace CalamityMod.Items item.damage = (int)(item.damage * 0.75); else if (item.type == ItemID.BlizzardStaff) item.damage = (int)(item.damage * 0.7); - else if (item.type == ItemID.StardustDragonStaff || item.type == ItemID.LaserMachinegun) + else if (item.type == ItemID.LaserMachinegun) + item.damage = (int)(item.damage * 0.6); + else if (item.type == ItemID.StardustDragonStaff) item.damage = (int)(item.damage * 0.5); if (item.type == ItemID.BookStaff) diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 3154f080e3..243fe4e424 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 100; + item.damage = 80; item.knockBack = 13; item.crit += 8; item.melee = true; diff --git a/Items/Weapons/Ranged/LeadWizard.cs b/Items/Weapons/Ranged/LeadWizard.cs index 681067bed5..8c8aff1999 100644 --- a/Items/Weapons/Ranged/LeadWizard.cs +++ b/Items/Weapons/Ranged/LeadWizard.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 65; + item.damage = 58; item.crit += 30; item.ranged = true; item.width = 66; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 0e286c22a2..1706963463 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3489,29 +3489,29 @@ namespace CalamityMod.NPCs if (AstrumDeusIDs.Contains(npc.type)) { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) { damage = (int)(damage * 0.1); } - else if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)(damage * 0.15); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if () { damage = (int)(damage * 0.3); } - else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) { damage = (int)(damage * 0.4); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { - damage = (int)(damage * 0.8); + damage = (int)(damage * 0.6); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.85); } if (projectile.penetrate == -1 && !projectile.minion) @@ -3637,10 +3637,6 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.8); } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.9); - } } else if (npc.type == NPCID.CultistBoss) { From d735d3804e59bfa366703e7796ef5ae6f9af68b9 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 5 May 2020 12:56:30 -0500 Subject: [PATCH 094/137] Fixed Providence issue. --- NPCs/Providence/Providence.cs | 37 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index f857b43490..8e609a7ef9 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -763,23 +763,6 @@ namespace CalamityMod.NPCs.Providence num867 *= -1f; } - if (npc.ai[3] == 0f) - { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - projectile.Kill(); - } - } - } - } - - npc.ai[3] += 1f; - /*if (npc.velocity.Length() <= 2f) npc.velocity = Vector2.Zero; if (npc.velocity.Length() > 2f) @@ -845,8 +828,10 @@ namespace CalamityMod.NPCs.Providence if (attackRateMult > 1D) num870 += (int)Math.Ceiling(attackRateMult * 1.6); - if (npc.ai[3] % num870 == 0f) + npc.ai[1] += 1f; + if (npc.ai[1] >= num870) { + npc.ai[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { if (Main.rand.NextBool(4) && !death) @@ -856,7 +841,23 @@ namespace CalamityMod.NPCs.Providence } } + if (npc.ai[3] == 0f) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + projectile.Kill(); + } + } + } + } + // Air is burning text + npc.ai[3] += 1f; if (npc.ai[3] >= 450f && !text) { text = true; From fb4fff3fbed797318f12eb6d98355649b200c1b8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 16:54:36 -0400 Subject: [PATCH 095/137] brimmy dr change --- NPCs/BrimstoneElemental/Brimling.cs | 2 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index e1df991d27..a68b3c5f5d 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public class Brimling : ModNPC { private bool boostDR = false; - public static float normalDR = 0.2f; + public static float normalDR = 0.15f; public static float boostedDR = 0.8f; public override void SetStaticDefaults() diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 5b25421f28..e4c7ab42f8 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -42,6 +42,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.defense = 15; npc.value = Item.buyPrice(0, 12, 0, 0); npc.LifeMaxNERB(30000, 41000, 6500000); + npc.Calamity().DR = 0.15f; if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { npc.damage *= 3; From 896fa1ca5154bf28831e69b83f4529c4bccdeab3 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 5 May 2020 16:58:39 -0500 Subject: [PATCH 096/137] Removed an empty else if --- NPCs/CalamityGlobalNPC.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1706963463..1b0c7dc39b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3493,10 +3493,6 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.1); } - else if () - { - damage = (int)(damage * 0.3); - } else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) { damage = (int)(damage * 0.4); From 83cd7e604ce600523b20ef19f3aaa5c19daffbe3 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 20:40:48 -0400 Subject: [PATCH 097/137] moved joyful heart to the starter bag --- CalPlayer/CalamityPlayer.cs | 2 -- Items/TreasureBags/StarterBag.cs | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e7b5fc9ee5..ca999946af 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2387,8 +2387,6 @@ namespace CalamityMod.CalPlayer if (!mediumcoreDeath) { - if (player.name == "Aleksh" || player.name == "Shark Lad") - items.Add(createItem(ModContent.ItemType())); items.Add(createItem(ModContent.ItemType())); items.Add(createItem(ModContent.ItemType())); items.Add(createItem(ModContent.ItemType())); diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs index 73156c9ba8..aaa86fe5ac 100644 --- a/Items/TreasureBags/StarterBag.cs +++ b/Items/TreasureBags/StarterBag.cs @@ -1,4 +1,4 @@ - +using CalamityMod.Items.Pets; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; @@ -24,10 +24,7 @@ namespace CalamityMod.Items.TreasureBags item.rare = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -54,13 +51,16 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ItemID.Torch, 25); DropHelper.DropItem(player, ItemID.Chest, 3); - // Difficulty items - DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItem(player, ModContent.ItemType()); + // Difficulty items (doesn't drop in Normal) + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); // Speedrun King Slime DropHelper.DropItem(player, ItemID.SlimeCrown); + // The Lad + DropHelper.DropItemCondition(player, ModContent.ItemType(), player.name == "Aleksh" || player.name == "Shark Lad"); + // Music box (if music mod installed) Mod musicMod = ModLoader.GetMod("CalamityModMusic"); if (musicMod != null) From e8744fb064c6b834e960f09ae5b84814fec5fa75 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 5 May 2020 20:50:56 -0400 Subject: [PATCH 098/137] added a 2 second cooldown to fetid emesis burp --- CalPlayer/CalamityPlayer.cs | 2 ++ CalPlayer/CalamityPlayerMiscEffects.cs | 2 ++ Items/Weapons/Ranged/FetidEmesis.cs | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ca999946af..393102688e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -178,6 +178,7 @@ namespace CalamityMod.CalPlayer public float shieldInvinc = 5f; public GaelSwitchPhase gaelSwitchTimer = 0; public int galileoCooldown = 0; + public int soundCooldown = 0; public int planarSpeedBoost = 0; public int profanedSoulWeaponUsage = 0; public int profanedSoulWeaponType = 0; @@ -1840,6 +1841,7 @@ namespace CalamityMod.CalPlayer gaelSwitchTimer = (GaelSwitchPhase)0; planarSpeedBoost = 0; galileoCooldown = 0; + soundCooldown = 0; rage = 0; adrenaline = 0; raiderStack = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 67f9f392bd..5995089836 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -854,6 +854,8 @@ namespace CalamityMod.CalPlayer modPlayer.gainRageCooldown--; if (modPlayer.galileoCooldown > 0) modPlayer.galileoCooldown--; + if (modPlayer.soundCooldown > 0) + modPlayer.soundCooldown--; if (modPlayer.raiderCooldown > 0) modPlayer.raiderCooldown--; if (modPlayer.gSabatonCooldown > 0) diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index cd034864dc..fc97bacfa5 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -51,8 +51,12 @@ namespace CalamityMod.Items.Weapons.Ranged dust.velocity = Vector2.Normalize(new Vector2(speedX, speedY)).RotatedByRandom(MathHelper.ToRadians(15f)); dust.noGravity = true; } - // WoF vomit sound. - Main.PlaySound(SoundID.NPCKilled, position, 13); + if (player.Calamity().soundCooldown <= 0) + { + // WoF vomit sound. + Main.PlaySound(SoundID.NPCKilled, position.X, position.Y, 13, 0.5f, 0f); + player.Calamity().soundCooldown = 120; + } return false; } return true; From a8560a4003a213675caeb008e28a82a26a2b3f47 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 7 May 2020 07:06:44 -0500 Subject: [PATCH 099/137] Typo fix --- Items/Accessories/DukeScales.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs index b9f6ae81d3..fc0923c027 100644 --- a/Items/Accessories/DukeScales.cs +++ b/Items/Accessories/DukeScales.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("While under the effects of a damaging debuff, you gain 10% increased damage and 5% crit\n" + "For every 25% of lost life, you gain 6% increased damage and 3% crit\n" + "This will max out at 18% increased damage and 9% crit when under 25% life\n" + - "Provides immunity to poisoned, venom, and sulphruic poisoning"); + "Provides immunity to poisoned, venom, and sulphuric poisoning"); } public override void SetDefaults() From 30be88cf417109b0afe8351bd6e0f8a1e1ffe06c Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 7 May 2020 18:16:05 -0500 Subject: [PATCH 100/137] Dark Energy fix, Tarragon Mask tooltip edit, preparing Calamity for Chaos Mod shit. --- Items/Armor/TarragonMask.cs | 2 +- NPCs/CalamityGlobalAI.cs | 58 ++++++++++++------------- NPCs/CalamityGlobalNPC.cs | 72 +++++++++++++++---------------- NPCs/CeaselessVoid/DarkEnergy.cs | 2 +- NPCs/CeaselessVoid/DarkEnergy2.cs | 2 +- NPCs/CeaselessVoid/DarkEnergy3.cs | 2 +- 6 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 1e1f9b171c..4d162d5f89 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Armor "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + "On every 5th critical strike you will fire a leaf storm\n" + - "Magic projectiles have a 50% chance to heal you on enemy hits\n" + + "Magic projectiles heal you on enemy hits\n" + "Amount healed is based on projectile damage"; } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 7cec0eefd7..6a3f5f39e2 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed King Slime AI - public static bool BuffedKingSlimeAI(NPC npc, Mod mod) + public static bool BuffedKingSlimeAI(NPC npc, Mod mod, bool chaos) { // Variables float num234 = 1f; @@ -547,7 +547,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Eye of Cthulhu AI - public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -1367,7 +1367,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Eater of Worlds AI - public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) + public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -1857,7 +1857,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Brain of Cthulhu AI - public static bool BuffedBrainofCthulhuAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedBrainofCthulhuAI(NPC npc, bool enraged, Mod mod, bool chaos) { // whoAmI variable NPC.crimsonBoss = npc.whoAmI; @@ -2419,7 +2419,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedCreeperAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedCreeperAI(NPC npc, bool enraged, Mod mod, bool chaos) { // Despawn if Brain is gone if (NPC.crimsonBoss < 0) @@ -2510,7 +2510,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Queen Bee AI - public static bool BuffedQueenBeeAI(NPC npc, Mod mod) + public static bool BuffedQueenBeeAI(NPC npc, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -3100,7 +3100,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Skeletron AI - public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -3552,7 +3552,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedSkeletronHandAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedSkeletronHandAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -3771,7 +3771,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Wall of Flesh AI - public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -4143,7 +4143,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -4276,7 +4276,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Destroyer AI - public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -4845,7 +4845,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Twins AI - public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -5532,7 +5532,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -6287,7 +6287,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Skeletron Prime AI - public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -6906,7 +6906,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) + public static bool BuffedPrimeLaserAI(NPC npc, Mod mod, bool chaos) { bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -7153,7 +7153,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) + public static bool BuffedPrimeCannonAI(NPC npc, Mod mod, bool chaos) { bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -7412,7 +7412,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeViceAI(NPC npc, Mod mod) + public static bool BuffedPrimeViceAI(NPC npc, Mod mod, bool chaos) { // Direction npc.spriteDirection = -(int)npc.ai[0]; @@ -7724,7 +7724,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeSawAI(NPC npc, Mod mod) + public static bool BuffedPrimeSawAI(NPC npc, Mod mod, bool chaos) { Vector2 vector50 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num462 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector50.X; @@ -8011,7 +8011,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Plantera AI - public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -8565,7 +8565,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPlanterasHookAI(NPC npc, Mod mod) + public static bool BuffedPlanterasHookAI(NPC npc, Mod mod, bool chaos) { // Variables bool enrage = false; @@ -8712,7 +8712,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod) + public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod, bool chaos) { bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -8818,7 +8818,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Golem AI - public static bool BuffedGolemAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedGolemAI(NPC npc, bool enraged, Mod mod, bool chaos) { // whoAmI variable NPC.golemBoss = npc.whoAmI; @@ -9164,7 +9164,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod, bool chaos) { // Don't collide npc.noTileCollide = true; @@ -9413,7 +9413,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedGolemHeadFreeAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedGolemHeadFreeAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -9716,7 +9716,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Duke Fishron AI - public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -10775,7 +10775,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Cultist AI - public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -11828,7 +11828,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedAncientLightAI(NPC npc, Mod mod) + public static bool BuffedAncientLightAI(NPC npc, Mod mod, bool chaos) { bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -11915,7 +11915,7 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedAncientDoomAI(NPC npc, Mod mod) + public static bool BuffedAncientDoomAI(NPC npc, Mod mod, bool chaos) { bool death = CalamityWorld.death || CalamityWorld.bossRushActive; npc.damage = npc.defDamage = 0; @@ -12010,7 +12010,7 @@ namespace CalamityMod.NPCs #endregion #region Buffed Moon Lord AI - public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod) + public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1b0c7dc39b..5552a33bd1 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1414,8 +1414,7 @@ namespace CalamityMod.NPCs #region Strike NPC public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - Mod chaos = ModLoader.GetMod("ChaosMod"); - if ((CalamityWorld.revenge && chaos == null) || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { if (DestroyerIDs.Contains(npc.type)) { @@ -1665,77 +1664,79 @@ namespace CalamityMod.NPCs BossRushForceDespawnOtherNPCs(npc, mod); } - Mod chaos = ModLoader.GetMod("ChaosMod"); - if ((CalamityWorld.revenge && chaos == null) || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { - switch (npc.type) + Mod chaos = ModLoader.GetMod("ChaosMod"); + bool chaosMode = chaos != null; + + switch (npc.type) { case NPCID.KingSlime: - return CalamityGlobalAI.BuffedKingSlimeAI(npc, mod); + return CalamityGlobalAI.BuffedKingSlimeAI(npc, mod, chaosMode); case NPCID.EyeofCthulhu: - return CalamityGlobalAI.BuffedEyeofCthulhuAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedEyeofCthulhuAI(npc, enraged > 0, mod, chaosMode); case NPCID.EaterofWorldsHead: case NPCID.EaterofWorldsBody: case NPCID.EaterofWorldsTail: - return CalamityGlobalAI.BuffedEaterofWorldsAI(npc, mod); + return CalamityGlobalAI.BuffedEaterofWorldsAI(npc, mod, chaosMode); case NPCID.BrainofCthulhu: - return CalamityGlobalAI.BuffedBrainofCthulhuAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedBrainofCthulhuAI(npc, enraged > 0, mod, chaosMode); case NPCID.Creeper: - return CalamityGlobalAI.BuffedCreeperAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedCreeperAI(npc, enraged > 0, mod, chaosMode); case NPCID.QueenBee: - return CalamityGlobalAI.BuffedQueenBeeAI(npc, mod); + return CalamityGlobalAI.BuffedQueenBeeAI(npc, mod, chaosMode); case NPCID.SkeletronHand: - return CalamityGlobalAI.BuffedSkeletronHandAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedSkeletronHandAI(npc, enraged > 0, mod, chaosMode); case NPCID.SkeletronHead: - return CalamityGlobalAI.BuffedSkeletronAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedSkeletronAI(npc, enraged > 0, mod, chaosMode); case NPCID.WallofFlesh: - return CalamityGlobalAI.BuffedWallofFleshAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedWallofFleshAI(npc, enraged > 0, mod, chaosMode); case NPCID.WallofFleshEye: - return CalamityGlobalAI.BuffedWallofFleshEyeAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedWallofFleshEyeAI(npc, enraged > 0, mod, chaosMode); case NPCID.TheDestroyer: case NPCID.TheDestroyerBody: case NPCID.TheDestroyerTail: - return CalamityGlobalAI.BuffedDestroyerAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedDestroyerAI(npc, enraged > 0, mod, chaosMode); case NPCID.Retinazer: - return CalamityGlobalAI.BuffedRetinazerAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedRetinazerAI(npc, enraged > 0, mod, chaosMode); case NPCID.Spazmatism: - return CalamityGlobalAI.BuffedSpazmatismAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedSpazmatismAI(npc, enraged > 0, mod, chaosMode); case NPCID.SkeletronPrime: - return CalamityGlobalAI.BuffedSkeletronPrimeAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedSkeletronPrimeAI(npc, enraged > 0, mod, chaosMode); case NPCID.PrimeLaser: - return CalamityGlobalAI.BuffedPrimeLaserAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeLaserAI(npc, mod, chaosMode); case NPCID.PrimeCannon: - return CalamityGlobalAI.BuffedPrimeCannonAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeCannonAI(npc, mod, chaosMode); case NPCID.PrimeVice: - return CalamityGlobalAI.BuffedPrimeViceAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeViceAI(npc, mod, chaosMode); case NPCID.PrimeSaw: - return CalamityGlobalAI.BuffedPrimeSawAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeSawAI(npc, mod, chaosMode); case NPCID.Plantera: - return CalamityGlobalAI.BuffedPlanteraAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedPlanteraAI(npc, enraged > 0, mod, chaosMode); case NPCID.PlanterasHook: - return CalamityGlobalAI.BuffedPlanterasHookAI(npc, mod); + return CalamityGlobalAI.BuffedPlanterasHookAI(npc, mod, chaosMode); case NPCID.PlanterasTentacle: - return CalamityGlobalAI.BuffedPlanterasTentacleAI(npc, mod); + return CalamityGlobalAI.BuffedPlanterasTentacleAI(npc, mod, chaosMode); case NPCID.Golem: - return CalamityGlobalAI.BuffedGolemAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedGolemAI(npc, enraged > 0, mod, chaosMode); case NPCID.GolemHead: - return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged > 0, mod, chaosMode); case NPCID.GolemHeadFree: - return CalamityGlobalAI.BuffedGolemHeadFreeAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedGolemHeadFreeAI(npc, enraged > 0, mod, chaosMode); case NPCID.DukeFishron: - return CalamityGlobalAI.BuffedDukeFishronAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedDukeFishronAI(npc, enraged > 0, mod, chaosMode); case NPCID.Pumpking: if (CalamityWorld.downedDoG) @@ -1771,19 +1772,18 @@ namespace CalamityMod.NPCs case NPCID.CultistBoss: case NPCID.CultistBossClone: - return CalamityGlobalAI.BuffedCultistAI(npc, enraged > 0, mod); + return CalamityGlobalAI.BuffedCultistAI(npc, enraged > 0, mod, chaosMode); case NPCID.AncientLight: - return CalamityGlobalAI.BuffedAncientLightAI(npc, mod); + return CalamityGlobalAI.BuffedAncientLightAI(npc, mod, chaosMode); case NPCID.AncientDoom: - return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); + return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod, chaosMode); case NPCID.MoonLordCore: case NPCID.MoonLordHand: case NPCID.MoonLordHead: case NPCID.MoonLordFreeEye: case NPCID.MoonLordLeechBlob: - return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged > 0, mod); - + return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged > 0, mod, chaosMode); default: break; @@ -2355,7 +2355,7 @@ namespace CalamityMod.NPCs break; } } - else if (Main.expertMode && chaos == null) + else if (Main.expertMode) { if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) return CalamityGlobalAI.BuffedSporeAI(npc, mod, false); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 7a40c439f2..8d950437c8 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool CheckActive() { - return false; + return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; } public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 237afdd54d..d8a50f1e32 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool CheckActive() { - return false; + return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; } public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index 1763a24bf1..4288c4e321 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool CheckActive() { - return false; + return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; } public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) From ffcb16bdfc2b44dec153863431d0518f012979ad Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 7 May 2020 21:23:09 -0500 Subject: [PATCH 101/137] Fixed an error with Fetid Emesis. --- Items/Weapons/Ranged/FetidEmesis.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index fc97bacfa5..92462ddbf0 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().soundCooldown <= 0) { // WoF vomit sound. - Main.PlaySound(SoundID.NPCKilled, position.X, position.Y, 13, 0.5f, 0f); + Main.PlaySound(SoundID.NPCKilled, (int)position.X, (int)position.Y, 13, 0.5f, 0f); player.Calamity().soundCooldown = 120; } return false; From b8842b06cc23fc5998d5e71a51de68dfbe0a9c52 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 May 2020 20:12:04 -0400 Subject: [PATCH 102/137] Fixed arm rotation bug with Yharim's Crystal. --- Projectiles/Magic/YharimsCrystalPrism.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 4130582c2b..8592f7e5cc 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -150,7 +149,9 @@ namespace CalamityMod.Projectiles.Magic player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + + // Multiplying by projectile.direction is required due to vanilla spaghetti. + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); } private void SpawnEjectionDust(float charge) From 41ac8ec337994abdaecdc0d471d0dd475d39a9b3 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 May 2020 20:12:31 -0400 Subject: [PATCH 103/137] Rewrote Valkyrie Ray as a holdout. Now benefits from speed reforges. --- Items/Weapons/Magic/ValkyrieRay.cs | 89 ++------------- Projectiles/Magic/ValkyrieRayBeam.cs | 4 +- Projectiles/Magic/ValkyrieRayStaff.cs | 144 +++++++++++++++++++++++++ Projectiles/Magic/ValkyrieRayStaff.png | Bin 0 -> 1095 bytes 4 files changed, 156 insertions(+), 81 deletions(-) create mode 100644 Projectiles/Magic/ValkyrieRayStaff.cs create mode 100644 Projectiles/Magic/ValkyrieRayStaff.png diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 1c75922f5e..095e5705b7 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -9,10 +9,13 @@ namespace CalamityMod.Items.Weapons.Magic { public class ValkyrieRay : ModItem { + // The base use time of the weapon is 47: 28 charge frames + 19 cooldown frames. + // The rate at which it progresses through its charge and discharge cycle is dynamically sped up by reforges. + // This math is handled in its holdout projectile, ValkyrieRayStaff. + public const int ChargeFrames = 28; + public const int CooldownFrames = 19; + public const float GemDistance = 18f; public static readonly Color LightColor = new Color(235, 40, 121); - private const float GemDistance = 18f; - private const int ReuseCount = 14; - private int useCounter = 0; public override void SetStaticDefaults() { @@ -29,91 +32,19 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 8.5f; item.magic = true; item.mana = 26; - item.useTime = 2; - item.useAnimation = item.useTime * ReuseCount; + item.useTime = ChargeFrames + CooldownFrames; + item.useAnimation = ChargeFrames + CooldownFrames; item.useStyle = 5; item.UseSound = SoundID.NPCDeath7; item.useTurn = false; item.noMelee = true; + item.noUseGraphic = true; item.value = Item.buyPrice(gold: 36); item.rare = 5; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; } - public override Vector2? HoldoutOrigin() => new Vector2(10, 10); - - // The weapon functions as a fake Clockwork Assault Rifle where only one the many shots actually fires something. - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - useCounter++; - - // Compute the gem position, which is needed for both charging and firing - float angle = new Vector2(speedX, speedY).ToRotation(); - Vector2 gemOffset = Vector2.One * GemDistance * 1.4142f; // distance to gem on staff - Vector2 gemPos = position + gemOffset.RotatedBy(angle - MathHelper.PiOver4); - - // Actually fire the weapon if it's the final reuse - if (useCounter == ReuseCount) - { - // Produce firing dust and play sound - if (Main.netMode != NetmodeID.Server) - { - SpawnFiringDust(gemPos); - Main.PlaySound(SoundID.Item28, gemPos); - Main.PlaySound(SoundID.Item60, gemPos); - } - useCounter = 0; - - // Change the projectile's spawning position to the gem position - position = gemPos; - - // Manually set the player's item times to longer when the weapon is fired so the staff sticks around a little longer - player.itemTime = 19; - player.itemAnimation = 19; - player.itemAnimationMax = 19; - return true; - } - - // Otherwise, produce small amounts of charging dust and light which scales with the charge. - else if (Main.netMode != NetmodeID.Server) - { - SpawnChargeDust(gemPos); - float brightness = (float)useCounter / ReuseCount; - Lighting.AddLight(gemPos, LightColor.ToVector3() * brightness); - } - return false; - } - - private void SpawnFiringDust(Vector2 center) - { - int numDust = 36; - int dustID = 73; - for(int i = 0; i < numDust; ++i) - { - Dust d = Dust.NewDustDirect(center, 0, 0, dustID, 0f, 0f); - d.velocity = (i * MathHelper.TwoPi / numDust).ToRotationVector2() * 2.2f; - d.scale = 1.4f; - d.noGravity = true; - } - } - - private void SpawnChargeDust(Vector2 center) - { - int numDust = 2; - int dustID = 73; - float incomingRadius = 9f; - for(int i = 0; i < numDust; ++i) - { - Vector2 offsetUnit = Main.rand.NextVector2Unit(); - Vector2 dustPos = center + offsetUnit * incomingRadius; - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f); - d.velocity = offsetUnit * -Main.rand.NextFloat(2f, 3.5f); - d.scale = Main.rand.NextFloat(0.4f, 1f); - d.noGravity = true; - } - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index cf9afc1ca1..57be18cc03 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -135,8 +135,8 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - // If the beam doesn't have a defined projection vector, don't draw anything. - if (beamVector == Vector2.Zero) + // If the beam doesn't have a defined projection vector or hasn't yet had its velocity set to zero, don't draw anything. + if (beamVector == Vector2.Zero || projectile.velocity != Vector2.Zero) return false; Texture2D tex = Main.projectileTexture[projectile.type]; diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs new file mode 100644 index 0000000000..5e52313fe0 --- /dev/null +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -0,0 +1,144 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ValkyrieRayStaff : ModProjectile + { + private const float AimResponsiveness = 0.66f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valkyrie Ray"); + } + + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 52; + // This projectile has no hitboxes and no damage type. + projectile.friendly = false; + projectile.melee = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 900; + } + + // ai[0] is a time-dilated frame counter. ai[1] is whether the beam has already fired. + // localAI[0] is the rate at which the "frame" counter increases. + public override void AI() + { + Player player = Main.player[projectile.owner]; + Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); + + // Calculate how quickly the staff should charge. Charge increases by some number close to 1 every frame. + // Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1. + if (projectile.localAI[0] == 0f) + projectile.localAI[0] = 47f / Main.player[projectile.owner].HeldItem.useTime; + + // Increment the timer for the staff. If the timer has passed 47, destroy it. + projectile.ai[0] += projectile.localAI[0]; + int maxTime = ValkyrieRay.ChargeFrames + ValkyrieRay.CooldownFrames; + if (projectile.ai[0] > maxTime) + { + projectile.Kill(); + return; + } + + // Compute the weapon's charge. + float chargeLevel = MathHelper.Clamp(projectile.ai[0] / ValkyrieRay.ChargeFrames, 0f, 1f); + + // Common code among holdouts to keep the holdout projectile directly in the player's hand + UpdatePlayerVisuals(player, rrp); + + // Compute the gem position, which is needed for visual effects + float angle = projectile.rotation - MathHelper.PiOver2; + Vector2 gemOffset = Vector2.One * ValkyrieRay.GemDistance * 1.4142f; // distance to gem on staff + Vector2 gemPos = projectile.Center + gemOffset.RotatedBy(angle); + + // Firing or charging? + if (chargeLevel >= 1f && projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; // so it never fires again + FiringEffects(gemPos); + if (projectile.owner == Main.myPlayer) + { + Projectile laser = Projectile.NewProjectileDirect(gemPos, projectile.velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + laser.Center = gemPos; + } + } + else if (projectile.ai[1] == 0f) + { + // The player can constantly re-aim the staff while it's charging, but once it fires it is locked in place. + UpdateAim(rrp, projectile.velocity.Length()); + ChargingEffects(gemPos, chargeLevel); + } + } + + private void UpdatePlayerVisuals(Player player, Vector2 rrp) + { + // Place the projectile directly into the player's hand at all times + projectile.Center = rrp; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + // The staff is a holdout projectile, so change the player's variables to reflect that + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + + // Multiplying by projectile.direction is required due to vanilla spaghetti. + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + // Adjusts the aim vector of the staff to point towards the mouse. This is Last Prism code. + private void UpdateAim(Vector2 source, float speed) + { + Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(projectile.velocity), AimResponsiveness)); + aimVector *= 30f; + + if (aimVector != projectile.velocity) + projectile.netUpdate = true; + projectile.velocity = aimVector; + } + + private void ChargingEffects(Vector2 center, float chargeLevel) + { + Lighting.AddLight(center, ValkyrieRay.LightColor.ToVector3() * chargeLevel); + + int numDust = 2; + int dustID = 73; + float incomingRadius = 9f; + for (int i = 0; i < numDust; ++i) + { + Vector2 offsetUnit = Main.rand.NextVector2Unit(); + Vector2 dustPos = center + offsetUnit * incomingRadius; + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f); + d.velocity = offsetUnit * -Main.rand.NextFloat(2f, 3.5f); + d.scale = Main.rand.NextFloat(0.4f, 1f); + d.noGravity = true; + } + } + + private void FiringEffects(Vector2 center) + { + Main.PlaySound(SoundID.Item28, center); + Main.PlaySound(SoundID.Item60, center); + int numDust = 36; + int dustID = 73; + for (int i = 0; i < numDust; ++i) + { + Dust d = Dust.NewDustDirect(center, 0, 0, dustID, 0f, 0f); + d.velocity = (i * MathHelper.TwoPi / numDust).ToRotationVector2() * 2.2f; + d.scale = 1.4f; + d.noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/ValkyrieRayStaff.png b/Projectiles/Magic/ValkyrieRayStaff.png new file mode 100644 index 0000000000000000000000000000000000000000..18ec195aa0f50f4959122b73dc463d40b2cb50bb GIT binary patch literal 1095 zcmV-N1i1T&P)Px(0ZBwbRA_h2#maR1lY5yC427ph{0dd;1CV<0{TiYHL+w2__d=e z3)j|62kYM1hCDVla;O(DV^Y~ajvxG`4cuLO3n-r)n>u{a2i$(ojbKMzT^829eHW;&JAzznl~;_9C>ZNMX+!hoPXRydOrAUIUt0*4 ztf~V=Ba0)r_r7J|i%nazklFtQ*zo3ypl0D@u=3GQ!=nnuE{NWCx87pt%Woe`%)4R1 zTVUR-DG`jFFcmcI?Mj$Rvv|R+pz^BH2%7e_Bae*@#5tBQ)42Z_axoNGxokUVXxag; zu9_Ob>C>ginOgtx{otA94}%q}YryomD-zEOrasARM!{I$NgI0kjgyJ%S+grZLsNWx zusJq6Zq$SKhP%w6}c=n~k;Ju|Y!3*!VpBahIxln&?{pt{M=UHFLTVof!9t&Ci z<>TYt#LvISIo~S}R)fzsC+9z29-CUzb_!HPqaygLyc`@p)S0fV0}+K7>p#I%ZFQWT zXByhG@MKL@V&2Vhvq|O7WbPPf&Hf3x4t0iG{ra!UTVn%JLC1B}ne4uzHs0l0GrN)7 z70eMbOeRunn@jHP-Jx zTRNr!=hRn;`IRMcpRlPT&gOf|DK8cUV}W3*th5BQwRa?T!B9_)E*cZjJ>~}5RN((( z?0oO5(xyUBW5dQxJwAJ|45i6iV`tB?V5+ht?j|*LbbDU~+S)tN-Bjptgz=#!Z;hRe zvGlnVvhqbsCnmlSI=bPUx?;-Y2oATzZx)9trqblCv0ihTzF%(~IC=uZ-&7!PjYTsimG#zXMeYq{rXlXJ7mN)te* Date: Sat, 9 May 2020 11:23:04 -0500 Subject: [PATCH 104/137] Fixed Yharon phase 1 and 2 timed DR. Added Skeletron Head to the Boss Kill Time List. --- CalamityMod.cs | 5 +++-- NPCs/Yharon/Yharon.cs | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index b1dc9e1ef6..c87a761cdd 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2686,6 +2686,7 @@ namespace CalamityMod { NPCID.EaterofWorldsTail, 7200 }, { NPCID.BrainofCthulhu, 5400 }, { NPCID.QueenBee, 7200 }, + { NPCID.SkeletronHead, 9000 }, { NPCID.WallofFlesh, 10800 }, { NPCID.WallofFleshEye, 10800 }, { NPCID.Spazmatism, 10800 }, @@ -3403,7 +3404,7 @@ namespace CalamityMod #region Lighting const float MaxCaveDarkness = -0.3f; - const float MaxSignusDarkness = -0.5f; + const float MaxSignusDarkness = -0.4f; const float MaxAbyssDarkness = -0.7f; public override void ModifyLightingBrightness(ref float scale) { @@ -3671,6 +3672,6 @@ namespace CalamityMod AcidRainUIDrawFadeSync, AcidRainOldDukeSummonSync, GaelsGreatswordSwingSync, - SpawnSuperDummy, + SpawnSuperDummy } } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index e06c61640a..b079d4f534 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -216,6 +216,9 @@ namespace CalamityMod.NPCs.Yharon return; } + if (phaseOneLoot) + npc.Calamity().AITimer = 0; + // Don't drop phase 1 loot phaseOneLoot = false; @@ -225,6 +228,12 @@ namespace CalamityMod.NPCs.Yharon return; } + if (CalamityWorld.buffedEclipse) + { + if (npc.Calamity().AITimer < 3600) + npc.Calamity().AITimer = 3600; + } + // Phase bools bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.8 : 0.7); bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.5 : 0.4); From 0f09ece697d3f5d6f01fbe39cd3435b01dabebc8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 9 May 2020 20:46:59 -0400 Subject: [PATCH 105/137] fabsol's vodka now counts for alcohol poisoning --- CalPlayer/CalamityPlayerLifeRegen.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 0e224c85a1..558a5f6620 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -272,6 +272,10 @@ namespace CalamityMod.CalPlayer { modPlayer.alcoholPoisonLevel++; } + if (modPlayer.fabsolVodka) + { + modPlayer.alcoholPoisonLevel++; + } if (modPlayer.fireball) { modPlayer.alcoholPoisonLevel++; From 19f8c075e6fe51064f0c7aee06d117e27a5f5d59 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 9 May 2020 20:47:34 -0400 Subject: [PATCH 106/137] some projectile deletion protection --- CalPlayer/CalamityPlayer.cs | 124 +++++++++++++++++++----------------- CalamityMod.cs | 11 +++- 2 files changed, 75 insertions(+), 60 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 393102688e..5a3c6339ec 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5627,25 +5627,28 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - if (player.HeldItem.type == ModContent.ItemType() - && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) - { - for (int j = 0; j < 3; j++) - { - int dustIndex = Dust.NewDust(proj.position, proj.width, proj.height, 31, 0f, 0f, 0, default, 1f); - Main.dust[dustIndex].velocity *= 0.3f; - } - int damage2 = (int)(GaelsGreatsword.BaseDamage * Main.LocalPlayer.MeleeDamage()); - proj.hostile = false; - proj.friendly = true; - proj.velocity *= -1f; - proj.damage = damage2; - proj.penetrate = 1; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - damage = 0; - } + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + { + if (player.HeldItem.type == ModContent.ItemType() + && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) + { + for (int j = 0; j < 3; j++) + { + int dustIndex = Dust.NewDust(proj.position, proj.width, proj.height, 31, 0f, 0f, 0, default, 1f); + Main.dust[dustIndex].velocity *= 0.3f; + } + int damage2 = (int)(GaelsGreatsword.BaseDamage * Main.LocalPlayer.MeleeDamage()); + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -1f; + proj.damage = damage2; + proj.penetrate = 1; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + damage = 0; + } + } int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); if (CalamityWorld.bossRushActive) { @@ -5829,46 +5832,49 @@ namespace CalamityMod.CalPlayer //1 second for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } } - 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; - } + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + { + 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 diff --git a/CalamityMod.cs b/CalamityMod.cs index b1dc9e1ef6..3aebacc006 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -654,7 +654,16 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + + //Some hostile boss projectiles + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; projectileMinionList = new List() From c14a6fbf0d9e379586f9c111a63a68ba301632b3 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 9 May 2020 20:04:14 -0500 Subject: [PATCH 107/137] Sulph Sea blacklist -> whitelist and rare bug fix --- World/Abyss.cs | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/World/Abyss.cs b/World/Abyss.cs index d7f899eec2..e63c4a6171 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -714,7 +714,7 @@ namespace CalamityMod.World #endregion #region Generating Chests - public const int CheckCutoffDistance = 35; + public const int CheckCutoffDistance = 15; public static void PlaceRustyChests() { // Ambiguity bullshit. @@ -759,40 +759,45 @@ namespace CalamityMod.World #endregion #region Misc Functions - public static List YStartBlacklist = new List() + public static List YStartWhitelist = new List() { - TileID.Cloud, - TileID.RainCloud, - TileID.SnowCloud, - TileID.Sunplate, - TileID.Tables, - TileID.Chairs, - TileID.ClosedDoor, - TileID.OpenDoor, - TileID.Banners, - TileID.Crimtane, - TileID.Demonite, - TileID.Containers + TileID.Sand, + TileID.Ebonsand, + TileID.Crimsand, + TileID.Grass, + TileID.CorruptGrass, + TileID.FleshGrass, + TileID.ClayBlock, + TileID.Mud, + TileID.Copper, + TileID.Tin, + TileID.Iron, + TileID.Lead, + TileID.Silver, + TileID.Tungsten, + TileID.Crimstone, + TileID.Ebonstone, + TileID.JungleGrass // Yes, this can happen on rare occasion }; public static void DetermineYStart() { - int maxHeight = int.MaxValue; - for (int i = 0; i < 15; i++) + int maxHeight = 0; + for (int i = 0; i < BiomeWidth; i++) { int xCheck = CalamityWorld.abyssSide ? BiomeWidth - i : Main.maxTilesX - BiomeWidth + i; - int YStart = 1; - while (!Main.tile[xCheck, YStart].active() || YStartBlacklist.Contains(Main.tile[xCheck, YStart].type)) + int YStart = (int)WorldGen.worldSurfaceLow - 20; // 30 tiles below the absolute lowest a floating island can spawn + while (!Main.tile[xCheck, YStart].active() || !YStartWhitelist.Contains(Main.tile[xCheck, YStart].type) || + Main.tile[xCheck, YStart].type == TileID.LivingWood || Main.tile[xCheck, YStart].type == TileID.LeafBlock) { YStart++; if (YStart > Main.rockLayer - 40) break; } - if (maxHeight > YStart) - maxHeight = YStart; + maxHeight += YStart; } - YStart = maxHeight; + YStart = maxHeight / BiomeWidth; } public static void GrowSaplingImmediately(int i, int j) { From 5f9dcfd0141b9da842904573ae118eac11f9f8b5 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 9 May 2020 20:36:34 -0500 Subject: [PATCH 108/137] Gael's Greatsword flavor text fix --- Items/Weapons/Melee/GaelsGreatsword.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 70ad9a4f41..09d39e5921 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Gael's Greatsword"); - Tooltip.SetDefault("Give me that thing, your dark soul\n" + + Tooltip.SetDefault("Hand it over, that thing. Your dark soul.\n" + "First swing fires homing skulls\n" + "Second swing fires a giant, powerful skull\n" + "Third swing deals massive damage\n" + From c7773b5f73d668da7f889ec77c6be237d61ec666 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 9 May 2020 23:12:11 -0500 Subject: [PATCH 109/137] Death Mode blizzard shards fall slower. Cryogen is now in the center of his ice shield. SCal brimstone monsters spread apart slower. SCal gigablasts always collide with tiles. Yharon and SCal antibutcher protection reduced from 10% to 50%. Death Mode lightning telegraph collides with platforms. --- CalPlayer/CalamityPlayerMiscEffects.cs | 4 ++-- NPCs/Cryogen/Cryogen.cs | 7 ++---- NPCs/Cryogen/CryogenIce.cs | 8 +++---- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 8 +++---- NPCs/Yharon/Yharon.cs | 2 +- Projectiles/Boss/BrimstoneFireblast.cs | 7 +----- Projectiles/Boss/BrimstoneMonster.cs | 22 +++++++++--------- Projectiles/Boss/IceRain.cs | 28 +++++++++++++++++------ Projectiles/CalamityGlobalProjectile.cs | 4 ++-- Projectiles/Environment/LightningMark.cs | 6 +++++ 10 files changed, 54 insertions(+), 42 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5995089836..3482524556 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -280,7 +280,7 @@ namespace CalamityMod.CalPlayer } // If Revengeance Mode is not active, then set rippers to zero - else if(player.whoAmI == Main.myPlayer) + else if (player.whoAmI == Main.myPlayer) { modPlayer.rage = 0; modPlayer.adrenaline = 0; @@ -578,7 +578,7 @@ namespace CalamityMod.CalPlayer Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) - Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); } } else diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 0c95a6bc4c..830a1f5fed 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -167,12 +167,9 @@ namespace CalamityMod.NPCs.Cryogen npc.rotation = npc.velocity.X * 0.1f; } - if (!Main.raining && !CalamityWorld.bossRushActive) - { - CalamityUtils.StartRain(); - } + CalamityMod.StopRain(); - if (!player.active || player.dead) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 8064b30814..95e383fc06 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -37,12 +37,12 @@ namespace CalamityMod.NPCs.Cryogen public override void AI() { - npc.alpha -= 3; + npc.alpha -= 3; if (npc.alpha < 0) - { npc.alpha = 0; - } + npc.rotation += 0.15f; + if (npc.type == ModContent.NPCType()) { int num989 = (int)npc.ai[0]; @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.Cryogen 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; + npc.gfxOffY = Main.npc[num989].gfxOffY + 14; return; } npc.life = 0; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index c703b8ec88..13b1eed45c 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -610,7 +610,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } 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, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; if (bulletHellCounter > (enraged ? 9 : 11)) @@ -679,7 +679,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } 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, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 225 == 0) //giant homing fireballs { @@ -753,7 +753,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } 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, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern { @@ -2241,7 +2241,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index b079d4f534..83849aeff2 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -3072,7 +3072,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 (CalamityUtils.AntiButcher(npc, ref damage, 0.1f)) + if (CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) return false; // Safeguard to prevent damage which would allow skipping phase 2. diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 67e19569ed..245f83dfb9 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 50; projectile.hostile = true; projectile.ignoreWater = true; - projectile.tileCollide = false; projectile.penetrate = 1; projectile.alpha = 120; cooldownSlot = 1; @@ -29,10 +28,6 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = true; - } projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -48,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.Kill(); } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index b157c40f23..690c378bff 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -134,24 +134,24 @@ namespace CalamityMod.Projectiles.Boss } // Fly away from other brimstone monsters - float num1247 = 0.5f; - for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++) + float velocity = 0.1f; + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[num1248].active) + if (Main.projectile[i].active) { - if (num1248 != projectile.whoAmI && Main.projectile[num1248].type == projectile.type) + if (i != projectile.whoAmI && Main.projectile[i].type == projectile.type) { - if (Vector2.Distance(projectile.Center, Main.projectile[num1248].Center) < 320f) + if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) < 320f) { - if (projectile.position.X < Main.projectile[num1248].position.X) - projectile.velocity.X -= num1247; + if (projectile.position.X < Main.projectile[i].position.X) + projectile.velocity.X -= velocity; else - projectile.velocity.X += num1247; + projectile.velocity.X += velocity; - if (projectile.position.Y < Main.projectile[num1248].position.Y) - projectile.velocity.Y -= num1247; + if (projectile.position.Y < Main.projectile[i].position.Y) + projectile.velocity.Y -= velocity; else - projectile.velocity.Y += num1247; + projectile.velocity.Y += velocity; } } } diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 62a760667e..1d66e1582c 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using System.IO; using Terraria; using Terraria.ID; @@ -15,7 +16,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.aiStyle = 1; projectile.width = 12; projectile.height = 12; projectile.hostile = true; @@ -35,10 +35,25 @@ namespace CalamityMod.Projectiles.Boss 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.01f, 0.25f, 0.25f); - if (projectile.ai[0] == 0f) - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + if (projectile.ai[0] != 2f) + projectile.aiStyle = 1; + + if (projectile.ai[0] == 0f) + { + projectile.velocity.Y += 0.2f; + } + else if (projectile.ai[0] == 2f) + { + projectile.velocity.Y += 0.1f; + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + if (projectile.velocity.Y > 6f) + projectile.velocity.Y = 6f; + } + + if (projectile.localAI[0] == 0f) { projectile.scale += 0.01f; projectile.alpha -= 50; @@ -48,13 +63,13 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 0; } } - else if (projectile.localAI[0] == 1f) + else { projectile.scale -= 0.01f; projectile.alpha += 50; if (projectile.alpha >= 255) { - projectile.localAI[0] = 2f; + projectile.localAI[0] = 0f; projectile.alpha = 255; } } @@ -68,7 +83,6 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 27, 0.25f); - //Main.PlaySound(SoundID.Item27, projectile.position); for (int num373 = 0; num373 < 3; num373++) { int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default, 1f); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 089664b141..e1bb089af7 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1043,7 +1043,7 @@ namespace CalamityMod.Projectiles if (player.ghostHeal) { float num = 0.1f; - num -= projectile.numHits * 0.05f; + num -= projectile.numHits * 0.025f; if (num < 0f) num = 0f; @@ -1122,7 +1122,7 @@ namespace CalamityMod.Projectiles if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + Main.player[Main.myPlayer].lifeSteal -= heal * 6f; int healAmount = (int)heal; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index c1e4a22a78..b3971032e5 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -85,6 +85,12 @@ namespace CalamityMod.Projectiles.Environment projectile.velocity.Y = 16f; } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + public override bool OnTileCollide(Vector2 oldVelocity) { return false; From 04211bbaec3f72e07e21a28739d97942ab5e72a9 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 9 May 2020 23:13:40 -0500 Subject: [PATCH 110/137] Error fix + No rain during OD in Acid Rain --- CalPlayer/CalamityPlayer.cs | 4 ++-- World/CalamityWorld.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5a3c6339ec..795f954a4a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5627,7 +5627,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { if (player.HeldItem.type == ModContent.ItemType() && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) @@ -5832,7 +5832,7 @@ namespace CalamityMod.CalPlayer //1 second for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } } - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) { diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 5c5f53b36e..b2adc93dff 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -995,8 +995,8 @@ namespace CalamityMod.World // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - if (startAcidicDownpour || forcedDownpourWithTear) - { + if ((startAcidicDownpour || forcedDownpourWithTear) && !NPC.AnyNPCs(ModContent.NPCType())) + { Main.raining = true; Main.cloudBGActive = 1f; Main.numCloudsTemp = Main.cloudLimit; From b6945cfba97effef01e0b3ef9fa38e5f3d6deb34 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 12:14:15 -0400 Subject: [PATCH 111/137] nerfed several enemies in acid rain --- NPCs/AcidRain/AcidEel.cs | 14 +++++++------- NPCs/AcidRain/FlakCrab.cs | 2 +- NPCs/AcidRain/GammaSlime.cs | 6 +++--- NPCs/AcidRain/Orthocera.cs | 12 ++++++------ NPCs/AcidRain/Skyfin.cs | 18 +++++++++--------- NPCs/AcidRain/SulfurousSkater.cs | 6 +++--- NPCs/AcidRain/Trilobite.cs | 10 +++++----- NPCs/AcidRain/WaterLeech.cs | 4 ++-- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 247ed6da77..66346b56ad 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -32,9 +32,9 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.Calamity().DR = 0.3f; - npc.damage = 160; - npc.lifeMax = 6650; + npc.Calamity().DR = 0.05f; + npc.damage = 120; + npc.lifeMax = 5500; npc.defense = 45; } else if (CalamityWorld.downedAquaticScourge) @@ -89,10 +89,10 @@ namespace CalamityMod.NPCs.AcidRain float maxSpeedY = 4f; if (CalamityWorld.downedPolterghast) { - acceleration = 0.75f; - yAcceleration = 0.25f; - maxSpeedX = 24f; - maxSpeedY = 9f; + acceleration = 0.6f; + yAcceleration = 0.15f; + maxSpeedX = 20f; + maxSpeedY = 7f; } npc.velocity.X += npc.direction * acceleration; diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 48f35362f7..b3f1e7bc33 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.lifeMax = 7500; + npc.lifeMax = 7000; npc.Calamity().DR = 0.4f; } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 19e172e961..833669d63b 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -33,9 +33,9 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 40; npc.height = 44; - npc.damage = 145; - npc.lifeMax = 6410; - npc.Calamity().DR = 0.25f; + npc.damage = 130; + npc.lifeMax = 5915; + npc.Calamity().DR = 0.15f; npc.defense = 50; npc.aiStyle = aiType = -1; diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 0db1bfabe2..8a04270f18 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -33,8 +33,8 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 180; - npc.lifeMax = 5700; + npc.damage = 150; + npc.lifeMax = 4500; npc.defense = 65; npc.Calamity().DR = 0.35f; } @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.AcidRain { npc.TargetClosest(false); npc.ai[1] += 1f; - float maxSpeed = CalamityWorld.downedPolterghast ? 18f : 10.5f; + float maxSpeed = CalamityWorld.downedPolterghast ? 12.8f : 10.5f; if (npc.target >= 0 && npc.target < 255) { Player player = Main.player[npc.target]; @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.AcidRain // And jump/shoot else if (npc.ai[1] % 220f > 180f) { - float yAcceleration = CalamityWorld.downedPolterghast ? 0.11f : 0.05f; + float yAcceleration = CalamityWorld.downedPolterghast ? 0.07f : 0.05f; if (npc.ai[1] % 220f < 200f) { npc.velocity.Y -= yAcceleration; @@ -177,8 +177,8 @@ namespace CalamityMod.NPCs.AcidRain } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.damage = (int)(npc.damage * 1.2); - npc.lifeMax = (int)(npc.lifeMax * 1.3); + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 793d6a2ed9..4650804ed6 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -36,16 +36,16 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 175; - npc.lifeMax = 6300; + npc.damage = 150; + npc.lifeMax = 5001; npc.defense = 58; - npc.Calamity().DR = 0.2f; + npc.Calamity().DR = 0.05f; } else if (CalamityWorld.downedAquaticScourge) { npc.damage = 85; npc.lifeMax = 700; - npc.Calamity().DR = 0.1f; + npc.Calamity().DR = 0.05f; } npc.knockBackResist = 0f; @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.AcidRain } if ((Math.Abs(player.Center.Y - npc.Center.Y) > 50f && player.wet) || (!player.wet && npc.ai[1] <= 0f)) { - float speedY = CalamityWorld.downedPolterghast ? 15f : 6f; + float speedY = CalamityWorld.downedPolterghast ? 10f : 6f; npc.velocity.Y = (player.Center.Y - npc.Center.Y > 0).ToDirectionInt() * speedY; } if (Math.Abs(npc.velocity.X) < 6f) @@ -130,10 +130,10 @@ namespace CalamityMod.NPCs.AcidRain npc.velocity.X = npc.ai[2]; if (npc.ai[1] > TotalTime - DiveTime * 0.5f) { - float flySpeed = CalamityWorld.downedAquaticScourge ? 0.135f : 0.085f; + float flySpeed = CalamityWorld.downedAquaticScourge ? 0.115f : 0.085f; if (CalamityWorld.downedPolterghast) { - flySpeed = 0.185f; + flySpeed = 0.135f; } npc.velocity.Y -= flySpeed; } @@ -178,11 +178,11 @@ namespace CalamityMod.NPCs.AcidRain float chargeSpeed = 8f; if (CalamityWorld.downedAquaticScourge) { - chargeSpeed = 17f; + chargeSpeed = 14f; } if (CalamityWorld.downedPolterghast) { - chargeSpeed = 24f; + chargeSpeed = 18f; } npc.velocity = npc.DirectionTo(player.Center) * chargeSpeed; } diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 9a175d47ef..9cb07eee5e 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -44,8 +44,8 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 140; - npc.lifeMax = 6600; + npc.damage = 100; + npc.lifeMax = 5000; npc.defense = 33; npc.Calamity().DR = 0.15f; } @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.AcidRain else { npc.Calamity().DR = 0f; - float speed = CalamityWorld.downedPolterghast ? 22f : 17f; + float speed = CalamityWorld.downedPolterghast ? 17f : 14f; float inertia = CalamityWorld.downedPolterghast ? 20f : 24.5f; if (npc.Distance(player.Center) < 200f) inertia *= 0.667f; diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 573623b37d..37695cb068 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 160; - npc.lifeMax = 7200; + npc.damage = 120; + npc.lifeMax = 4900; npc.defense = 78; npc.Calamity().DR = 0.4f; } @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs.AcidRain float speed = 15f; if (CalamityWorld.downedPolterghast) { - speed = 28.5f; + speed = 18.5f; } npc.velocity = npc.DirectionTo(player.Center) * speed; @@ -116,8 +116,8 @@ namespace CalamityMod.NPCs.AcidRain float speedY = 9f; if (CalamityWorld.downedPolterghast) { - speedX = 27f; - speedY = 25f; + speedX = 22f; + speedY = 11f; } npc.velocity = npc.DirectionTo(player.Center) * new Vector2(speedX, speedY); npc.netUpdate = true; diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index 343b5928d2..d9447e9b28 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -31,13 +31,13 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 172; + npc.damage = 120; npc.lifeMax = 4000; npc.defense = 30; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 100; + npc.damage = 80; npc.lifeMax = 320; } From 026a62daaf5aea125315aec293e02871bab261d1 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sun, 10 May 2020 12:46:50 -0500 Subject: [PATCH 112/137] Oarfish head fix --- NPCs/Abyss/OarfishHead.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index a1f6314730..892b749993 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -27,8 +27,8 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { npc.damage = 30; - npc.width = 16; //36 - npc.height = 16; //20 + npc.width = 59; //36 + npc.height = 38; //20 npc.defense = 10; npc.lifeMax = 2000; npc.aiStyle = -1; From a3c11ac5aabbc39fc2728515146bb7a0b4bc368a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 14:16:02 -0400 Subject: [PATCH 113/137] only one eidolist can spawn at a time --- NPCs/NormalNPCs/Eidolist.cs | 96 ++++++++++++++----------------------- 1 file changed, 35 insertions(+), 61 deletions(-) diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index de6d14ce7a..014d2d13dd 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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); + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); if (npc.justHit) { hasBeenHit = true; @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.localAI[2] = 1f; } } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + npc.velocity.X += npc.direction * 0.1f; if (npc.velocity.X < -2f || npc.velocity.X > 2f) { npc.velocity.X = npc.velocity.X * 0.95f; @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (npc.localAI[2] == -1f) { npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + if (npc.velocity.Y < -0.3f) { npc.localAI[2] = 1f; } @@ -108,27 +108,26 @@ namespace CalamityMod.NPCs.NormalNPCs else { npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + if (npc.velocity.Y > 0.3f) { npc.localAI[2] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; } return; } npc.noTileCollide = true; float num1446 = 7f; - int num1447 = 480; - float num244; + float num1447 = 480f; if (npc.localAI[1] == 1f) { npc.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = (float)num1447; + npc.ai[0] = num1447; } } npc.TargetClosest(true); @@ -144,22 +143,18 @@ namespace CalamityMod.NPCs.NormalNPCs 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) + Vector2 vector = new Vector2(npc.Center.X, npc.Center.Y); + float xDist = Main.player[npc.target].Center.X - vector.X + Main.rand.NextFloat(-10f, 10f); + float yDist = Main.player[npc.target].Center.Y - vector.Y + Main.rand.NextFloat(-10f, 10f); + Vector2 targetVec = new Vector2(yDist, yDist); + float targetDist = targetVec.Length(); + targetDist = speed / targetDist; + targetVec.X *= targetDist; + targetVec.Y *= targetDist; + int damage = Main.expertMode ? 30 : 40; + if (Main.rand.NextBool(2)) { - 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); + Projectile.NewProjectile(npc.Center, targetVec, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); } else { @@ -172,7 +167,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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); + Projectile.NewProjectile(npc.Center, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); } } } @@ -195,36 +190,30 @@ namespace CalamityMod.NPCs.NormalNPCs 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) + for (int num1449 = 0; num1449 < 20; num1449++) { 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; + dust.noGravity = true; + dust.scale = 2.5f; } 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) + for (int num1451 = 0; num1451 < 20; num1451++) { 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; + dust.noGravity = true; + dust.scale = 2.5f; } } - 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] += 1f; + if (npc.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[0] = 0f; Point point12 = npc.Center.ToTileCoordinates(); @@ -286,7 +275,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (!Main.hardMode) + if (!Main.hardMode || NPC.AnyNPCs(ModContent.NPCType())) { return 0f; } @@ -314,30 +303,15 @@ namespace CalamityMod.NPCs.NormalNPCs 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, ModContent.ItemType()); - } - } if (Main.rand.NextBool(10)) { - 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); + DropHelper.DropItem(npc, ItemID.BlueLunaticHood); + DropHelper.DropItem(npc, ItemID.BlueLunaticRobe); } - if (CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), 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, ModContent.ItemType(), 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)); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !NPC.LunarApocalypseIsUp, 0.25f); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, 8, 10); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 2, 4); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1f, 3, 5); } } } From 10ac2cd847c23bdadb3772bda33de038514fc5ae Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 14:16:20 -0400 Subject: [PATCH 114/137] added an riv drophelper method --- NPCs/Abyss/Reaper.cs | 8 +------- NPCs/CalamityGlobalNPCLoot.cs | 29 ++++------------------------- NPCs/CeaselessVoid/CeaselessVoid.cs | 8 +------- NPCs/NormalNPCs/Cnidrion.cs | 16 +++++----------- NPCs/Signus/Signus.cs | 8 +------- Utilities/DropHelper.cs | 19 +++++++++++++++++++ 6 files changed, 31 insertions(+), 57 deletions(-) diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index ab184e4e51..3e59dba172 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -675,13 +675,7 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); if (CalamityWorld.downedPolterghast) { - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= 0.01f; // 1/100 chance overall of getting The Reaper - if (f <= 0.3333f) // 1/3 chance of getting Valediction OR The Reaper replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !replaceWithRare); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), replaceWithRare); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.3333f, 0.01f); } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index e4b11e3824..06a6652cd5 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1414,14 +1414,7 @@ namespace CalamityMod.NPCs break; case NPCID.GiantTortoise: - float tortoiseDropRate = Main.expertMode ? 0.2f : 0.142857f; - float shellRoll = Main.rand.NextFloat(); - bool fabledShell = shellRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty - if (shellRoll < tortoiseDropRate) // 1/7 (1/5 EX) chance of getting Giant Tortoise Shell OR Fabled Tortoise Shell replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !fabledShell); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), fabledShell); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.2f : 0.142857f, 0.005f); break; case NPCID.GiantShelly: @@ -1477,18 +1470,11 @@ namespace CalamityMod.NPCs break; case NPCID.IchorSticker: - float spearDropRate = Main.expertMode ? 0.05f : 0.04f; - float spearRoll = Main.rand.NextFloat(); - bool spearOfDestiny = spearRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty - if (spearRoll < spearDropRate) // 1/25 (1/20 EX) chance of getting Ichor Spear OR Spear of Destiny replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !spearOfDestiny); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), spearOfDestiny); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.05f : 0.04f, 0.005f); break; case NPCID.Harpy: - int glazeDropRate = CalamityWorld.defiled ? 20 : Main.expertMode ? 60 : 80; + int glazeDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 60 : 80; DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss1, glazeDropRate, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode && !npc.SpawnedFromStatue, Main.expertMode ? 2 : 3, 1, 1); break; @@ -1536,14 +1522,7 @@ namespace CalamityMod.NPCs break; case NPCID.PirateCrossbower: - float crossbowDropRate = Main.expertMode ? 0.05f : 0.04f; - float arbalestRoll = Main.rand.NextFloat(); - bool arbalest = arbalestRoll <= 0.005f; // Exact 1/200 chance for rare regardless of difficulty - if (arbalestRoll < crossbowDropRate) // 1/25 (1/20 EX) chance of getting Raider's Glory OR Arbalest replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !arbalest); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), arbalest); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.05f : 0.04f, 0.005f); break; case NPCID.GoblinSummoner: diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 6fda92343c..470e72f160 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -139,13 +139,7 @@ namespace CalamityMod.NPCs.CeaselessVoid DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); // Equipment - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting The Evolution - if (f < 0.2f) // 1/5 chance of getting Arcanum of the Void OR The Evolution replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !replaceWithRare); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), replaceWithRare); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.2f, DropHelper.RareVariantDropRateFloat); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index aee58dc0e3..d49b9e1c89 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -295,17 +295,11 @@ namespace CalamityMod.NPCs.NormalNPCs 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, ModContent.ItemType(), 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, ModContent.ItemType()); - else - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ItemID.Coral, 1, 3); + DropHelper.DropItem(npc, ItemID.Starfish, 1, 3); + DropHelper.DropItem(npc, ItemID.Seashell, 1, 3); + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.25f, 0.01f); } } } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index c162a24ea9..7df77f7d7a 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -769,13 +769,7 @@ namespace CalamityMod.NPCs.Signus // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= DropHelper.RareVariantDropRateFloat; // 1/40 chance overall of getting Guidelight of Oblivion - if (f <= (Main.expertMode ? 0.3333f : 0.25f)) // 1/3 (1/4 in normal) chance of getting Cosmilamp OR Guidelight of Oblivion replacing it - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !replaceWithRare); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), replaceWithRare); - } + DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.3333f : 0.25f, DropHelper.RareVariantDropRateFloat); //Equipment DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, 4, 1, 1); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 2a80c9ee6c..f23c02ac3f 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -231,6 +231,25 @@ namespace CalamityMod return dropped; } + + /// + /// Drops an item that can be replaced by a given RIV + /// + /// The NPC which should drop the item(s). + /// The ID of the normal item to drop. + /// The ID of the RIV to drop. + /// The chance that one of the two will drop. A decimal number <= 1.0. + /// The chance that the RIV will drop. A decimal number <= 1.0. + public static void DropItemRIV(NPC npc, int itemID, int rareID, float itemChance, float rareChance) + { + float f = Main.rand.NextFloat(); + bool replaceWithRare = f <= rareChance; // 1/X chance overall of getting RIV + if (f <= itemChance) // 1/X chance of getting original OR the RIV replacing it + { + DropItemCondition(npc, itemID, !replaceWithRare); + DropItemCondition(npc, rareID, replaceWithRare); + } + } #endregion #region NPC Item Drops 100% Chance From 962fa9dad9d12c41897379f185605ba996658889 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 14:39:44 -0400 Subject: [PATCH 115/137] added riv drophelper for treasure bags --- Items/TreasureBags/AstrumDeusBag.cs | 5 +---- Items/TreasureBags/DesertScourgeBag.cs | 8 +------- Utilities/DropHelper.cs | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 3e9f3440f4..67c8777c76 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -57,10 +57,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 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, ModContent.ItemType(), !replaceWithRare); - DropHelper.DropItemCondition(player, ModContent.ItemType(), replaceWithRare); + DropHelper.DropItemRIV(player, ModContent.ItemType(), ModContent.ItemType(), 1f, DropHelper.RareVariantDropRateFloat); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index 28c0e48905..d832044afa 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -51,13 +51,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 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, ModContent.ItemType(), !replaceWithRare); - DropHelper.DropItemCondition(player, ModContent.ItemType(), replaceWithRare); - } + DropHelper.DropItemRIV(player, ModContent.ItemType(), ModContent.ItemType(), 0.3333f, DropHelper.RareVariantDropRateFloat); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index f23c02ac3f..25a57252cc 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -235,7 +235,7 @@ namespace CalamityMod /// /// Drops an item that can be replaced by a given RIV /// - /// The NPC which should drop the item(s). + /// The NPC which should drop the item. /// The ID of the normal item to drop. /// The ID of the RIV to drop. /// The chance that one of the two will drop. A decimal number <= 1.0. @@ -250,6 +250,25 @@ namespace CalamityMod DropItemCondition(npc, rareID, replaceWithRare); } } + + /// + /// Drops an item that can be replaced by a given RIV + /// + /// The player which should receive the item. + /// The ID of the normal item to drop. + /// The ID of the RIV to drop. + /// The chance that one of the two will drop. A decimal number <= 1.0. + /// The chance that the RIV will drop. A decimal number <= 1.0. + public static void DropItemRIV(Player player, int itemID, int rareID, float itemChance, float rareChance) + { + float f = Main.rand.NextFloat(); + bool replaceWithRare = f <= rareChance; // 1/X chance overall of getting RIV + if (f <= itemChance) // 1/X chance of getting original OR the RIV replacing it + { + DropItemCondition(player, itemID, !replaceWithRare); + DropItemCondition(player, rareID, replaceWithRare); + } + } #endregion #region NPC Item Drops 100% Chance From 3ec6f619afd062ba016fc484e42686fe2437f81a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 14:42:52 -0400 Subject: [PATCH 116/137] fixes to spear of destiny and astral solution --- Items/Ammo/AstralSolution.cs | 3 ++- Items/Weapons/Rogue/SpearofDestiny.cs | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index 22601bac44..fd66b17ec2 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Solution"); - Tooltip.SetDefault("Used by the Clentaminator.\nSpreads the Astral."); + Tooltip.SetDefault("Used by the Clentaminator\n" + + "Spreads the Astral Infection"); } public override void SetDefaults() diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index dff97777b8..59978ead10 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -37,12 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue 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(3); - for (int i = 0; i < numProj + 1; i++) + int index = 7; + for (int i = -index; i <= index; i += index) { - 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 : ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, i != 0 ? type : ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); } return false; } From 7ce69bbe434d1ff336bbef131b6e3e39b1dd8ea4 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 10 May 2020 14:58:41 -0500 Subject: [PATCH 117/137] Fixed errors in CalamityPlayer someone else made. Added Death Mode weather projectile frequency config. --- CalPlayer/CalamityPlayer.cs | 4 ++-- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Configs.cs | 8 ++++++++ Projectiles/Boss/IceRain.cs | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5a3c6339ec..795f954a4a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5627,7 +5627,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { if (player.HeldItem.type == ModContent.ItemType() && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) @@ -5832,7 +5832,7 @@ namespace CalamityMod.CalPlayer //1 second for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } } - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3482524556..12508aa88a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -564,7 +564,7 @@ namespace CalamityMod.CalPlayer if (Main.raining) { - float frequencyMult = 1f - Main.cloudAlpha; // 1 to 0.11 + float frequencyMult = (1f - Main.cloudAlpha) * CalamityMod.CalamityConfig.WeatherEffectRateMultiplier; // 3 to 0.055 Vector2 spawnPoint = new Vector2(player.Center.X + (float)Main.rand.Next(-1000, 1001), player.Center.Y - (float)Main.rand.Next(700, 801)); Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); diff --git a/Configs.cs b/Configs.cs index f24a56915c..d45ffccf1e 100644 --- a/Configs.cs +++ b/Configs.cs @@ -163,6 +163,14 @@ namespace CalamityMod [Tooltip("Buffs the health of Thorium bosses if Revengeance or Death is enabled")] public bool RevengeanceAndDeathThoriumBossBuff { get; set; } + [Header("Death Mode Changes")] + + [DefaultValue(1f)] + [Range(0.5f, 3f)] + [Label("Weather Effect Rate Multiplier")] + [Tooltip("Affects all Death Mode weather projectiles, increase to decrease the amount of projectiles, decrease to increase the amount of projectiles")] + public float WeatherEffectRateMultiplier { get; set; } + [Header("Boss Rush Curses")] [DefaultValue(false)] diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 1d66e1582c..86e93a70ad 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss 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.01f, 0.25f, 0.25f); + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); if (projectile.ai[0] != 2f) projectile.aiStyle = 1; From ac983a67089792323437141584e47fa554d96586 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 10 May 2020 14:59:39 -0500 Subject: [PATCH 118/137] Version bump. --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index ac65ff47ea..b61b3f685b 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 1.4.4.003 +version = 1.4.4.004 displayName = Calamity Mod (No Calamity Music) homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes From 1dca5998b542e8bd916f0fa19df5ca49bcb7e9c4 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 16:30:04 -0400 Subject: [PATCH 119/137] fixed plague jets not teleporting to the player --- Projectiles/Summon/TacticalPlagueEngineSummon.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.cs b/Projectiles/Summon/TacticalPlagueEngineSummon.cs index 62822d0f47..6c9cefda9f 100644 --- a/Projectiles/Summon/TacticalPlagueEngineSummon.cs +++ b/Projectiles/Summon/TacticalPlagueEngineSummon.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon public static Item FalseGun = null; public override void SetStaticDefaults() { - DisplayName.SetDefault("Tactical Plague Engine"); + DisplayName.SetDefault("Tactical Plague Jet"); Main.projFrames[projectile.type] = 3; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -128,6 +128,12 @@ namespace CalamityMod.Projectiles.Summon projectile.spriteDirection = -1; } projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); + + if (distanceVector.Length() > 2700f) + { + projectile.Center = player.Center; + projectile.netUpdate = true; + } } else { From 7a87340a532ba5f69e078799a6de0d886d4a9501 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 16:31:43 -0400 Subject: [PATCH 120/137] cleaned up cosmic viper code --- Projectiles/Summon/CosmicViperSummon.cs | 177 ++++++++++++------------ 1 file changed, 85 insertions(+), 92 deletions(-) diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 195d4927db..e6349ef837 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -43,16 +43,16 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; 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)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + int dusty = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].velocity = vector7; } projectile.localAI[0] += 1f; } @@ -75,9 +75,9 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -92,131 +92,127 @@ namespace CalamityMod.Projectiles.Summon float colorScale = (float)projectile.alpha / 255f; Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) + float antiStickyFloat = 0.05f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - 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) + Projectile proj = Main.projectile[index]; + bool flag23 = proj.type == ModContent.ProjectileType(); + if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) { - if (projectile.position.X < Main.projectile[num638].position.X) + if (projectile.position.X < proj.position.X) { - projectile.velocity.X = projectile.velocity.X - num637; + projectile.velocity.X -= antiStickyFloat; } else { - projectile.velocity.X = projectile.velocity.X + num637; + projectile.velocity.X += antiStickyFloat; } - if (projectile.position.Y < Main.projectile[num638].position.Y) + if (projectile.position.Y < proj.position.Y) { - projectile.velocity.Y = projectile.velocity.Y - num637; + projectile.velocity.Y -= antiStickyFloat; } else { - projectile.velocity.Y = projectile.velocity.Y + num637; + projectile.velocity.Y += antiStickyFloat; } } } - float num633 = 700f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - Vector2 vector46 = projectile.position; - bool flag25 = false; + float detectRange = 700f; + Vector2 targetVec = projectile.position; + bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < detectRange) { - num633 = num646; - vector46 = npc.Center; - flag25 = true; + detectRange = num646; + targetVec = npc.Center; + foundTarget = true; } } } else { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < detectRange) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + detectRange = targetDist; + targetVec = npc.Center; + foundTarget = true; } } } } - float num647 = num634; - if (flag25) + float returnDist = 1300f; + if (foundTarget) { - num647 = num635; + returnDist = 2600f; } - if (Vector2.Distance(player.Center, projectile.Center) > num647) + if (Vector2.Distance(player.Center, projectile.Center) > returnDist) { projectile.ai[0] = 1f; projectile.netUpdate = true; } - if (flag25 && projectile.ai[0] == 0f) + if (foundTarget && projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 targetVector = targetVec - projectile.Center; + float targetDist = targetVector.Length(); + targetVector.Normalize(); + float speedMult = 18f; //12 + if (targetDist > 200f) { - float scaleFactor2 = 18f; //12 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + targetVector *= speedMult; + projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; } else { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + targetVector *= -(speedMult / 2); + projectile.velocity = (projectile.velocity * 40f + targetVector) / 41f; } } else { - bool flag26 = false; - if (!flag26) + float safeDist = 600f; + bool returnToPlayer = false; + if (!returnToPlayer) { - flag26 = projectile.ai[0] == 1f; + returnToPlayer = projectile.ai[0] == 1f; } - float num650 = 12f; - if (flag26) + float velocityMult = 12f; + if (returnToPlayer) { - num650 = 30f; + velocityMult = 30f; } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -120f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && velocityMult < 16f) { - num650 = 16f; + velocityMult = 16f; } - if (num651 < num636 && flag26) + if (playerDist < safeDist && returnToPlayer) { projectile.ai[0] = 0f; projectile.netUpdate = true; } - if (num651 > 2000f) + if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.Center = player.Center; projectile.netUpdate = true; } - if (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + playerVec.Normalize(); + playerVec *= velocityMult; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { @@ -224,24 +220,24 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity.Y = -0.05f; } } - if (flag25) + if (foundTarget) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + MathHelper.Pi; + projectile.rotation = (targetVec - projectile.Center).ToRotation() + MathHelper.Pi; } else { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; - for (int num369 = 0; num369 < 1; num369++) + for (int index = 0; index < 1; index++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num370 = projectile.velocity.X / 3f * (float)num369; - float num371 = projectile.velocity.Y / 3f * (float)num369; + float num370 = projectile.velocity.X / 3f * (float)index; + float num371 = projectile.velocity.Y / 3f * (float)index; int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[num372].position.X = projectile.Center.X - num370; - Main.dust[num372].position.Y = projectile.Center.Y - num371; Dust dust = Main.dust[num372]; + dust.position.X = projectile.Center.X - num370; + dust.position.Y = projectile.Center.Y - num371; dust.velocity *= 0f; - Main.dust[num372].scale = 0.5f; + dust.scale = 0.5f; } } if (projectile.ai[1] > 0f) @@ -255,8 +251,8 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - float scaleFactor3 = 6f; - if (flag25 && projectile.ai[1] == 0f) + float speedMult = 6f; + if (foundTarget && projectile.ai[1] == 0f) { //play cool sound Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); @@ -281,25 +277,22 @@ namespace CalamityMod.Projectiles.Summon dmgMult = 1.5f; } - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; + Vector2 velocity = targetVec - projectile.Center; + velocity.Normalize(); + velocity *= speedMult; //add some inaccuracy - value19.Y += Main.rand.Next(-30, 31) * 0.05f; - value19.X += Main.rand.Next(-30, 31) * 0.05f; + velocity.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; + velocity.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; - int missile = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, projType, (int)(projectile.damage * dmgMult), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, projType, (int)(projectile.damage * dmgMult), projectile.knockBack, projectile.owner, 0f, 0f); projectile.netUpdate = true; } } } } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -310,7 +303,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); return false; } } From 9b479c0033f6ac9eb6cb403611fec51162b674db Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 16:32:37 -0400 Subject: [PATCH 121/137] fixes --- Projectiles/Summon/CosmicViperSummon.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index e6349ef837..54747653c6 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon float antiStickyFloat = 0.05f; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { - Projectile proj = Main.projectile[index]; + Projectile proj = Main.projectile[projIndex]; bool flag23 = proj.type == ModContent.ProjectileType(); if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) { @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon float targetDist = Vector2.Distance(npc.Center, projectile.Center); if (!foundTarget && targetDist < detectRange) { - detectRange = num646; + detectRange = targetDist; targetVec = npc.Center; foundTarget = true; } From 18e94637508f466fbafd7bd7c4c8b45a2d7cf5f0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 10 May 2020 20:41:55 -0400 Subject: [PATCH 122/137] removed minion kb from ele quiver --- Items/Accessories/ElementalQuiver.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 23b26e354e..f1a4cff40a 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Elemental Quiver"); 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\n" + + "10% increased ranged damage, 5% increased ranged critical strike chance, and 20% reduced ammo usage\n" + + "5 increased defense, 2 increased life regen, and 15% increased pick speed\n" + "Greatly increases arrow speed and grants a 20% chance to not consume arrows"); } @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Accessories player.lifeRegen += 2; player.statDefense += 5; player.pickSpeed -= 0.15f; - player.minionKB += 0.5f; } public override void AddRecipes() From 71e1a28fcac63237a0489313da1a470ce8d78561 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 08:55:39 -0400 Subject: [PATCH 123/137] acid rain and brimmy dr made rev only --- NPCs/AcidRain/AcidEel.cs | 2 +- NPCs/AcidRain/CragmawMire.cs | 2 +- NPCs/AcidRain/FlakCrab.cs | 2 +- NPCs/AcidRain/GammaSlime.cs | 2 +- NPCs/AcidRain/NuclearTerror.cs | 2 +- NPCs/AcidRain/Orthocera.cs | 4 ++-- NPCs/AcidRain/Skyfin.cs | 4 ++-- NPCs/AcidRain/SulfurousSkater.cs | 2 +- NPCs/AcidRain/Trilobite.cs | 4 ++-- NPCs/BrimstoneElemental/Brimling.cs | 15 ++++++--------- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 2 +- 11 files changed, 19 insertions(+), 22 deletions(-) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 66346b56ad..e62f67678b 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.Calamity().DR = 0.05f; + npc.Calamity().RevPlusDR(0.05f); npc.damage = 120; npc.lifeMax = 5500; npc.defense = 45; diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 9d0382d847..2997931d62 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP1Gore3"), npc.scale); npc.localAI[0] = 1f; } - npc.Calamity().DR = 0.125f; + npc.Calamity().DR = CalamityWorld.revenge ? 0.125f : 0f; npc.HitSound = SoundID.NPCHit1; if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index b3f1e7bc33..ada6f36eaa 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { npc.lifeMax = 7000; - npc.Calamity().DR = 0.4f; + npc.Calamity().RevPlusDR(0.4f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 833669d63b..229328a357 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 130; npc.lifeMax = 5915; - npc.Calamity().DR = 0.15f; + npc.Calamity().RevPlusDR(0.15f); npc.defense = 50; npc.aiStyle = aiType = -1; diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 3c7bb273d1..2b1074f059 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.AcidRain { npc.buffImmune[k] = true; } - npc.Calamity().DR = 0.4f; + npc.Calamity().RevPlusDR(0.4f); npc.lavaImmune = false; npc.noGravity = false; npc.noTileCollide = false; diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 8a04270f18..6dce668b5a 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 75; npc.lifeMax = 605; npc.defense = 15; - npc.Calamity().DR = 0.075f; + npc.Calamity().RevPlusDR(0.075f); if (CalamityWorld.downedPolterghast) { npc.damage = 150; npc.lifeMax = 4500; npc.defense = 65; - npc.Calamity().DR = 0.35f; + npc.Calamity().RevPlusDR(0.35f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 4650804ed6..946524a1b0 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -39,13 +39,13 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 150; npc.lifeMax = 5001; npc.defense = 58; - npc.Calamity().DR = 0.05f; + npc.Calamity().RevPlusDR(0.05f); } else if (CalamityWorld.downedAquaticScourge) { npc.damage = 85; npc.lifeMax = 700; - npc.Calamity().DR = 0.05f; + npc.Calamity().RevPlusDR(0.05f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 9cb07eee5e..28ec6472ca 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 100; npc.lifeMax = 5000; npc.defense = 33; - npc.Calamity().DR = 0.15f; + npc.Calamity().RevPlusDR(0.15f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 37695cb068..7c863b848b 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -34,14 +34,14 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 66; npc.lifeMax = 850; npc.defense = 15; - npc.Calamity().DR = 0.25f; + npc.Calamity().RevPlusDR(0.25f); if (CalamityWorld.downedPolterghast) { npc.damage = 120; npc.lifeMax = 4900; npc.defense = 78; - npc.Calamity().DR = 0.4f; + npc.Calamity().RevPlusDR(0.4f); } npc.knockBackResist = 0f; diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index a68b3c5f5d..2502207e39 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.width = 60; npc.height = 60; npc.defense = 0; - npc.Calamity().DR = normalDR; + npc.Calamity().RevPlusDR(normalDR); npc.lifeMax = 4000; npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental } // Set DR based on boost status - npc.Calamity().DR = boostDR ? boostedDR : normalDR; + npc.Calamity().DR = boostDR ? boostedDR : CalamityWorld.revenge ? normalDR : 0f; float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); int num1447 = 480; @@ -163,20 +163,20 @@ namespace CalamityMod.NPCs.BrimstoneElemental 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) + for (int num1449 = 0; num1449 < 20; num1449++) { 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; + if (npc.localAI[0] > 240f) //Lower firing cooldown to prevent firing so quickly after a teleport + npc.localAI[0] = 240f; Main.PlaySound(SoundID.Item8, npc.Center); for (int num1451 = 0; num1451 < 20; num1451 = num + 1) { @@ -188,10 +188,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental 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; + npc.ai[0] += 1f; if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) { if (npc.localAI[0] > 260f) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index e4c7ab42f8..98e46862e9 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.defense = 15; npc.value = Item.buyPrice(0, 12, 0, 0); npc.LifeMaxNERB(30000, 41000, 6500000); - npc.Calamity().DR = 0.15f; + npc.Calamity().RevPlusDR(0.15f); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { npc.damage *= 3; From b31c42cda1f6081c951cfe14f67c56b14fd4f2b5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 09:01:56 -0400 Subject: [PATCH 124/137] 2 more patron names --- NPCs/BrimstoneElemental/Brimling.cs | 4 +--- NPCs/CalamityGlobalNPC.cs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 2502207e39..494d44fe18 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -112,7 +112,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); int num1447 = 480; - float num244; if (npc.localAI[1] == 1f) { npc.localAI[1] = 0f; @@ -178,14 +177,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental if (npc.localAI[0] > 240f) //Lower firing cooldown to prevent firing so quickly after a teleport npc.localAI[0] = 240f; Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + for (int num1451 = 0; num1451 < 20; num1451++) { 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; } } npc.ai[0] += 1f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 5552a33bd1..7dc7cde80d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2374,7 +2374,7 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Guide: - switch (Main.rand.Next(37)) // 34 guide names + switch (Main.rand.Next(38)) // 34 guide names { case 0: npc.GivenName = "Lapp"; @@ -2388,6 +2388,10 @@ namespace CalamityMod.NPCs npc.GivenName = "StreakistYT"; break; + case 3: + npc.GivenName = "Neoplasmatic"; + break; + default: break; } @@ -2395,7 +2399,7 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - switch (Main.rand.Next(25)) // 23 wizard names + switch (Main.rand.Next(26)) // 23 wizard names { case 0: npc.GivenName = "Mage One-Trick"; @@ -2405,6 +2409,10 @@ namespace CalamityMod.NPCs npc.GivenName = "Inorim, son of Ivukey"; break; + case 2: + npc.GivenName = "Jensen"; + break; + default: break; } From c4593f6ff4703c4b27817789cde38717f6084c83 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 10:48:10 -0400 Subject: [PATCH 125/137] Twinkler now properly spawns from Firefly statues --- NPCs/Astral/Twinkler.cs | 48 +++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index d692d17d41..09706f7935 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -32,16 +32,9 @@ namespace CalamityMod.NPCs.Astral //bannerItem = ModContent.ItemType(); } + public override bool? CanBeHitByItem(Player player, Item item) => 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) => true; public override void HitEffect(int hitDirection, double damage) { @@ -86,7 +79,31 @@ namespace CalamityMod.NPCs.Astral } } - ///
I don't think this works btw. Copying from ExampleCritter.cs failed me ~Ben =( + public override bool Autoload(ref string name) + { + IL.Terraria.Wiring.HitWireSingle += HookStatue; + return base.Autoload(ref name); + } + + /// + /// Change the following code sequence in Wiring.HitWireSingle + /// num8 = (int) Utils.SelectRandom(Main.rand, new short[2] + /// { + /// 355, + /// 358 + /// }); + /// + /// to + /// + /// var arr = new short[2] + /// { + /// 355, + /// 358 + /// }); + /// arr = arr.ToList().Add(id).ToArray(); + /// num8 = Utils.SelectRandom(Main.rand, arr); + /// + /// /// private void HookStatue(ILContext il) { @@ -123,14 +140,9 @@ namespace CalamityMod.NPCs.Astral ; } - // not enough switch instructions - if (targets.Length < 54 - offset) - { - continue; - } - - var target = targets[54 - offset]; - if (target == null) + // get the label for case 54: if it exists + int case54Index = 54 - offset; + if (case54Index < 0 || case54Index >= targets.Length || !(targets[case54Index] is ILLabel target)) { continue; } From 31d7c3a4cad77fa3460029464970d678e7318afb Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 11:24:52 -0400 Subject: [PATCH 126/137] buffed time bolt knockback and detect range --- Items/Weapons/Rogue/TimeBolt.cs | 2 +- Projectiles/Rogue/TimeBoltKnife.cs | 68 ++++++++++++++---------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 616e0932df..51e85b6ee3 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 20; item.useStyle = 1; item.useTime = 20; - item.knockBack = 2f; + item.knockBack = 4f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(1, 40, 0, 0); diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 1b2560fb26..434a30df09 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -79,31 +79,31 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.Next(6) != 0) dust2.noGravity = true; } - float num773 = 0.01f; - int num774 = 5; - int num775 = num774 * 15; - int num776 = 0; + float scalar = 0.01f; + int alphaAmt = 5; + int alphaCeiling = alphaAmt * 15; + int alphaFloor = 0; if (projectile.localAI[0] > 7f) { if (projectile.localAI[1] == 0f) { - projectile.scale -= num773; + projectile.scale -= scalar; - projectile.alpha += num774; - if (projectile.alpha > num775) + projectile.alpha += alphaAmt; + if (projectile.alpha > alphaCeiling) { - projectile.alpha = num775; + projectile.alpha = alphaCeiling; projectile.localAI[1] = 1f; } } else if (projectile.localAI[1] == 1f) { - projectile.scale += num773; + projectile.scale += scalar; - projectile.alpha -= num774; - if (projectile.alpha <= num776) + projectile.alpha -= alphaAmt; + if (projectile.alpha <= alphaFloor) { - projectile.alpha = num776; + projectile.alpha = alphaFloor; projectile.localAI[1] = 0f; } } @@ -127,32 +127,29 @@ namespace CalamityMod.Projectiles.Rogue } int whoAmI = -1; - Vector2 value19 = projectile.Center; - float num778 = 300f; - int j; - for (int i = 0; i < 200; i = j + 1) + Vector2 targetSpot = projectile.Center; + float detectRange = 400f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC = Main.npc[i]; - if (nPC.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) { - Vector2 center = nPC.Center; - float num780 = Vector2.Distance(center, projectile.Center); - if (num780 < num778) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (targetDist < detectRange) { - num778 = num780; - value19 = center; + detectRange = targetDist; + targetSpot = npc.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; + projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; } else projectile.Kill(); @@ -221,10 +218,7 @@ namespace CalamityMod.Projectiles.Rogue 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) => new Color(255, 255, 255, 200) * ((255f - (float)projectile.alpha) / 255f); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -283,7 +277,7 @@ namespace CalamityMod.Projectiles.Rogue { Main.PlaySound(SoundID.Item114, projectile.Center); - int radius = projectile.Calamity().stealthStrike ? 500 : 300; + float radius = projectile.Calamity().stealthStrike ? 500f : 300f; int numDust = (int)(0.2f * MathHelper.TwoPi * radius); float angleIncrement = MathHelper.TwoPi / (float)numDust; Vector2 dustOffset = new Vector2(radius, 0f); @@ -292,10 +286,10 @@ namespace CalamityMod.Projectiles.Rogue { dustOffset = dustOffset.RotatedBy(angleIncrement); int dustType = Utils.SelectRandom(Main.rand, new int[] - { + { 226, 229 - }); + }); int dust = Dust.NewDust(projectile.Center, 1, 1, dustType); Main.dust[dust].position = projectile.Center + dustOffset; if (Main.rand.Next(6) != 0) @@ -309,11 +303,11 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(projectile.Center, nPC.Center) <= (float)radius) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(projectile.Center, npc.Center) <= radius) { - if (nPC.FindBuffIndex(buffType) == -1) - nPC.AddBuff(buffType, 180, false); + if (npc.FindBuffIndex(buffType) == -1) + npc.AddBuff(buffType, 180, false); } } } From d61dd10b164193bec223462944d0eed2564d8eb7 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 11:44:34 -0400 Subject: [PATCH 127/137] attempted to fix harpy wings --- Items/CalamityGlobalItem.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 086302aebc..ed2121e06f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -354,7 +354,7 @@ namespace CalamityMod.Items } } } - if (modPlayer.harpyWingBoost) + if (modPlayer.harpyWingBoost && modPlayer.harpyRing) { if (Main.rand.NextBool(5)) { @@ -2867,8 +2867,7 @@ Provides heat and cold protection in Death Mode"; } else if (item.type == ItemID.HarpyWings) { - if (modPlayer.harpyRing) - modPlayer.harpyWingBoost = true; + modPlayer.harpyWingBoost = true; player.moveSpeed += 0.3f; player.noFallDmg = true; } From 81a506908099b6a5ed1a14dd970b62eaa7981389 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 20:39:53 -0400 Subject: [PATCH 128/137] Aether's Whisper now is crafted with Lahzar instead of Lazinator --- Items/Weapons/Typeless/AethersWhisper.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Typeless/AethersWhisper.cs b/Items/Weapons/Typeless/AethersWhisper.cs index 1404877502..fa581c0416 100644 --- a/Items/Weapons/Typeless/AethersWhisper.cs +++ b/Items/Weapons/Typeless/AethersWhisper.cs @@ -40,15 +40,9 @@ namespace CalamityMod.Items.Weapons.Typeless item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -78,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Typeless { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.LunarCraftingStation); From 2ef362427dc9533d795f980c4104ce3dfffd952d Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 11 May 2020 21:52:22 -0400 Subject: [PATCH 129/137] Swapped the base set bonus and underwater minion damage boosts also fixed a typo in the breastplate tooltip --- Items/Armor/FathomSwarmerBreastplate.cs | 2 +- Items/Armor/FathomSwarmerVisage.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Armor/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmerBreastplate.cs index 7c4a8171c2..19963235bd 100644 --- a/Items/Armor/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmerBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Fathom Swarmer Breastplate"); Tooltip.SetDefault("12% increased damage reduction and minion damage\n" + - "+1 max minions\n" + + "+1 max minion\n" + "Boosted defense and regen increased while submerged in liquid\n" + "Reduces defense loss within the Abyss"); } diff --git a/Items/Armor/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmerVisage.cs index 2f67fd1faf..79848c149e 100644 --- a/Items/Armor/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmerVisage.cs @@ -35,18 +35,18 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "30% increased minion damage and +1 max minion\n" + + player.setBonus = "10% increased minion damage and +1 max minion\n" + "Grants the ability to climb walls\n" + - "10% increased minion damage while submerged in liquid\n" + + "30% increased minion damage while submerged in liquid\n" + "Provides a moderate amount of light and moderately reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.fathomSwarmer = true; player.spikedBoots = 2; player.maxMinions++; - player.minionDamage += 0.3f; + player.minionDamage += 0.1f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.minionDamage += 0.1f; + player.minionDamage += 0.3f; } } From e562ac89634c85d6c40030b40a24b58e883817c3 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 09:45:15 -0400 Subject: [PATCH 130/137] Moss Hornets, Queen Bee, PBG, Plaguebringers, Plague chargers, and pestilent slimes now drop stingers Plaguebringers also no longer drop loot while PBG is alive --- Items/CalamityGlobalItem.cs | 1 + Items/TreasureBags/PlaguebringerGoliathBag.cs | 7 +++---- NPCs/CalamityGlobalNPCLoot.cs | 9 ++++++++- NPCs/NormalNPCs/PlagueBee.cs | 3 ++- NPCs/NormalNPCs/PlagueBeeLarge.cs | 3 ++- NPCs/NormalNPCs/PlaguedJungleSlime.cs | 3 ++- NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs | 6 ++---- NPCs/PlaguebringerGoliath/PlaguebringerShade.cs | 7 ++++--- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index ed2121e06f..4c45f0e531 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -2601,6 +2601,7 @@ Provides heat and cold protection in Death Mode"; // Queen Bee case ItemID.QueenBeeBossBag: + DropHelper.DropItem(player, ItemID.Stinger, 8, 12); DropHelper.DropItem(player, ModContent.ItemType(), 50, 75); break; diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 7fc7c68c57..7e0b0982a3 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.World; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags @@ -34,10 +35,7 @@ namespace CalamityMod.Items.TreasureBags item.expert = true; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void OpenBossBag(Player player) { @@ -45,6 +43,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 13, 17); + DropHelper.DropItem(player, ItemID.Stinger, 4, 8); // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Virulence diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 06a6652cd5..721657255b 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -279,7 +279,7 @@ namespace CalamityMod.NPCs npc.Calamity().SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); - // If Golem has never been killed, send messages about PBG and Ravager + // If Golem has never been killed, send messages about PBG if (!NPC.downedGolemBoss) { string key = "Mods.CalamityMod.BabyBossText"; @@ -1741,6 +1741,7 @@ namespace CalamityMod.NPCs break; case NPCID.QueenBee: + DropHelper.DropItemCondition(npc, ItemID.Stinger, !Main.expertMode, 5, 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 30, 50); break; @@ -1828,6 +1829,12 @@ namespace CalamityMod.NPCs { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, Main.expertMode ? 3 : 1); } + + // Every type of moss hornet can drop stingers + if (CalamityMod.mossHornetList.Contains(npc.type)) + { + DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 1f : 0.6666f); + } } #endregion diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index e072189a1b..10f5f879dd 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -101,7 +101,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); + DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index f7ded6f32e..c1c9c01b83 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -100,7 +100,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(2, 4)); + DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index 59fac63837..8651394bcb 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -128,7 +128,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 3)); + DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f); + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 5c5f9c4319..12830e52c8 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -974,10 +974,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public override bool CheckActive() - { - return canDespawn; - } + public override bool CheckActive() => canDespawn; public override void HitEffect(int hitDirection, double damage) { @@ -1134,6 +1131,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { // Materials DropHelper.DropItemSpray(npc, ModContent.ItemType(), 10, 14); + DropHelper.DropItemSpray(npc, ItemID.Stinger, 3, 5); // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Virulence diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index 68b5ca4ec2..2f7ae507e8 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -675,9 +675,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 8, 12); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 50); //no, this isn't getting boosted by Defiled. Rover, I don't care. PBG also drops it + DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f, 2, 3); + DropHelper.DropItem(npc, ModContent.ItemType(), 8, 12); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 50); //no, this isn't getting boosted by Defiled. Rover, I don't care. PBG also drops it } public override void OnHitPlayer(Player player, int damage, bool crit) From 0176f174ab7746e6e45d1258b883747995ba73cb Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 09:45:49 -0400 Subject: [PATCH 131/137] Plaguebringers no longer drop loot while PBG is alive --- NPCs/PlaguebringerGoliath/PlaguebringerShade.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index 2f7ae507e8..fd2ab09ab5 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -673,6 +673,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } + public override bool PreNPCLoot(NPC npc) => !NPC.AnyNPCs(ModContent.NPCType()); //don't drop items in the PBG fight + public override void NPCLoot() { DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 0.5f : 0.25f, 2, 3); From 1c702fd6557ede37af7cfd6a6b576b9fa788b0fd Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 09:54:03 -0400 Subject: [PATCH 132/137] error fix --- NPCs/PlaguebringerGoliath/PlaguebringerShade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index fd2ab09ab5..8a4a6b5cbb 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -673,7 +673,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public override bool PreNPCLoot(NPC npc) => !NPC.AnyNPCs(ModContent.NPCType()); //don't drop items in the PBG fight + public override bool PreNPCLoot() => !NPC.AnyNPCs(ModContent.NPCType()); //don't drop items in the PBG fight public override void NPCLoot() { From 560317574eb4fcc231340db2aad791a480731b1a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 10:30:50 -0400 Subject: [PATCH 133/137] elysian wings fall damage fix --- Items/Accessories/Wings/ElysianWings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index b208859ac8..1de428e6b6 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Accessories.Wings player.moveSpeed += 0.4f; player.lavaMax += 240; player.wingTimeMax = 200; + player.noFallDmg = true; modPlayer.elysianFire = true; if (hideVisual) { From 2d7222688d4e40a0832909cf881ed6a20b0ad6e6 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 10:31:09 -0400 Subject: [PATCH 134/137] added valkyrie ray to terra ray recipe --- Items/Weapons/Magic/TerraRay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index 47767c3221..b61f0556ac 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -45,12 +45,14 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); From db9ccff61bb568630a0632346bed0ce444caeadc Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 11:41:05 -0400 Subject: [PATCH 135/137] added an ActiveItem utility --- CalPlayer/CalamityPlayer.cs | 26 ++++----- CalPlayer/CalamityPlayerFishing.cs | 2 +- CalPlayer/CalamityPlayerMiscEffects.cs | 28 +++++----- Items/Accessories/StatMeter.cs | 2 +- Items/Accessories/TheCamper.cs | 12 ++--- Items/Ammo/AstralSolution.cs | 2 +- Items/CalamityGlobalItem.cs | 4 +- Projectiles/CalamityGlobalProjectile.cs | 2 +- .../DraedonsArsenal/GatlingLaserProj.cs | 6 +-- Projectiles/Healing/FungalHeal.cs | 16 +++--- Projectiles/Magic/DarkSparkPrism.cs | 6 +-- Projectiles/Magic/GhastlyVisageProj.cs | 8 +-- Projectiles/Magic/MelterAmp.cs | 2 +- Projectiles/Magic/PurgeProj.cs | 6 +-- Projectiles/Magic/SparklingBeam.cs | 2 +- Projectiles/Magic/T1000Proj.cs | 6 +-- Projectiles/Magic/ValkyrieRayStaff.cs | 2 +- Projectiles/Magic/YharimsCrystalPrism.cs | 6 +-- Projectiles/Melee/DevilsSunriseProj.cs | 4 +- Projectiles/Melee/MurasamaProj.cs | 4 +- Projectiles/Pets/Sparks.cs | 2 +- Projectiles/Ranged/ButcherGun.cs | 12 ++--- Projectiles/Ranged/ContagionBow.cs | 4 +- Projectiles/Ranged/DaemonsFlameBow.cs | 12 ++--- Projectiles/Ranged/DrataliornusBow.cs | 10 ++-- Projectiles/Ranged/FlakKrakenGun.cs | 4 +- .../Ranged/FlurrystormCannonShooting.cs | 12 ++--- Projectiles/Ranged/NorfleetCannon.cs | 10 ++-- Projectiles/Ranged/PhangasmBow.cs | 12 ++--- Projectiles/Ranged/StarfleetMK2Gun.cs | 10 ++-- Projectiles/Rogue/SylvanSlashAttack.cs | 54 +++++++++---------- Projectiles/Typeless/EnergyShell.cs | 2 +- .../Typeless/RelicOfDeliveranceSpear.cs | 4 +- Utilities/CalamityUtils.cs | 7 +-- 34 files changed, 151 insertions(+), 150 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 795f954a4a..6047958071 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2726,7 +2726,7 @@ namespace CalamityMod.CalPlayer } if (CalamityMod.RageHotKey.JustPressed) { - if (gaelRageCooldown == 0 && player.HeldItem.type == ModContent.ItemType() && + if (gaelRageCooldown == 0 && player.ActiveItem().type == ModContent.ItemType() && rage > 0) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); @@ -3376,12 +3376,12 @@ namespace CalamityMod.CalPlayer { CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); - if (player.HeldItem.type == ModContent.ItemType()) + if (player.ActiveItem().type == ModContent.ItemType()) { gaelSwitchTimer = GaelSwitchPhase.LoseRage; rage += (int)MathHelper.Min(5, 10000 - rage); } - else if (player.HeldItem.type != ModContent.ItemType() && gaelSwitchTimer == GaelSwitchPhase.LoseRage) + else if (player.ActiveItem().type != ModContent.ItemType() && gaelSwitchTimer == GaelSwitchPhase.LoseRage) { rage = 0; gaelSwitchTimer = GaelSwitchPhase.None; @@ -3584,7 +3584,7 @@ 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 != ModContent.ItemType()) + if (invincible && player.ActiveItem().type != ModContent.ItemType()) { if (player.statLife <= 0) { @@ -4410,7 +4410,7 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffID.Midas, 120, false); } - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) { target.AddBuff(ModContent.BuffType(), 240, false); } @@ -4728,7 +4728,7 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffID.Midas, 120, false); } - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) { target.AddBuff(ModContent.BuffType(), 240, false); } @@ -4745,7 +4745,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Venom, 120, false); } } - if (proj.type == ProjectileID.IchorArrow && player.inventory[player.selectedItem].type == ModContent.ItemType()) + if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ModContent.ItemType()) { target.AddBuff(BuffID.Midas, 300, false); } @@ -4985,7 +4985,7 @@ namespace CalamityMod.CalPlayer bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; - Item heldItem = player.inventory[player.selectedItem]; + Item heldItem = player.ActiveItem(); if (isTrueMelee && soaring) { @@ -5629,7 +5629,7 @@ namespace CalamityMod.CalPlayer { if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { - if (player.HeldItem.type == ModContent.ItemType() + if (player.ActiveItem().type == ModContent.ItemType() && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) { for (int j = 0; j < 3; j++) @@ -6141,7 +6141,7 @@ namespace CalamityMod.CalPlayer } } - if (lol || (invincible && player.inventory[player.selectedItem].type != ModContent.ItemType())) + if (lol || (invincible && player.ActiveItem().type != ModContent.ItemType())) { return false; } @@ -6233,7 +6233,7 @@ namespace CalamityMod.CalPlayer { damage = (int)(damage * 0.7); } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.HeldItem.type == ModContent.ItemType()) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) { damage = (int)(damage * 0.5); } @@ -9296,7 +9296,7 @@ namespace CalamityMod.CalPlayer // 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. // Using any item which deals no damage or is a tool doesn't consume stealth. - Item it = player.HeldItem; + Item it = player.ActiveItem(); bool hasDamage = it.damage > 0; bool hasHitboxes = !it.noMelee || it.shoot > 0; bool isPickaxe = it.pick > 0; @@ -9354,7 +9354,7 @@ namespace CalamityMod.CalPlayer stealthGenMoving += 0.15f; } - if (CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type) && player.invis) + if (CalamityMod.daggerList.Contains(player.ActiveItem().type) && player.invis) { stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index fdd3b70157..9f2d5cf8ac 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -591,7 +591,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.ZoneAbyss || modPlayer.ZoneSulphur) canSulphurFish = true; - Item item = player.inventory[player.selectedItem]; + Item item = player.ActiveItem(); if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 12508aa88a..cce27f6054 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1278,7 +1278,7 @@ namespace CalamityMod.CalPlayer player.endurance += 0.01f; player.statDefense += 2; } - if (!modPlayer.polarisBoost || player.inventory[player.selectedItem].type != ModContent.ItemType()) + if (!modPlayer.polarisBoost || player.ActiveItem().type != ModContent.ItemType()) { modPlayer.polarisBoost = false; if (player.FindBuffIndex(ModContent.BuffType()) > -1) @@ -2534,27 +2534,27 @@ namespace CalamityMod.CalPlayer } } - if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (CalamityMod.scopedWeaponList.Contains(player.ActiveItem().type)) player.scope = true; - if (CalamityMod.highTestFishList.Contains(player.inventory[player.selectedItem].type)) + if (CalamityMod.highTestFishList.Contains(player.ActiveItem().type)) player.accFishingLine = true; - if (CalamityMod.boomerangList.Contains(player.inventory[player.selectedItem].type) && player.invis) + if (CalamityMod.boomerangList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingDamage += 0.1f; - if (CalamityMod.javelinList.Contains(player.inventory[player.selectedItem].type) && player.invis) + if (CalamityMod.javelinList.Contains(player.ActiveItem().type) && player.invis) player.armorPenetration += 5; - if (CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type) && player.invis) + if (CalamityMod.flaskBombList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingVelocity += 0.1f; - if (CalamityMod.spikyBallList.Contains(player.inventory[player.selectedItem].type) && player.invis) + if (CalamityMod.spikyBallList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingCrit += 10; if (modPlayer.planarSpeedBoost != 0) { - if (player.inventory[player.selectedItem].type != ModContent.ItemType()) + if (player.ActiveItem().type != ModContent.ItemType()) modPlayer.planarSpeedBoost = 0; } @@ -2564,10 +2564,10 @@ namespace CalamityMod.CalPlayer !modPlayer.ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; - if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) player.endurance += 0.03f; - if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type)) + if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.ActiveItem().type)) player.scope = true; if (modPlayer.ZoneSunkenSea) @@ -2576,7 +2576,7 @@ namespace CalamityMod.CalPlayer player.ignoreWater = true; } - if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.ActiveItem().type)) player.statDefense += 5; if (modPlayer.ZoneAstral) @@ -2585,7 +2585,7 @@ namespace CalamityMod.CalPlayer player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05); } - if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type)) + if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.ActiveItem().type)) player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing if (modPlayer.ZoneAbyss) @@ -2605,7 +2605,7 @@ namespace CalamityMod.CalPlayer player.endurance += 0.05f; } - if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type)) + if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.ActiveItem().type)) player.blackBelt = true; if (player.ZoneHoly) @@ -3160,7 +3160,7 @@ namespace CalamityMod.CalPlayer } // Navy Fishing Rod's electric aura when in-use - if (player.inventory[player.selectedItem].type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + if (player.ActiveItem().type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { const int FramesPerHit = 120; diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 36eb6d66b9..4256880aa8 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories Item heldItem = null; if (player.selectedItem >= 0 && player.selectedItem < Main.maxInventory) - heldItem = player.inventory[player.selectedItem]; + heldItem = player.ActiveItem(); // Replace the vanilla tooltip with a full stat readout foreach (TooltipLine l in list) diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index b7e2755d4d..0b4fac1ec4 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -68,13 +68,13 @@ namespace CalamityMod.Items.Accessories } } } - if (player.HeldItem != null && !player.HeldItem.IsAir && player.HeldItem.stack > 0) + if (player.ActiveItem() != null && !player.ActiveItem().IsAir && player.ActiveItem().stack > 0) { - bool summon = player.HeldItem.summon; - bool rogue = player.HeldItem.Calamity().rogue; - bool melee = player.HeldItem.melee; - bool ranged = player.HeldItem.ranged; - bool magic = player.HeldItem.magic; + bool summon = player.ActiveItem().summon; + bool rogue = player.ActiveItem().Calamity().rogue; + bool melee = player.ActiveItem().melee; + bool ranged = player.ActiveItem().ranged; + bool magic = player.ActiveItem().magic; if (summon) { player.minionKB += 0.10f; diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index fd66b17ec2..eb11992048 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Ammo public override bool ConsumeAmmo(Player player) { - return !(player.itemAnimation < player.HeldItem.useAnimation - 3); + return !(player.itemAnimation < player.ActiveItem().useAnimation - 3); } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index ed2121e06f..c4e4f2810d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -650,7 +650,7 @@ namespace CalamityMod.Items } return false; } - if (player.HeldItem.type == ModContent.ItemType()) + if (player.ActiveItem().type == ModContent.ItemType()) { bool hasBlades = false; for (int i = 0; i < Main.projectile.Length; i++) @@ -684,7 +684,7 @@ namespace CalamityMod.Items } return false; } - if (player.HeldItem.type == ModContent.ItemType()) + if (player.ActiveItem().type == ModContent.ItemType()) { bool canContinue = true; int count = 0; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e1bb089af7..733c1d5776 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -604,7 +604,7 @@ namespace CalamityMod.Projectiles { if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 { - if (player.inventory[player.selectedItem].type == ItemID.BeesKnees) + if (player.ActiveItem().type == ItemID.BeesKnees) { projectile.magic = false; projectile.ranged = true; diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 0a1692cb45..dc73b8464b 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -61,14 +61,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } if (flag && Main.myPlayer == projectile.owner && fireLasers) { - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { // Consume 2 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.inventory[player.selectedItem], 2); + CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2); - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; Vector2 value3 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value2; if (player.gravDir == -1f) diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 885829ac9e..8b064add99 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.Healing 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) + if ((player.ActiveItem().summon && + !player.ActiveItem().melee && + !player.ActiveItem().ranged && + !player.ActiveItem().magic && + !player.ActiveItem().Calamity().rogue) || + player.ActiveItem().hammer > 0 || + player.ActiveItem().pick > 0 || + player.ActiveItem().axe > 0) { projectile.timeLeft = 600; } diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index bdcff0a9db..d3638d596b 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic { num26 = 5f; } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); + projectile.damage = (int)(player.ActiveItem().damage * player.MagicDamage()); projectile.ai[0] += 1f; projectile.ai[1] += 1f; if (projectile.localAI[0] == 0f) @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic flag10 = true; if (Main.myPlayer == projectile.owner) { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value12 = vector; Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; if (player.gravDir == -1f) @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic } if (flag10 && Main.myPlayer == projectile.owner) { - bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool flag11 = !flag9 || player.CheckMana(player.ActiveItem().mana, true, false); bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; if (flag12) { diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index d867918511..1ee6267dcb 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -146,12 +146,12 @@ namespace CalamityMod.Projectiles.Magic { int num42 = ModContent.ProjectileType(); float scaleFactor11 = 6f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback2 = player.ActiveItem().knockBack; if (flag16) { - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); + float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector19 = vector; Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; if (player.gravDir == -1f) diff --git a/Projectiles/Magic/MelterAmp.cs b/Projectiles/Magic/MelterAmp.cs index 67fbeac7fa..ece39897a6 100644 --- a/Projectiles/Magic/MelterAmp.cs +++ b/Projectiles/Magic/MelterAmp.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic projectile.active = false; return; } - if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != ModContent.ProjectileType()) + if (!player.ActiveItem().magic || player.ActiveItem().shoot != ModContent.ProjectileType()) { projectile.active = false; return; diff --git a/Projectiles/Magic/PurgeProj.cs b/Projectiles/Magic/PurgeProj.cs index 6f18cc87a5..b14f401183 100644 --- a/Projectiles/Magic/PurgeProj.cs +++ b/Projectiles/Magic/PurgeProj.cs @@ -75,11 +75,11 @@ namespace CalamityMod.Projectiles.Magic } 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; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; if (player.gravDir == -1f) diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index b536965a93..c36d09d386 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Magic } else { // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true)) + if (Main.time % 10 < 1 && !player.CheckMana(player.ActiveItem().mana, true)) { projectile.Kill(); } diff --git a/Projectiles/Magic/T1000Proj.cs b/Projectiles/Magic/T1000Proj.cs index 4147e4f8c8..99104817dc 100644 --- a/Projectiles/Magic/T1000Proj.cs +++ b/Projectiles/Magic/T1000Proj.cs @@ -75,11 +75,11 @@ namespace CalamityMod.Projectiles.Magic } 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; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; if (player.gravDir == -1f) diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index 5e52313fe0..6f4fd13085 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic // Calculate how quickly the staff should charge. Charge increases by some number close to 1 every frame. // Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1. if (projectile.localAI[0] == 0f) - projectile.localAI[0] = 47f / Main.player[projectile.owner].HeldItem.useTime; + projectile.localAI[0] = 47f / player.ActiveItem().useTime; // Increment the timer for the staff. If the timer has passed 47, destroy it. projectile.ai[0] += projectile.localAI[0]; diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 8592f7e5cc..e578bb4856 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); // Update damage based on curent magic damage stat (so Mana Sickness affects it) - projectile.damage = (int)((player.HeldItem?.damage ?? 0) * player.MagicDamage()); + projectile.damage = (int)((player.ActiveItem()?.damage ?? 0) * player.MagicDamage()); // ai[0] is the overall frame counter. projectile.ai[0] += 1f; @@ -77,11 +77,11 @@ namespace CalamityMod.Projectiles.Magic if (projectile.owner == Main.myPlayer) { // Scale seemingly never changes, so this just scales with shoot speed (Yharim's Crystal is 30 by default) - float speedTimesScale = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float speedTimesScale = player.ActiveItem().shootSpeed * projectile.scale; UpdateAim(rrp, speedTimesScale); // CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated. - bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem().mana, true, false); bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed; // The beams are only projected once (on frame 1). diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 402a915562..db87deba3c 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Melee { float scaleFactor6 = 1f; - if (player.inventory[player.selectedItem].shoot == projectile.type) - scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + if (player.ActiveItem().shoot == projectile.type) + scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector13 = Main.MouseWorld - vector; vector13.Normalize(); diff --git a/Projectiles/Melee/MurasamaProj.cs b/Projectiles/Melee/MurasamaProj.cs index 4cfecc40cb..625d47d292 100644 --- a/Projectiles/Melee/MurasamaProj.cs +++ b/Projectiles/Melee/MurasamaProj.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Melee if (player.channel && !player.noItems && !player.CCed) { float scaleFactor6 = 1f; - if (player.inventory[player.selectedItem].shoot == projectile.type) + if (player.ActiveItem().shoot == projectile.type) { - scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale; } Vector2 vector13 = Main.MouseWorld - vector; vector13.Normalize(); diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 9f0e658007..452b26e55e 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Pets if (new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height).Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height))) { - if (projectile.owner == Main.myPlayer && (player.inventory[player.selectedItem].type != 0 || player.itemAnimation <= 0)) + if (projectile.owner == Main.myPlayer && (player.ActiveItem().type != 0 || player.itemAnimation <= 0)) { // TODO, fix this maybe? if (!ItemLoader.OnPickup(item, player)) diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index 81eb1119c6..f5e40a58fb 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -103,13 +103,13 @@ namespace CalamityMod.Projectiles.Ranged { int num42 = 14; float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback2 = player.ActiveItem().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; + player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); + float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector19 = vector; Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index 1e49a6b92f..96483efc4a 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Ranged } if (flag && Main.myPlayer == projectile.owner) { - bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index e86672be02..a4d3999efa 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged 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; + bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -92,13 +92,13 @@ namespace CalamityMod.Projectiles.Ranged { int num42 = 14; float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback2 = player.ActiveItem().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; + player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); + float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector19 = vector; Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/DrataliornusBow.cs b/Projectiles/Ranged/DrataliornusBow.cs index d454833f74..8a317572fa 100644 --- a/Projectiles/Ranged/DrataliornusBow.cs +++ b/Projectiles/Ranged/DrataliornusBow.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged timeToFire = true; } - bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.soundDelay <= 0 && canFire) { @@ -91,13 +91,13 @@ namespace CalamityMod.Projectiles.Ranged { int type = 14; float scaleFactor = 18f; - int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float knockBack = player.inventory[player.selectedItem].knockBack; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().knockBack; - player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); type = ModContent.ProjectileType(); - knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); projectile.velocity = Main.screenPosition - playerPosition; diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 5571b2b96a..3b338314f4 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged { num26 = 5f; } - projectile.damage = (int)(player.inventory[player.selectedItem].damage * player.RangedDamage()); + projectile.damage = (int)(player.ActiveItem().damage * player.RangedDamage()); projectile.ai[0] += 1f; projectile.ai[1] += 1f; int num27 = 10; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged flag10 = true; if (Main.myPlayer == projectile.owner) { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value12 = vector; Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 2d92db8535..286986f8e6 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -107,13 +107,13 @@ namespace CalamityMod.Projectiles.Ranged { int num42 = 14; float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback2 = player.ActiveItem().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; + player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); + float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector19 = vector; Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index ec74639dfd..d28ceb5ce7 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; timeToFire = true; } - bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.soundDelay <= 0 && canFire) { projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; @@ -79,12 +79,12 @@ namespace CalamityMod.Projectiles.Ranged { int type = 12; float scaleFactor = 30f; - int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float knockBack = player.inventory[player.selectedItem].knockBack; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().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); + player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); projectile.velocity = Main.screenPosition - playerPosition; projectile.velocity.X += Main.mouseX; diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index ba5aadfb48..cd85a5abc1 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged 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; + bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -77,13 +77,13 @@ namespace CalamityMod.Projectiles.Ranged { int num42 = 14; float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); + float weaponKnockback2 = player.ActiveItem().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; + player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); + float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 vector19 = vector; Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; if (player.gravDir == -1f) diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index 4372a7928a..40b0bf1e3b 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; timeToFire = true; } - bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.soundDelay <= 0 && canFire) { projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; @@ -82,12 +82,12 @@ namespace CalamityMod.Projectiles.Ranged { int type = ModContent.ProjectileType(); float scaleFactor = 16f; - int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float knockBack = player.inventory[player.selectedItem].knockBack; - player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().knockBack; + player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); for (int i = 0; i < 5; i++) { - knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); projectile.velocity = Main.screenPosition - playerPosition; projectile.velocity.X += Main.mouseX; diff --git a/Projectiles/Rogue/SylvanSlashAttack.cs b/Projectiles/Rogue/SylvanSlashAttack.cs index b37be1ec9d..72c1212f54 100644 --- a/Projectiles/Rogue/SylvanSlashAttack.cs +++ b/Projectiles/Rogue/SylvanSlashAttack.cs @@ -29,6 +29,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + if (Main.myPlayer != projectile.owner) + return; + Player player = Main.player[projectile.owner]; float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); @@ -46,33 +49,30 @@ namespace CalamityMod.Projectiles.Rogue 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(); - } - } + if (player.channel && !player.noItems && !player.CCed) + { + float scaleFactor6 = 1f; + if (player.ActiveItem().shoot == projectile.type) + { + scaleFactor6 = player.ActiveItem().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, 0.2f, 2f, 3f); if (Main.rand.NextBool(3)) diff --git a/Projectiles/Typeless/EnergyShell.cs b/Projectiles/Typeless/EnergyShell.cs index d819990126..8fbc89e969 100644 --- a/Projectiles/Typeless/EnergyShell.cs +++ b/Projectiles/Typeless/EnergyShell.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[projectile.owner]; projectile.Center = player.Center; //if player is dead, null, or stops holding the Lion Heart, kill the projectile - if (player.dead || player is null || player.HeldItem.type != ModContent.ItemType()) + if (player.dead || player is null || player.ActiveItem().type != ModContent.ItemType()) { projectile.Kill(); } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 09f206ccff..6044b01d8e 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -79,12 +79,12 @@ namespace CalamityMod.Projectiles.Typeless if (projectile.velocity == Vector2.Zero) { // Immediately die if the player is not holding the spear - if (player.HeldItem == null) + if (player.ActiveItem() == null) { projectile.Kill(); return; } - if (player.HeldItem.type != ModContent.ItemType()) + if (player.ActiveItem().type != ModContent.ItemType()) { projectile.Kill(); return; diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 4204c4d2f5..cf4cc53275 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -53,6 +53,7 @@ namespace CalamityMod 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(); + public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; #endregion #region Player Utilities @@ -302,7 +303,7 @@ namespace CalamityMod public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) { Player player = Main.player[Main.myPlayer]; - Item item = player.inventory[player.selectedItem]; + Item item = player.ActiveItem(); float hitbox_X, hitbox_Y; float mountOffsetY = player.mount.PlayerOffsetHitbox; @@ -2192,12 +2193,12 @@ namespace CalamityMod public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) { Player player = Main.player[projectile.owner]; - if (projectile.bobber && player.inventory[player.selectedItem].holdStyle > 0) + if (projectile.bobber && player.ActiveItem().holdStyle > 0) { float pPosX = player.MountedCenter.X; float pPosY = player.MountedCenter.Y; pPosY += player.gfxOffY; - int type = player.inventory[player.selectedItem].type; + int type = player.ActiveItem().type; float gravDir = player.gravDir; if (type == fishingRodType) From 3ac8cecfa510ebc42d99708796e1cdb7e60d5638 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 12:17:18 -0400 Subject: [PATCH 136/137] cleaned up code in spikecrag and stormjaw also removed the velocity check for spikecrag (it broke the summon) --- Projectiles/Summon/Spikecrag.cs | 49 ++++++++------------ Projectiles/Summon/StormjawBaby.cs | 73 ++++++++++++++---------------- 2 files changed, 52 insertions(+), 70 deletions(-) diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index ac1bb7e4e3..b8118d738a 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -60,25 +60,22 @@ namespace CalamityMod.Projectiles.Summon 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 < Main.maxNPCs; 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 && projectile.velocity.Y == 0f) + float maxDistance = 1000f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + { + homeIn = true; + } + } + } + if (projectile.owner == Main.myPlayer && homeIn) { if (projectile.ai[0] != 0f) { @@ -99,18 +96,8 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 3946a48728..fcaad65b60 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -82,8 +82,8 @@ namespace CalamityMod.Projectiles.Summon } } Vector2 vector2_1 = player.Center; - vector2_1.X = vector2_1.X - (float) ((15 + player.width / 2) * player.direction); - vector2_1.X = vector2_1.X - (float) (projectile.minionPos * 40 * player.direction); + vector2_1.X = vector2_1.X - (float)((15 + player.width / 2) * player.direction); + vector2_1.X = vector2_1.X - (float)(projectile.minionPos * 40 * player.direction); int index1 = -1; float num4 = 800f; int num5 = 15; @@ -217,10 +217,10 @@ namespace CalamityMod.Projectiles.Summon } } if (projectile.velocity.X > 0.5f) - projectile.spriteDirection = -1; - else if (projectile.velocity.X < -0.5f) projectile.spriteDirection = 1; - projectile.rotation = projectile.spriteDirection != 1 ? (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X) + 3.14f : (float) Math.Atan2((double) projectile.velocity.Y, (double) projectile.velocity.X); + else if (projectile.velocity.X < -0.5f) + projectile.spriteDirection = -1; + projectile.rotation = projectile.spriteDirection != 1 ? (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi : (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); } if (projectile.ai[0] == 2f) //attack target { @@ -233,9 +233,9 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; projectile.frameCounter = 0; } - else if ((double) Math.Abs(projectile.velocity.X) >= 0.5) + else if (Math.Abs(projectile.velocity.X) >= 0.5f) { - projectile.frameCounter += (int) Math.Abs(projectile.velocity.X); + projectile.frameCounter += (int)Math.Abs(projectile.velocity.X); projectile.frameCounter += 1; if (projectile.frameCounter > 10) { @@ -251,13 +251,13 @@ namespace CalamityMod.Projectiles.Summon projectile.frameCounter = 0; } } - else if ((double) projectile.velocity.Y != 0.0) + else if (projectile.velocity.Y != 0f) { projectile.frameCounter = 0; projectile.frame = 0; } projectile.velocity.Y += 0.4f; - if ((double) projectile.velocity.Y > 10.0) + if (projectile.velocity.Y > 10f) projectile.velocity.Y = 10f; sparkCounter += Main.rand.Next(1,4); @@ -272,7 +272,6 @@ namespace CalamityMod.Projectiles.Summon Main.projectile[spark].Calamity().forceMinion = true; Main.projectile[spark].timeLeft = 120; Main.projectile[spark].penetrate = 3; - ProjectileID.Sets.MinionShot[Main.projectile[spark].type] = true; Main.projectile[spark].usesIDStaticNPCImmunity = true; Main.projectile[spark].idStaticNPCHitCooldown = 10; Main.projectile[spark].usesLocalNPCImmunity = false; @@ -294,27 +293,27 @@ namespace CalamityMod.Projectiles.Summon { float num1 = 700f; float num2 = 20f; - if ((double) projectile.position.Y > Main.worldSurface * 16.0) + if ((double)projectile.position.Y > Main.worldSurface * 16.0) num1 *= 0.7f; NPC npc = Main.npc[index1]; Vector2 center = npc.Center; float num3 = (center - projectile.Center).Length(); Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); - if ((double) num3 < (double) num1) + if (num3 < num1) { vector2_1 = center; - if ((double) center.Y < (double) projectile.Center.Y - 30.0 && (double) projectile.velocity.Y == 0.0) + if (center.Y < projectile.Center.Y - 30f && projectile.velocity.Y == 0f) { float num6 = Math.Abs(center.Y - projectile.Center.Y); - if ((double) num6 < 120.0) + if (num6 < 120f) projectile.velocity.Y = -10f; - else if ((double) num6 < 210.0) + else if (num6 < 210f) projectile.velocity.Y = -13f; - else if ((double) num6 < 270.0) + else if (num6 < 270f) projectile.velocity.Y = -15f; - else if ((double) num6 < 310.0) + else if (num6 < 310f) projectile.velocity.Y = -17f; - else if ((double) num6 < 380.0) + else if ( num6 < 380f) projectile.velocity.Y = -18f; } } @@ -363,10 +362,10 @@ namespace CalamityMod.Projectiles.Summon float num8 = vector2_1.X - projectile.Center.X; if ((double) Math.Abs(num8) > 5.0) { - if ((double) num8 < 0.0) + if (num8 < 0f) { num7 = -1; - if ((double) projectile.velocity.X > -(double) num2) + if (projectile.velocity.X > -num2) { projectile.velocity.X -= num1; } @@ -378,7 +377,7 @@ namespace CalamityMod.Projectiles.Summon else { num7 = 1; - if ((double) projectile.velocity.X < (double) num2) + if (projectile.velocity.X < num2) { projectile.velocity.X += num1; } @@ -391,13 +390,13 @@ namespace CalamityMod.Projectiles.Summon else { projectile.velocity.X *= 0.9f; - if ((double) Math.Abs(projectile.velocity.X) < (double) num1 * 2.0) + if (Math.Abs(projectile.velocity.X) < num1 * 2f) projectile.velocity.X = 0.0f; } if (num7 != 0) { - int num9 = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; - int num10 = (int) projectile.position.Y / 16; + int num9 = (int)projectile.Center.X / 16; + int num10 = (int)projectile.position.Y / 16; int i = num9 + num7 + (int) projectile.velocity.X; for (int j = num10; j < num10 + projectile.height / 16 + 1; ++j) { @@ -441,17 +440,17 @@ namespace CalamityMod.Projectiles.Summon } } } - if ((double) projectile.velocity.X > (double) num3) + if (projectile.velocity.X > num3) projectile.velocity.X = num3; - if ((double) projectile.velocity.X < -(double) num3) + if (projectile.velocity.X < -num3) projectile.velocity.X = -num3; - if ((double) projectile.velocity.X < 0.0) + if (projectile.velocity.X < 0f) projectile.direction = -1; - if ((double) projectile.velocity.X > 0.0) + if (projectile.velocity.X > 0f) projectile.direction = 1; - if ((double) projectile.velocity.X > (double) num1 && num7 == 1) + if (projectile.velocity.X > num1 && num7 == 1) projectile.direction = 1; - if ((double) projectile.velocity.X < -(double) num1 && num7 == -1) + if (projectile.velocity.X < -num1 && num7 == -1) projectile.direction = -1; projectile.spriteDirection = -projectile.direction; projectile.rotation = 0f; @@ -467,7 +466,7 @@ namespace CalamityMod.Projectiles.Summon if (xDist > 0) projectile.spriteDirection = projectile.direction; } - else if ((double) Math.Abs(projectile.velocity.X) >= 0.5) + else if (Math.Abs(projectile.velocity.X) >= 0.5f) { projectile.frameCounter += (int) Math.Abs(projectile.velocity.X); projectile.frameCounter += 1; @@ -485,18 +484,18 @@ namespace CalamityMod.Projectiles.Summon projectile.frameCounter = 0; } } - else if ((double) projectile.velocity.Y != 0.0) + else if (projectile.velocity.Y != 0f) { projectile.frameCounter = 0; projectile.frame = 0; } projectile.velocity.Y += 0.4f; - if ((double) projectile.velocity.Y > 10.0) + if (projectile.velocity.Y > 10f) projectile.velocity.Y = 10f; } if (projectile.ai[0] != 2f) { - Rectangle rectangle = new Rectangle((int)((double)projectile.position.X + (double)projectile.velocity.X * 0.5 - 4.0), (int)((double)projectile.position.Y + (double)projectile.velocity.Y * 0.5 - 4.0), projectile.width + 8, projectile.height + 8); + Rectangle rectangle = new Rectangle((int)(projectile.position.X + projectile.velocity.X * 0.5f - 4f), (int)(projectile.position.Y + projectile.velocity.Y * 0.5f - 4f), projectile.width + 8, projectile.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[projectile.owner] <= 0) @@ -517,7 +516,6 @@ namespace CalamityMod.Projectiles.Summon Main.projectile[spark].Calamity().forceMinion = true; Main.projectile[spark].timeLeft = 120; Main.projectile[spark].penetrate = 3; - ProjectileID.Sets.MinionShot[Main.projectile[spark].type] = true; Main.projectile[spark].usesIDStaticNPCImmunity = true; Main.projectile[spark].idStaticNPCHitCooldown = 10; Main.projectile[spark].usesLocalNPCImmunity = false; @@ -537,10 +535,7 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void Kill(int timeLeft) { From da6b42ce0f256967612e478d725b719cde6b017a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 12 May 2020 12:19:47 -0400 Subject: [PATCH 137/137] relic of resilience typo fix --- Items/Weapons/Typeless/RelicOfResilience.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index 7677e5ff4a..29be8f0f03 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Typeless { DisplayName.SetDefault("Relic of Resilience"); Tooltip.SetDefault("Summons a bulwark at the mouse position\n" + - "The bulwark killed by enemies and all projectiles.\n" + + "The bulwark is killed by enemies and all projectiles.\n" + "On death, the bulwark explodes into a rotating burst of shards\n" + "If an enemy is in the area of the shards, its next attack is much weaker. This effect has a cooldown\n" + "After a bit of time, the shards come together to reform the original bulwark.\n" + @@ -41,10 +41,7 @@ namespace CalamityMod.Items.Weapons.Typeless item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => !player.HasBuff(ModContent.BuffType()); - public override bool UseItem(Player player) - { - return true; - } + public override bool UseItem(Player player) => 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) { player.AddBuff(ModContent.BuffType(), CooldownSeconds * 60);