From b0cf50de905fcef97f482109e118b5ebb58b513c Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 3 Nov 2021 22:58:34 -0500 Subject: [PATCH 01/57] Added Ares' arms (still somewhat wip) --- ExtraTextures/AresArmTopPart1.png | Bin 0 -> 731 bytes ExtraTextures/AresArmTopPart2.png | Bin 0 -> 1018 bytes ExtraTextures/AresArmTopPart2Glow.png | Bin 0 -> 386 bytes ExtraTextures/AresArmTopSegment.png | Bin 0 -> 521 bytes ExtraTextures/AresArmTopSegmentGlow.png | Bin 0 -> 255 bytes ExtraTextures/AresArmTopShoulder.png | Bin 0 -> 1442 bytes ExtraTextures/AresArmTopShoulderGlow.png | Bin 0 -> 487 bytes NPCs/ExoMechs/Ares/AresBody.cs | 148 +++++++++++++++++++---- Projectiles/Boss/AresTeslaOrb.cs | 4 +- 9 files changed, 127 insertions(+), 25 deletions(-) create mode 100644 ExtraTextures/AresArmTopPart1.png create mode 100644 ExtraTextures/AresArmTopPart2.png create mode 100644 ExtraTextures/AresArmTopPart2Glow.png create mode 100644 ExtraTextures/AresArmTopSegment.png create mode 100644 ExtraTextures/AresArmTopSegmentGlow.png create mode 100644 ExtraTextures/AresArmTopShoulder.png create mode 100644 ExtraTextures/AresArmTopShoulderGlow.png diff --git a/ExtraTextures/AresArmTopPart1.png b/ExtraTextures/AresArmTopPart1.png new file mode 100644 index 0000000000000000000000000000000000000000..fc58f490580d2ff418b8a51915c3dba420bca3dc GIT binary patch literal 731 zcmeAS@N?(olHy`uVBq!ia0vp^B|xmg!3-qxPrZ8tq!^2X+?^QKos)S9+XVQ8xB_W0AsGWpS2+d68PD$|_Rll6un&k#FRtm{u=l7(W`V6=xRQo} zpOX3#1INzVr0$07&f4UO9SuN@?o#hXfs{x|kYDhBOu*pp|6C9#&spFRS8 zdVKGjqkf#Z-lOo(B}x6WQ@vBydHkNM6r>vTegE~>o7NorS|!#$&8TA5k~!&I4f{I! zmz1p4anpQjzEt3!!L_ZK$GrlVnVi2}wmN5a`PYyZ`x^_7>2W8mH!7YtsbyiyGFkn( z%PRR)kKbPFTC{DI+@UGmpNh(ouX0S;Wj0+>o9EBzAU4o_r7;Ld9zr)spPiT z!<(g7RkWTKcp0YmF3*zDbX^$cwKM!z$Md?5B|@81u6?zbH}6hnx>hS&|Kw#`-q#kJ zn$~UK`OA5yPKSfnT*Xw&-pQBzqB;d!v-4bRzB~VVwn^8kRObA7ef`39MaMiB?_^@V zEq`{ZN&0Q|S8f;O&rfLz_|LV?aa*m6=H7k#_AWhAImOuP)H8KW{f(zvk7;F@MhLD* zp0qXD*(>3t;?t#Tmrd$cmS*|5@lvLjW?Z77Nmsz;{ce{v+!ncBFmu#koo*NH=Gl6l zqxs?6r@m43FSu2dGj%p>o~Av|$rfmAgS4Q*ox5$RUzVQ}P}N;zF)1i_%CuJHTei~K zlE*y07BQa_tmfUyvHLIM(!MWNZauqWHajc`@0+&oc=nGkhlK?kCU?enzEzI-QvT2M z<#&ViPcy1^2P!@ai`J7{_ox37Tju%B)nIC3WKMspUXO@ GgeCyu(MO2@ literal 0 HcmV?d00001 diff --git a/ExtraTextures/AresArmTopPart2.png b/ExtraTextures/AresArmTopPart2.png new file mode 100644 index 0000000000000000000000000000000000000000..3390cc34de7333d072564d668d172fc44588b033 GIT binary patch literal 1018 zcmVPx#1ZP1_K>z@;j|==^1poj5KTu3mMF0Q*9v~qzI6qKXXPTt0b9{@z%+XFFC)4X} zq%c9pK0Zlhx@qv-IWBXnxPSWpaR2}C^0q0a@M-dJNdN!<;%<^W0000LbW%=J|NsC0 z|NsC0|NsC0|NsC0|NsC004v#j>Hq)$32;bRa{vGizyJUazyWI3i3tDz10zX9K~z{r z-Iv>Tn=lXn4Kyw;w>ZuJe`_@wHUfNU`_OY#&w~-tYIlN!9G^b_Da{va#{*tpqiwtH zTjnj%w$D^vTcapImw2x7x*B_h^SSGqrcFFksavDGWO4m7iUK9Mp3h3iBb9nJC~WX4 z!S=eRvgX}DB!#&$AC0mkL5%KI>eOHgK?Ku2o%r+)DTGW%!6VEimJHyM>^01GRH;vc zaFQ8DVS4yfC0AM@4cm}7Tl5|^ZkI%eiKy?Hx->$;G{QsMK76N%B1U%aDG^ZI<7!$On1ieEdB+?68mB#sOX#%)1!NbdPM-fVS(9uE$oK@OnBS$FA ziN0T!X|j?U9AWinkQNx=Q8AHT53r*K<@sa*q9iJ}ph8YGnr2C`MdAH@7(6DV9u00` znug(eC76k%P(u;Y##VF#8sR+=z#66a!k+0B^hlKbEPNLfRR00RhDoVng$I- zLZxO6M2bc%3mU$l5}Q?wxu>xeQDd4|7Ak-mEP1x5N(0c~q0KWAYP`Ln=SKB-bBQRC z>wl3e?=TMdlIyy8_D~;3UWH}hEA4WrPotCoUM_k}Mo)av8FzbViSYsB#Iqod&+{~S zJYF;PY7m?=f5Al3WwZ1H5)Jxdi5N9f8T;s^<+fywndEwHnx6?Jhzp6jH24Q5R46VK zN5TRqc&CU984F~|(u#Zk0RM#Rb(%tAn%4R&^=PWLhmk2(_PDS0e5 zZLXJ#$EZDm1|p8|gVB6alLnBGfFeUOde?vr^cro;_I*~1yey#-KMM-AX^1JENRhSs zF1dbUt@jYKsR8~h_#ZUH^y|%UFt(^4v0niX0N6{^t?~DmJc{nw3asHbyq1Po>ZoJi o8uEZw)CepbtesD(LgVxE7t9F|RL7Ea8UO$Q07*qoM6N<$f}}{yx&QzG literal 0 HcmV?d00001 diff --git a/ExtraTextures/AresArmTopPart2Glow.png b/ExtraTextures/AresArmTopPart2Glow.png new file mode 100644 index 0000000000000000000000000000000000000000..c98e533d239d5182045929ec90ffeff4575f0339 GIT binary patch literal 386 zcmeAS@N?(olHy`uVBq!ia0vp^Z9r_n!3-q%(+idXDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheasfUeu0ZzvFFcUJGH|MkD%|Njr4wrMW=kol>=6DTz?{aHPb;wlO9 z3;quS44cmAoCk_>7I;J!GcfS&2Vq7F)?gK&;B`+I$B+p3w^wfSwJ7koUKA8q{{R2s z%gjfw+@7s6cgt_j3op93us8T{sc724(+~H}ZCF}xPfW)sjm_=8 zT(j(vATA5Jf9|8Q~#^Orw{7le7AMPBtvs+@|`0Ibc z|NkF0>^=Ia!1L2KO+O{|cI_~r#(!mc)<8<6B*-uLKPF)C_kS)3l;vHi~@@kiMZPqb7X%=DX z@Ug4aUQV8kyTfbUMU|!g&CN5@Ra$CiIC8!fy=6Op-dE3pxPM0{|6K2~=G3y47L)Ar zPPZO;8nSdEhZOh!uWalpa#r#hx;sN0Hecp`9P}yo@`cd)M1>8Ui=977gdWMhIxQ;B uUMcAEkDn`S8s#|O{yrbi!r^iI8|#rdmYgAvF0Td#D}$%2pUXO@geCy>xZ4*1 literal 0 HcmV?d00001 diff --git a/ExtraTextures/AresArmTopSegmentGlow.png b/ExtraTextures/AresArmTopSegmentGlow.png new file mode 100644 index 0000000000000000000000000000000000000000..508e7a4db16c2a9235b142c62613e731d6efc06b GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^DnM+&!3-q*W@@MdDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheq5(c3u0T5T!<}FM3;zHA@TtJFT{{dY@?yifQXs`%666>B9}F0zyqVpA zLYxI2k;M!QdN3H`3JggV5WxT6@@@Y29%XJ1py9&&> z>^fdN)W7vYyX2l>$Z=>Px# literal 0 HcmV?d00001 diff --git a/ExtraTextures/AresArmTopShoulder.png b/ExtraTextures/AresArmTopShoulder.png new file mode 100644 index 0000000000000000000000000000000000000000..0ccf4a33fe41599e78e1f497d70c1c2f53c5f7cf GIT binary patch literal 1442 zcmV;T1zq}yP)Px#1ZP1_K>z@;j|==^1poj5PEbr#MF0Q*hbvYyI6odBA@a5<@^DGP%+de<@W(zr zP+4ble2bc-uB0$QIWBXfgpx&AfcpP%K3T4gqe0W_Y#<#lkzkRg@M&62cupcG0001+ zH6P3X000_vQchF<|NsC0|NsC0|NsC0|NsC0|NsC0|NsC002Cqs+5i9m32;bRa{vGi z!TRzB=zk<9M zC^s}w*CM9{C4r%?bF51uyOxlRI$Nb|MGsX#%l*CNr+BwEHPs_TO>K zLnLXYJ;z!~v0=O~VxV$(q1I3@cZ`8jHUS-DJpuntv0j@En+h@BL$`%iC1EL|tA>s4fQ6 zgdPI)Ho<~xqD{3u#-puJq-UmOW-I7+%PSwo1g_A_1iQe%U?C_Q=f3T17Nvw3qs^zH zA#}SP243U)ezgLNiQ>rA#4R1HTOk4*C5WPrg`OefW$$KCQoGynYP(wP_k^!l(uOM^ zp**}08f9+o+lz68H(s>UfPy?6cDt_QvGdoj{hkd%6BG$XU@3oso+HkMhcRgDPoPB8 zbQ5SG4FdFd?7C`*nOh@)g!1^U@ENB!a1|JBUUMqPcF@!5>FIF5oO0jqfB)|L<1w~< zp_CSm2rQ1=q*a-CRro1J;uvJ!9GXE*E@|w#;}NI{R=!l=41y$5TEYxk49f{oWhe;? zPY9lrZY$_8{P|-c2qnQ>Hjy|%0GZb+kc7;UUsae%aqMD6mRnmxXawW4-vbrn%Q3SS z6c*>nHFOAz!YtBuz1G)lw;hx%P#}~0{qg9=FVGSI`uwaFixC%4{ApQIp=Dv=B~y{@ zpu62LjG+L<2}Bgca}q(_7{C!QGc$}f5S9@~n+I1B?ueLoC~#pz_Z5So;ak;oaLqz)?; zv*-4KEySc&P#;1;@(Oi2VFrwFeB+RPi#W1uv>7XwbP3J0qP9?OXp6;ms|ltRITrJj z92@*4RP2l?W=>$(yaz-rp#;{nJR6D4FD>l-E=y?o~4KDk=s+fHcr&>bYqIEa466A;DOXxLf3mqeCU#N?4 zG1=>jY6k`D7EkF1QYc8;7}fr3Y72Ec@WqFot;trmN^W~7kaMWm(07E6VX=VQA*TT4 zp^|SjPAuTtA*TW*d?vjn)}D5^(KMhS{2*|*1)|naHaz~M62>=|$?cI-g8C8pJ)!(j wGX^?$d$or8C(Zu`qPEbn9Q%K20DXD+3s}MU*Xe;D_5c6?07*qoM6N<$g3ue64gdfE literal 0 HcmV?d00001 diff --git a/ExtraTextures/AresArmTopShoulderGlow.png b/ExtraTextures/AresArmTopShoulderGlow.png new file mode 100644 index 0000000000000000000000000000000000000000..b23f5bdbbb9fcaf841871c75f54eb5c23880573f GIT binary patch literal 487 zcmeAS@N?(olHy`uVBq!ia0vp^B_Pbf3?!3Xo{0h}#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6-k0X`wFK)PK!?9(>QPX(TfTPFSbUtkxxu5Yp9<<~hA6DBVEkO@?f7GEa~ zqO)G{+Q#JTq=`)W_g?RJ>@jAH93}fD?IvhPx{si zvr&?D9{7n5NKP6s8Wp!&^QYu5K z{Flp<^Ov<>tG7+|dHFZtPhGi#bHuh3MsNPP%RW77nGm%1>WVKHHXW>4`@%76@gK+6 z&aW2Pdd6;v5w2d^`3>Pjnbv0-ChiO2uD-Q@fs6nD4Ho|MFBkm*1}cN6tDnm{r-UW| Dh8EYW literal 0 HcmV?d00001 diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 4e48d24cff..40d3dea6eb 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -17,6 +17,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ID; @@ -26,7 +27,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { [AutoloadBossHead] public class AresBody : ModNPC - { + { // Used for loot public enum MechType { @@ -106,34 +107,38 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Max distance from the target before they are unable to hear sound telegraphs private const float soundDistance = 4800f; + // Drawers for arm segments. + public static PrimitiveTrail LightningDrawer; + public static PrimitiveTrail LightningBackgroundDrawer; + public override void SetStaticDefaults() - { - DisplayName.SetDefault("XF-09 Ares"); + { + DisplayName.SetDefault("XF-09 Ares"); NPCID.Sets.TrailingMode[npc.type] = 3; NPCID.Sets.TrailCacheLength[npc.type] = npc.oldPos.Length; } - public override void SetDefaults() - { + public override void SetDefaults() + { npc.npcSlots = 5f; npc.damage = 100; npc.width = 220; - npc.height = 252; - npc.defense = 100; + npc.height = 252; + npc.defense = 100; npc.DR_NERD(0.35f); npc.LifeMaxNERB(1300000, 1495000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; - aiType = -1; + aiType = -1; npc.Opacity = 0f; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(3, 33, 0, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(3, 33, 0, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; npc.boss = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; bossBag = ModContent.ItemType(); @@ -146,19 +151,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } public override void SendExtraAI(BinaryWriter writer) - { + { writer.Write(frameX); writer.Write(frameY); writer.Write(armsSpawned); - writer.Write(npc.dontTakeDamage); + writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); armsSpawned = reader.ReadBoolean(); @@ -169,8 +174,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.Calamity().newAI[i] = reader.ReadSingle(); } - public override void AI() - { + public override void AI() + { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); CalamityGlobalNPC.draedonExoMechPrime = npc.whoAmI; @@ -786,6 +791,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Draw the enrage smoke behind Ares SmokeDrawer.DrawSet(npc.Center); + // Draw arms. + int laserArm = NPC.FindFirstNPC(ModContent.NPCType()); + int gaussArm = NPC.FindFirstNPC(ModContent.NPCType()); + int teslaArm = NPC.FindFirstNPC(ModContent.NPCType()); + int plasmaArm = NPC.FindFirstNPC(ModContent.NPCType()); + + if (laserArm != -1) + DrawArm(spriteBatch, Main.npc[laserArm].Center, -1, true); + if (gaussArm != -1) + DrawArm(spriteBatch, Main.npc[gaussArm].Center, 1, true); + if (teslaArm != -1) + DrawArm(spriteBatch, Main.npc[teslaArm].Center, -1, false); + if (plasmaArm != -1) + DrawArm(spriteBatch, Main.npc[plasmaArm].Center, 1, false); + Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); @@ -831,6 +851,88 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } + internal float WidthFunction(float completionRatio) + { + return MathHelper.Lerp(0.75f, 1.85f, (float)Math.Sin(MathHelper.Pi * completionRatio)) * npc.scale; + } + + internal Color ColorFunction(float completionRatio) + { + float fadeToWhite = MathHelper.Lerp(0f, 0.65f, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f); + Color baseColor = Color.Lerp(Color.Cyan, Color.White, fadeToWhite); + Color color = Color.Lerp(baseColor, Color.LightBlue, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * npc.Opacity; + color.A = 84; + return color; + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; + + public Color BackgroundColorFunction(float completionRatio) + { + Color color = Color.CornflowerBlue * npc.Opacity * 0.4f; + return color; + } + + public void DrawArm(SpriteBatch spriteBatch, Vector2 handPosition, int direction, bool backArm) + { + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + if (LightningBackgroundDrawer is null) + LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + + SpriteEffects spriteDirection = direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + float distanceFromHand = npc.Distance(handPosition); + + Texture2D shoulderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopShoulder"); + Texture2D armTexture1 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart1"); + Texture2D armSegmentTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopSegment"); + Texture2D armTexture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart2"); + + Texture2D shoulderGlowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopShoulderGlow"); + Texture2D armSegmentGlowmask = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopSegmentGlow"); + Texture2D armGlowmask2 = ModContent.GetTexture("CalamityMod/ExtraTextures/AresArmTopPart2Glow"); + + Vector2 shoulderDrawPosition = npc.Center + new Vector2(direction * (backArm ? 176f : 232f), backArm ? -100f : -36f); + Color shoulderLightColor = npc.GetAlpha(Lighting.GetColor((int)shoulderDrawPosition.X / 16, (int)shoulderDrawPosition.Y / 16)); + Color glowmaskColor = npc.GetAlpha(Color.White); + Vector2 arm1DrawPosition = shoulderDrawPosition + new Vector2(direction * (shoulderTexture.Width + 40f), 10f); + Vector2 armSegmentDrawPosition = arm1DrawPosition; + + Vector2 arm1Origin = armTexture1.Size() * new Vector2((direction == 1).ToInt(), 0.5f); + Vector2 arm2Origin = armTexture2.Size() * new Vector2((direction == 1).ToInt(), 0.5f); + + float arm1Rotation = MathHelper.Clamp(distanceFromHand * direction / 1200f, -0.22f, 0.22f); + float arm2Rotation = (handPosition - armSegmentDrawPosition).ToRotation(); + if (direction == 1) + arm2Rotation += MathHelper.Pi; + + // Handle offsets for points. + armSegmentDrawPosition += arm1Rotation.ToRotationVector2() * direction * 50f; + Vector2 arm2DrawPosition = armSegmentDrawPosition; + arm2DrawPosition -= arm2Rotation.ToRotationVector2() * direction * 40f; + arm2DrawPosition += (arm2Rotation - MathHelper.PiOver2).ToRotationVector2() * 14f; + + // Draw electricity between arms. + List arm1ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm1DrawPosition, armSegmentDrawPosition, 466920161); + List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition, 250290787); + LightningBackgroundDrawer.Draw(arm1ElectricArcPoints, -Main.screenPosition, 90); + LightningDrawer.Draw(arm1ElectricArcPoints, -Main.screenPosition, 90); + LightningBackgroundDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); + LightningDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); + + shoulderDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + arm1DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + armSegmentDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + arm2DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + + spriteBatch.Draw(armTexture1, arm1DrawPosition, null, shoulderLightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, null, shoulderLightColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, null, glowmaskColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, null, shoulderLightColor, arm2Rotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, null, glowmaskColor, arm2Rotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armTexture2, arm2DrawPosition, null, shoulderLightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armGlowmask2, arm2DrawPosition, null, glowmaskColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection, 0f); + } public override void BossLoot(ref string name, ref int potionType) { @@ -838,7 +940,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } public override void NPCLoot() - { + { // Check if the other exo mechs are alive bool exoWormAlive = false; bool exoTwinsAlive = false; @@ -1020,5 +1122,5 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - } + } } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 4e15d1898e..fb1278e334 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss return null; } - public List DetermineElectricArcPoints(Vector2 start, Vector2 end, int seed) + public static List DetermineElectricArcPoints(Vector2 start, Vector2 end, int seed) { List points = new List(); @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 offsetDirection = (noise * MathHelper.Pi * 0.7f).ToRotationVector2(); // Then, determine the factor of the offset. This is based on the initial direction (but squashed) and the muffle factor from above. - Vector2 offset = offsetDirection * (float)Math.Pow(offsetDirection.Y, 2D) * offsetMuffleFactor * 25f; + Vector2 offset = offsetDirection * (float)Math.Pow(offsetDirection.Y, 2D) * offsetMuffleFactor * 15f; points[i] += offset; } From 55e16f676f5ad2201d7ecf07878ecb919cfa4cb9 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 4 Nov 2021 11:22:12 -0500 Subject: [PATCH 02/57] Rotation/direction fixes --- ExtraTextures/AresArmTopPart1.png | Bin 731 -> 715 bytes NPCs/ExoMechs/Ares/AresBody.cs | 33 ++++++++++--------- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 6 ++++ NPCs/ExoMechs/Ares/AresLaserCannon.cs | 6 ++++ NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 6 ++++ NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 8 ++++- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/ExtraTextures/AresArmTopPart1.png b/ExtraTextures/AresArmTopPart1.png index fc58f490580d2ff418b8a51915c3dba420bca3dc..02b7d68335006240a9b2a93de7b82559ff145189 100644 GIT binary patch delta 614 zcmV-s0-62W1>+^=kA93N?q5};3H7>=8bly-k5 zNIOj_A+ZdFHhPMzRYz_mVqGtlbv>Ps_Em9GlyE+i64ak2WJ<;3p{0)~MH1$6zg%2P zgc;3PiIVcbNRjhqNK2elIj<{H+tEX$rJVcDcIkVBO}REoih%Un_VQxR)*{M-gYbDN z68#u^p~5Vnc-uMa@F0}9wC~NIT~yg zIrxe=>8)0WqV!DC2v^PUJ29=jr%MnL;irK%T#1w_IjDf(Nqyv2E;Rlfb9_neiItLE z|6Bu!E!^T#dGE3AIijVYl;0kc{v7=)0n+RB6Rp3FDfkVX%m4rY07*qoM6N<$g2YfA AMF0Q* delta 630 zcmV-+0*U?01=|IXNj(-4956XW9v~r@=iFhBo-;ToX6{N4M%YrXoU8Yj6-I-RN8oyh?LYc+~(NcWDMC&vSSNOAnq886M1OJ%M| z`<)_EB~tgl*Xy#Z#`Ss@kCrlcnxvd(3V^D8%FxItc$4XJAG|zwA zcB^cgclA_+KiHwhE(>C>GIO4igrS6{9WR}xc@8DV+pR@%wyGY&l#B9mc4O5Dl)5&T z87mC@%TfkKbGHfubKdueC1^*ElM+-YYjg$9q4rnK*Ub2Wc8ez&>$L%A%7KuVnPFEY&y<2t{|dH2wtYk?y}rJ^rNnuZ zGfK+lCn+zn%Z0`&YBg99sAH0~V?#<{=^^E%t)`NTBO3(qvC?TuDPCbQG>U&vv%f~u zC`O`1&^AFR1(!ZsMoERw2!rA6vfEy7o+}(y{^ry}c zB`u;jl2UDymW3nQJsWEo#z^&Y1I`h94Ydfn{Q;$p^g2e2yIiwCpjVETzQ=3$^urSn zK$D4IiR~j?^mqO>>Gv?N arm1ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm1DrawPosition, armSegmentDrawPosition, 466920161); - List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition, 250290787); - LightningBackgroundDrawer.Draw(arm1ElectricArcPoints, -Main.screenPosition, 90); - LightningDrawer.Draw(arm1ElectricArcPoints, -Main.screenPosition, 90); + List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition + arm2Rotation.ToRotationVector2() * -direction * 20f, 250290787); LightningBackgroundDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); LightningDrawer.Draw(arm2ElectricArcPoints, -Main.screenPosition, 90); @@ -925,13 +928,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares armSegmentDrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; arm2DrawPosition += Vector2.UnitY * npc.gfxOffY - Main.screenPosition; - spriteBatch.Draw(armTexture1, arm1DrawPosition, null, shoulderLightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armTexture1, arm1DrawPosition, null, arm1LightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, null, shoulderLightColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, null, glowmaskColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, null, shoulderLightColor, arm2Rotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, null, glowmaskColor, arm2Rotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armTexture2, arm2DrawPosition, null, shoulderLightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armGlowmask2, arm2DrawPosition, null, glowmaskColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, null, armSegmentLightColor, armSegmentRotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, null, glowmaskColor, armSegmentRotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armTexture2, arm2DrawPosition, null, arm2LightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armGlowmask2, arm2DrawPosition, null, glowmaskColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); } public override void BossLoot(ref string name, ref int potionType) diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 89cfc11d88..51e9218642 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -83,6 +83,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; + npc.hide = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } @@ -527,6 +528,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCProjectiles.Add(index); + } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 50869cd283..f2dc6179ba 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -81,6 +81,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; + npc.hide = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } @@ -583,6 +584,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCProjectiles.Add(index); + } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 1acc67759c..38819a20a8 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -81,6 +81,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; + npc.hide = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } @@ -511,6 +512,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCProjectiles.Add(index); + } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 1e4640db47..cb9b3fa316 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -81,6 +81,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; + npc.hide = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } @@ -508,7 +509,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares return false; } - + + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCProjectiles.Add(index); + } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) From d7d4ed41e85faf50f6a664bea1f963f33a17907f Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 4 Nov 2021 13:14:19 -0500 Subject: [PATCH 03/57] Enraged red colors --- ExtraTextures/AresArmTopSegmentGlow.png | Bin 255 -> 328 bytes ExtraTextures/AresArmTopShoulderGlow.png | Bin 487 -> 539 bytes NPCs/ExoMechs/Ares/AresBody.cs | 32 ++++++++++++++--------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ExtraTextures/AresArmTopSegmentGlow.png b/ExtraTextures/AresArmTopSegmentGlow.png index 508e7a4db16c2a9235b142c62613e731d6efc06b..f39d4cfddb86876859bf86e0e372a4c5e8e02694 100644 GIT binary patch delta 272 zcmey*c!FtyW4%g%Plzi61A}MkuFJ1;EcJ>rKioNPXZP!W!T=PdAuEM{Qf+YiEw7OcT4K*6b=E{-7<{&%ljTJ4ZM=H_fot|`-EIuErxxAxo%o8ikISKQUy>U?$k_~@ Lu6{1-oD!MTn7|*STA17cvt`A(`=TP>kNW+ z6_|0^b-Z|}f9r*I$vwl6Oowe+k9fDQRe(3fy|p=t&(TPm$W(i7912fR-_My85}Sb4q9e0I)z%82|tP diff --git a/ExtraTextures/AresArmTopShoulderGlow.png b/ExtraTextures/AresArmTopShoulderGlow.png index b23f5bdbbb9fcaf841871c75f54eb5c23880573f..9cbb1968ba8fac4e6b3986631a7bd638126e62fe 100644 GIT binary patch delta 484 zcmaFPJey^LW4%FuPlzi614FxZ*r#opp9(xJ^@?um1&hk?Z;vJ6?XB zGcjS}vJaV2z7;^l_YY271Ed5>g8YL2qXLEp%CV9_InDx)$YKTtz5^i4n02j_lYxOT z!qdeuB*Xdb^@C;23IeSUyOipMd@BBLUu&L_Retn|(cF}OqC0*TS#&(q=3XKw+h&#F zC2z%(x7ttYQu{NWEpxASh?U8_e$xNarC4tJt!WY3QPXxjopGUin_T;>i`#gXmND6W ze`vRi^=M)MyZYs3yWK}-U3hLZW!AzgJWJCwOr2NSUdTK&b-mvS&qbG?*sl9{?reQ= z5;KmFIzR8u6SNAZbGeym%X$qo7Ya+aNy4MXY~ti_`L6yGZ(rrWe59y5viu{rDgmIegCXfRazgd zKUJvB_~);2++2~a{@eUkefQR9&z&&I<@@wwJ7Y^%_f(!-XgIC+@tp6r>%@vQ#3WMI zYfsVX;*XLK5_{`;YS9k0X@UJJ7xzheoejup3o=IX4piv3h{^N(n$OH?`qDQx1H+!d M)78&qol`;+07#wZvj6}9 delta 432 zcmbQu@|<~sW4%g%Plzi614FxZ*r#opp9(w|w@mu=zrZeXUEgBI%dc}LCQMxRArq(| zExt|~Nb!^e`33(+00yD^=gtAeISV`@iy0XB4uUY_j)~cC85kH%JY5_^GMwLDzsT3D zz|;DWb4AAe|F!8$PeyFwz9^fu{a<+f(b@Wne8-zbHg)hd^Z4F$Zdc4Xxk#~ELvZoi zHLhDW7@m5RU>3M&$JK2|!!B+*s(ZX8cFR|bEj`q8$#pg`qtB^WWY*#fT2t277&TpX4StmU=j#5L9G_o~0mU$~Y z`g46x`qm4xQcTh%6Ehc{{^WGLFxJ^&bJdD7)t3MDW=#T8pV^Y@&AvPQO#LN4C0<2k zb!%NxDnqIKm&=p$m$hH3w@vnW`8VNDUAcpE#I_VhZ~nQ()); int teslaArm = NPC.FindFirstNPC(ModContent.NPCType()); int plasmaArm = NPC.FindFirstNPC(ModContent.NPCType()); + Color afterimageBaseColor = EnragedState == (float)Enraged.Yes ? Color.Red : Color.White; + Color armGlowmaskColor = afterimageBaseColor; + armGlowmaskColor.A = 184; if (laserArm != -1) - DrawArm(spriteBatch, Main.npc[laserArm].Center, -1, true); + DrawArm(spriteBatch, Main.npc[laserArm].Center, armGlowmaskColor, -1, true); if (gaussArm != -1) - DrawArm(spriteBatch, Main.npc[gaussArm].Center, 1, true); + DrawArm(spriteBatch, Main.npc[gaussArm].Center, armGlowmaskColor, 1, true); if (teslaArm != -1) - DrawArm(spriteBatch, Main.npc[teslaArm].Center, -1, false); + DrawArm(spriteBatch, Main.npc[teslaArm].Center, armGlowmaskColor, -1, false); if (plasmaArm != -1) - DrawArm(spriteBatch, Main.npc[plasmaArm].Center, 1, false); + DrawArm(spriteBatch, Main.npc[plasmaArm].Center, armGlowmaskColor, 1, false); Texture2D texture = Main.npcTexture[npc.type]; Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); - Color afterimageBaseColor = EnragedState == (float)Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; if (CalamityConfig.Instance.Afterimages) @@ -859,9 +861,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares internal Color ColorFunction(float completionRatio) { + Color baseColor1 = EnragedState == (float)Enraged.Yes ? Color.Red : Color.Cyan; + Color baseColor2 = EnragedState == (float)Enraged.Yes ? Color.IndianRed : Color.Cyan; + float fadeToWhite = MathHelper.Lerp(0f, 0.65f, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f); - Color baseColor = Color.Lerp(Color.Cyan, Color.White, fadeToWhite); - Color color = Color.Lerp(baseColor, Color.LightBlue, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * npc.Opacity; + Color baseColor = Color.Lerp(baseColor1, Color.White, fadeToWhite); + Color color = Color.Lerp(baseColor, baseColor2, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f) * npc.Opacity; color.A = 84; return color; } @@ -870,11 +875,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public Color BackgroundColorFunction(float completionRatio) { - Color color = Color.CornflowerBlue * npc.Opacity * 0.4f; + Color backgroundColor = EnragedState == (float)Enraged.Yes ? Color.Crimson : Color.CornflowerBlue; + Color color = backgroundColor * npc.Opacity * 0.4f; return color; } - public void DrawArm(SpriteBatch spriteBatch, Vector2 handPosition, int direction, bool backArm) + public void DrawArm(SpriteBatch spriteBatch, Vector2 handPosition, Color glowmaskColor, int direction, bool backArm) { if (LightningDrawer is null) LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); @@ -917,7 +923,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color arm1LightColor = npc.GetAlpha(Lighting.GetColor((int)arm1DrawPosition.X / 16, (int)arm1DrawPosition.Y / 16)); Color armSegmentLightColor = npc.GetAlpha(Lighting.GetColor((int)armSegmentDrawPosition.X / 16, (int)armSegmentDrawPosition.Y / 16)); Color arm2LightColor = npc.GetAlpha(Lighting.GetColor((int)arm2DrawPosition.X / 16, (int)arm2DrawPosition.Y / 16)); - Color glowmaskColor = npc.GetAlpha(Color.White); + Color glowmaskAlphaColor = npc.GetAlpha(glowmaskColor); // Draw electricity between arms. List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition + arm2Rotation.ToRotationVector2() * -direction * 20f, 250290787); @@ -931,11 +937,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(armTexture1, arm1DrawPosition, null, arm1LightColor, arm1Rotation, arm1Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); spriteBatch.Draw(shoulderTexture, shoulderDrawPosition, null, shoulderLightColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, null, glowmaskColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(shoulderGlowmask, shoulderDrawPosition, null, glowmaskAlphaColor, 0f, shoulderTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); spriteBatch.Draw(armSegmentTexture, armSegmentDrawPosition, null, armSegmentLightColor, armSegmentRotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); - spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, null, glowmaskColor, armSegmentRotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); + spriteBatch.Draw(armSegmentGlowmask, armSegmentDrawPosition, null, glowmaskAlphaColor, armSegmentRotation, armSegmentTexture.Size() * 0.5f, npc.scale, spriteDirection, 0f); spriteBatch.Draw(armTexture2, arm2DrawPosition, null, arm2LightColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); - spriteBatch.Draw(armGlowmask2, arm2DrawPosition, null, glowmaskColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); + spriteBatch.Draw(armGlowmask2, arm2DrawPosition, null, glowmaskAlphaColor, arm2Rotation, arm2Origin, npc.scale, spriteDirection ^ SpriteEffects.FlipVertically, 0f); } public override void BossLoot(ref string name, ref int potionType) From 00414965fd25281cfda4a37566fe05414ffec836 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 5 Nov 2021 14:58:05 -0500 Subject: [PATCH 04/57] Exo Mech lore recipes --- Items/LoreItems/KnowledgeExoMechs.cs | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Items/LoreItems/KnowledgeExoMechs.cs b/Items/LoreItems/KnowledgeExoMechs.cs index 4a7bf9f19f..da9684b23d 100644 --- a/Items/LoreItems/KnowledgeExoMechs.cs +++ b/Items/LoreItems/KnowledgeExoMechs.cs @@ -1,5 +1,8 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Furniture.Trophies; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.LoreItems { @@ -23,17 +26,36 @@ namespace CalamityMod.Items.LoreItems public override bool CanUseItem(Player player) => false; - // Requires an Exo Mechs trophy. - /* + public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); r.SetResult(this); r.AddTile(TileID.Bookcases); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddRecipe(); + + r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(TileID.Bookcases); + r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddRecipe(); + + r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(TileID.Bookcases); + r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddRecipe(); + + r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(TileID.Bookcases); + r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType(), 10); r.AddRecipe(); } - */ } } From f1ab391bada11c84c66b430b29d6c4916331464b Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 5 Nov 2021 17:22:50 -0500 Subject: [PATCH 05/57] 1 - Artemis and Apollo adjustments. --- NPCs/ExoMechs/Apollo/Apollo.cs | 15 ++++ NPCs/ExoMechs/Artemis/Artemis.cs | 144 +++++++++++++++++++++++++++---- 2 files changed, 141 insertions(+), 18 deletions(-) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 6886e5480d..ac2f792d14 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -217,12 +217,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Check if the other exo mechs are alive int otherExoMechsAlive = 0; + bool exoTwinRedAlive = false; bool exoWormAlive = false; bool exoPrimeAlive = false; if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) { + exoTwinRedAlive = true; + // Link the HP of both twins if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; @@ -298,6 +301,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (otherExoMechWasFirst) npc.ai[3] = 1f; + // Decrement the timer used to stop Artemis from firing lasers + if (npc.ai[3] > 1f) + npc.ai[3] -= 1f; + // Phases bool phase2 = lifeRatio < 0.6f; bool spawnOtherExoMechs = lifeRatio < 0.7f && npc.ai[3] == 0f; @@ -1075,6 +1082,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo chargeLocations[i] = default; ChargeComboFlash = 0f; + // Tell Apollo and Artemis to swap positions + if (npc.ai[0] < 10f) + npc.ai[0] = 10f; + npc.ai[0] += 1f; + + // Tell Artemis to not fire lasers for a short time while swapping positions + npc.ai[3] = 61f; + npc.TargetClosest(); } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 293f0967a6..e6d22332d4 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -297,10 +297,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Used to nerf Artemis laser shotgun if Apollo is in charging phase bool nerfedLaserShotgun = false; + bool canFireLasers = true; if (exoTwinGreenAlive) { nerfedLaserShotgun = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == (float)Apollo.Apollo.Phase.LineUpChargeCombo || Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == (float)Apollo.Apollo.Phase.ChargeCombo; + + // Can only fire lasers if cooldown is less than or equal to 1 + canFireLasers = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[3] <= 1f; + + // Set movement according to Apollo + if (npc.ai[0] >= 10f) + npc.ai[0] = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].ai[0]; } // Check if any of the other mechs were spawned first @@ -403,6 +411,32 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Spin variables float spinRadius = 500f; float spinLocationDistance = 50f; + Vector2 spinLocation = player.Center; + switch ((int)npc.ai[3]) + { + // Laser from top + case 0: + case 1: + spinLocation.Y -= spinRadius; + break; + + // Laser from bottom + case 2: + spinLocation.Y += spinRadius; + break; + + // Laser from left + case 3: + spinRadius *= 1.7f; + spinLocation.X -= spinRadius; + break; + + // Laser from right + case 4: + spinRadius *= 1.7f; + spinLocation.X += spinRadius; + break; + } // Distance where Artemis stops moving float movementDistanceGateValue = 100f; @@ -423,7 +457,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float laserShotgunDuration = 90f; // If Artemis can fire projectiles, cannot fire if too close to the target - bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f; + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f && canFireLasers; // Rotation Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; @@ -515,7 +549,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool flyLeft = npc.ai[0] % 2f == 0f || npc.ai[0] < 10f || !revenge; float destinationX = flyLeft ? -750f : 750f; float destinationY = player.Center.Y; - Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : AIState == (float)Phase.Deathray ? new Vector2(player.Center.X, destinationY - spinRadius) : new Vector2(player.Center.X + destinationX, destinationY); + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : AIState == (float)Phase.Deathray ? spinLocation : new Vector2(player.Center.X + destinationX, destinationY); // Add a bit of randomness to the destination, but only in specific phases where it's necessary if (AIState == (float)Phase.Normal || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.PhaseTransition) @@ -566,9 +600,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (spawnOtherExoMechs) { // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 1f; @@ -611,9 +642,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (otherMechIsBerserk) { // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -641,9 +669,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (otherMechIsBerserk) { // Reset everything - if (npc.ai[0] < 10f) - npc.ai[0] = 10f; - npc.ai[0] += 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -986,9 +1011,34 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (calamityGlobalNPC.newAI[2] == 0f) { npc.velocity = Vector2.Zero; - spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + + switch ((int)npc.ai[3]) + { + // Laser from top + case 0: + case 1: + spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + break; + + // Laser from bottom + case 2: + spinningPoint = npc.Center - Vector2.UnitY * spinRadius; + break; + + // Laser from left + case 3: + spinningPoint = npc.Center + Vector2.UnitX * spinRadius; + break; + + // Laser from right + case 4: + spinningPoint = npc.Center - Vector2.UnitX * spinRadius; + break; + } + npc.ai[1] = spinningPoint.X; npc.ai[2] = spinningPoint.Y; + if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); @@ -997,6 +1047,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 offset = laserVelocity * 70f; Projectile.NewProjectile(npc.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); } + npc.netUpdate = true; } @@ -1007,12 +1058,41 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (rotationDirection == 0) { // Set spin direction - if (Main.player[npc.target].velocity.X > 0f) - rotationDirection = 1; - else if (Main.player[npc.target].velocity.X < 0f) - rotationDirection = -1; - else - rotationDirection = player.direction; + switch ((int)npc.ai[3]) + { + // Laser from top + case 0: + case 1: + if (player.Center.X >= npc.Center.X) + rotationDirection = 1; + else + rotationDirection = -1; + break; + + // Laser from bottom + case 2: + if (player.Center.X >= npc.Center.X) + rotationDirection = -1; + else + rotationDirection = 1; + break; + + // Laser from left + case 3: + if (player.Center.Y >= npc.Center.Y) + rotationDirection = -1; + else + rotationDirection = 1; + break; + + // Laser from right + case 4: + if (player.Center.Y >= npc.Center.Y) + rotationDirection = 1; + else + rotationDirection = -1; + break; + } // Set spin velocity spinVelocity.X = MathHelper.Pi * spinRadius / spinTime; @@ -1087,8 +1167,36 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis AIState = (float)Phase.Normal; npc.ai[1] = 0f; npc.ai[2] = 0f; + if (revenge) + { + // Can use all 4 types of lasers in rev+ + switch ((int)npc.ai[3]) + { + case 0: + case 1: + npc.ai[3] = 3f + Main.rand.Next(2); + break; + case 2: + npc.ai[3] = 3f + Main.rand.Next(2); + break; + case 3: + npc.ai[3] = 1f + Main.rand.Next(2); + break; + case 4: + npc.ai[3] = 1f + Main.rand.Next(2); + break; + } + } + else if (expertMode) + { + // Can only use the top and bottom lasers in expert + npc.ai[3] += 1f; + if (npc.ai[3] > 2f) + npc.ai[3] = 1f; + } npc.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; + npc.netUpdate = true; } break; From e04a17e7d4e1c8ea1fe876cd29a2ccbb293e8e30 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 5 Nov 2021 17:57:28 -0500 Subject: [PATCH 06/57] 1 - God Slayer Dash cooldown increased to 35 seconds. 2 - Thanatos resists true melee by 65%. 3 - Ares resists Murasama by 50%. --- CalPlayer/CalamityPlayer.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 48e356982f..c11fc4a73a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -8833,7 +8833,7 @@ namespace CalamityMod.CalPlayer // Cooldown for God Slayer Armor dash if (dashMod == 9) { - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f)); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(35f)); godSlayerDashHotKeyPressed = false; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a46b9c0f82..716e2d7c25 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3364,7 +3364,7 @@ namespace CalamityMod.NPCs AstrumDeusIDs.Contains(npc.type) || StormWeaverIDs.Contains(npc.type) || ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || AresIDs.Contains(npc.type)) { - double damageMult = AresIDs.Contains(npc.type) ? 0.75 : 0.5; + double damageMult = AresIDs.Contains(npc.type) ? 0.75 : ThanatosIDs.Contains(npc.type) ? 0.35 : 0.5; if (item.melee && item.type != ItemType() && item.type != ItemType()) damage = (int)(damage * damageMult); } @@ -3493,9 +3493,9 @@ namespace CalamityMod.NPCs if (AresIDs.Contains(npc.type)) { - // 25% resist to true melee. + // 25% resist to true melee and 50% resist to Murasama. if (projectile.Calamity().trueMelee) - damage = (int)(damage * 0.75); + damage = (int)(damage * (projectile.type == ProjectileType() ? 0.5 : 0.75)); // 20% resist to Eclipse's Fall stealth strike. else if (projectile.type == ProjectileType()) @@ -3513,9 +3513,9 @@ namespace CalamityMod.NPCs if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.25); - // 50% resist to true melee. + // 65% resist to true melee. else if (projectile.Calamity().trueMelee) - damage = (int)(damage * 0.5); + damage = (int)(damage * 0.35); // 40% resist to Wrathwing stealth strike. else if (projectile.type == ProjectileType()) From 3409c84755571585ba04b04bf3be6c92c5110114 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 19:38:55 -0400 Subject: [PATCH 07/57] Deathhail Staff is no longer busted --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Items/Weapons/Magic/DeathhailStaff.cs | 14 +++++++------- .../Magic/{MagicNebulaShot.cs => DeathhailBeam.cs} | 9 ++++----- 3 files changed, 12 insertions(+), 13 deletions(-) rename Projectiles/Magic/{MagicNebulaShot.cs => DeathhailBeam.cs} (88%) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f15d53a867..3a282d3959 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3700,7 +3700,7 @@ namespace CalamityMod.CalPlayer velocity.Y *= travelDist; velocity.X += Main.rand.Next(-50, 51) * 0.02f; velocity.Y += Main.rand.Next(-50, 51) * 0.02f; - int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, 0f); + int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, 0f); Main.projectile[laser].localNPCHitCooldown = 5; if (laser.WithinBounds(Main.maxProjectiles)) Main.projectile[laser].Calamity().forceTypeless = true; diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index af14db8a61..52a464e690 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 155; + item.damage = 328; item.magic = true; - item.mana = 12; + item.mana = 16; item.width = 80; item.height = 84; - item.useTime = 8; - item.useAnimation = 16; + item.useTime = 11; + item.useAnimation = 22; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.DarkBlue; item.UseSound = SoundID.Item12; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; } @@ -78,8 +78,8 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; } - int num107 = 2; - for (int num108 = 0; num108 < num107; num108++) + int numLasers = 2; + for (int num108 = 0; num108 < numLasers; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(91) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); diff --git a/Projectiles/Magic/MagicNebulaShot.cs b/Projectiles/Magic/DeathhailBeam.cs similarity index 88% rename from Projectiles/Magic/MagicNebulaShot.cs rename to Projectiles/Magic/DeathhailBeam.cs index 1f577d71d8..289cffef6d 100644 --- a/Projectiles/Magic/MagicNebulaShot.cs +++ b/Projectiles/Magic/DeathhailBeam.cs @@ -1,16 +1,15 @@ using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class MagicNebulaShot : BaseLaserbeamProjectile + public class DeathhailBeam : BaseLaserbeamProjectile { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; private Color startingColor = new Color(119, 210, 255); private Color secondColor = new Color(247, 119, 255); @@ -25,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - DisplayName.SetDefault("Nebula Shot"); + DisplayName.SetDefault("Deathhail"); } public override void SetDefaults() @@ -35,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = -1; projectile.usesLocalNPCImmunity = true; } From f5459c1645e9f49cb33439a6afc172474b3ef486 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 19:44:16 -0400 Subject: [PATCH 08/57] eradicator fucking dies --- Items/Weapons/Rogue/Eradicator.cs | 7 +++++-- Projectiles/Rogue/EradicatorProjectile.cs | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index b38ffc38fe..9e064b86dd 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 38; - item.damage = 685; + item.damage = 640; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -42,11 +42,14 @@ 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) { if (player.Calamity().StealthStrikeAvailable()) - damage = (int)(damage * 0.25f); + damage = (int)(damage * 0.5f); int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].timeLeft += EradicatorProjectile.StealthExtraLifetime; Main.projectile[proj].Calamity().stealthStrike = true; + } return false; } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index ce62d4384f..deb743419e 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Rogue { public override string Texture => "CalamityMod/Items/Weapons/Rogue/Eradicator"; private const float RotationIncrement = 0.09f; - private const int Lifetime = 230; + private const int Lifetime = 350; + public const int StealthExtraLifetime = 60; // 2 extra updates means this is half a second private const float ReboundTime = 40f; private float randomLaserCharge = 0f; From bb268a7f2c105117a55a6cf1d06875c3975b034f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 19:47:45 -0400 Subject: [PATCH 09/57] slight buff to drat left click, nerf to drat right click --- Items/Weapons/Ranged/Drataliornus.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index d9854cea93..444132b718 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -12,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Drataliornus : ModItem { + private const double RightClickDamageRatio = 0.6; + public override void SetStaticDefaults() { DisplayName.SetDefault("Drataliornus"); @@ -24,7 +24,7 @@ Right click to fire two devastating barrages of five empowered fireballs. public override void SetDefaults() { - item.damage = 124; + item.damage = 129; item.knockBack = 1f; item.shootSpeed = 18f; item.useStyle = ItemUseStyleID.HoldingOut; @@ -61,10 +61,10 @@ Right click to fire two devastating barrages of five empowered fireballs. else { item.noUseGraphic = true; - if (player.ownedProjectileCounts[item.shoot] > 0) - { + if (player.ownedProjectileCounts[item.shoot] > 0) + { return false; - } + } } return base.CanUseItem(player); } @@ -73,16 +73,19 @@ Right click to fire two devastating barrages of five empowered fireballs. { if (player.altFunctionUse == 2) //tsunami { + int flameID = ModContent.ProjectileType(); + const int numFlames = 5; + int flameDamage = (int)(damage * RightClickDamageRatio); + const float num3 = 0.471238898f; - const int num4 = 5; Vector2 spinningpoint = new Vector2(speedX, speedY); spinningpoint.Normalize(); spinningpoint *= 36f; - for (int index1 = 0; index1 < num4; ++index1) + for (int index1 = 0; index1 < numFlames; ++index1) { - float num8 = index1 - (num4 - 1) / 2; + float num8 = index1 - (numFlames - 1) / 2; Vector2 vector2_5 = spinningpoint.RotatedBy(num3 * num8, new Vector2()); - Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.69), knockBack, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, flameID, flameDamage, knockBack, player.whoAmI, 1f, 0f); } } else From faec1db9b5904c8f4a63ee4d187ca92f80d59a35 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 19:52:49 -0400 Subject: [PATCH 10/57] 1 - Dragon's Breath 272 -> 198 2 - Minigun 390 -> 275 --- Items/Weapons/Ranged/DragonsBreath.cs | 2 +- Items/Weapons/Ranged/Minigun.cs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index e46d503b62..3d0a2a90e0 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 272; + item.damage = 198; item.ranged = true; item.width = 64; item.height = 28; diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 0ceb575b93..bb7bedd8bb 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 390; + item.damage = 275; item.ranged = true; item.width = 72; item.height = 34; @@ -50,12 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.8f; public override void AddRecipes() { From 5ef2b98b5b6a09b7b6ee97cd4f0a15480cbf60fc Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 19:57:21 -0400 Subject: [PATCH 11/57] Thanatos resists GSS and Luminite bullets by 15% and Chicken Cannon by 50% --- NPCs/CalamityGlobalNPC.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 716e2d7c25..b2c3198a33 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3517,6 +3517,10 @@ namespace CalamityMod.NPCs else if (projectile.Calamity().trueMelee) damage = (int)(damage * 0.35); + // 50% resist to Chicken Cannon. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + // 40% resist to Wrathwing stealth strike. else if (projectile.type == ProjectileType()) damage = (int)(damage * 0.6); @@ -3524,6 +3528,11 @@ namespace CalamityMod.NPCs // 25% resist to Eradicator beams. else if (projectile.type == ProjectileType()) damage = (int)(damage * 0.75); + + // 15% resist to God Slayer Slugs and Luminite Bullets. + else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType()) + damage = (int)(damage * 0.85); + } else if (npc.type == NPCType()) { From e1b6f0a9bb305534f756676f665533fabd3fc86f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 21:14:08 -0400 Subject: [PATCH 12/57] 1 - Condemnation 566 -> 1914 2 - Condemnation left click reworked heavily. Now caps at 8 arrows; arrow load rate increases slightly exponentially. 3 - Condemnation no longer has damage or use time multipliers. Left click and right click arrows do equal damage. 4 - Condemnation left click load speed now benefits from speed reforges. 5 - Condemnation makes sounds and particle effects to indicate each arrow is loaded. Upon reaching 8 it makes the Max Mana plink sound. --- Items/Weapons/Ranged/Condemnation.cs | 19 +++-- Projectiles/Ranged/CondemnationArrow.cs | 6 +- Projectiles/Ranged/CondemnationArrowHoming.cs | 2 +- Projectiles/Ranged/CondemnationHoldout.cs | 84 ++++++++++++------- 4 files changed, 70 insertions(+), 41 deletions(-) diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 0e1ac58cf0..2a572a8534 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -8,20 +8,23 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Condemnation : ModItem { + public const int MaxLoadedArrows = 8; + public override void SetStaticDefaults() { DisplayName.SetDefault("Condemnation"); - Tooltip.SetDefault("Left clicks allows you to charge the repeater and release more arrows the longer the charge lasts\n" + - "Right clicks release fast moving arrows"); + Tooltip.SetDefault("Fires powerful scarlet bolts suffused with hateful magics\n" + + "Hold left click to load up to eight bolts for powerful burst fire\n" + + "Hold right click to use the repeater full auto"); } public override void SetDefaults() { - item.damage = 566; + item.damage = 1914; item.ranged = true; item.width = 130; item.height = 42; - item.useTime = item.useAnimation = 16; + item.useTime = item.useAnimation = 23; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; @@ -32,8 +35,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14.5f; item.useAmmo = AmmoID.Arrow; - item.Calamity().canFirePointBlankShots = true; - } + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() => new Vector2(-50f, 0f); @@ -57,8 +60,6 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.7f : 1f; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 shootVelocity = new Vector2(speedX, speedY); @@ -73,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Charge-up. Done via a holdout projectile. else - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), 0, knockBack, player.whoAmI); + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } } diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index 9417892842..a0dc182db4 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Ranged public ref float Time => ref projectile.ai[0]; public override void SetStaticDefaults() { - DisplayName.SetDefault("Condemnation Arrow"); + DisplayName.SetDefault("Condemning Arrow"); ProjectileID.Sets.TrailingMode[projectile.type] = 1; ProjectileID.Sets.TrailCacheLength[projectile.type] = 9; } @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.extraUpdates = 1; projectile.timeLeft = 300; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 14d7acf2b3..749f556b2e 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public ref float Time => ref projectile.ai[0]; public override void SetStaticDefaults() { - DisplayName.SetDefault("Condemnation Arrow"); + DisplayName.SetDefault("Condemning Echo"); ProjectileID.Sets.TrailingMode[projectile.type] = 1; ProjectileID.Sets.TrailCacheLength[projectile.type] = 9; } diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 1ac21ab858..4bb1b99836 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -1,5 +1,5 @@ +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,10 @@ namespace CalamityMod.Projectiles.Ranged { public Player Owner => Main.player[projectile.owner]; public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - public ref float ChargeUpTime => ref projectile.ai[0]; + public ref float CurrentChargingFrames => ref projectile.ai[0]; + public ref float ArrowsLoaded => ref projectile.ai[1]; + public ref float FramesToLoadNextArrow => ref projectile.localAI[0]; + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Condemnation"; public override void SetStaticDefaults() => DisplayName.SetDefault("Condemnation"); @@ -28,38 +31,62 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; - if (ChargeUpTime < 20f) - ReleaseInitialChargeDust(tipPosition); - if (ChargeUpTime == 20f) - ReleaseInitialBurstDust(tipPosition); - // Release projectiles after done charging. + // Fire arrows if the owner stops channeling or otherwise cannot use the weapon. if (!OwnerCanShoot) { - projectile.Kill(); - - // If killed prior to the charge being complete, don't bother spawning anything. Just die. - if (ChargeUpTime < 20f) + // No arrows left to shoot? The bow disappears. + if (ArrowsLoaded <= 0f) + { + projectile.Kill(); return; + } - int totalProjectilesToShoot = (int)Math.Pow(ChargeUpTime * 0.15f, 0.71) + 1; - if (totalProjectilesToShoot > 32) - totalProjectilesToShoot = 32; - - for (int i = 0; i < totalProjectilesToShoot; i++) - ShootProjectiles(tipPosition, MathHelper.Lerp(0.425f, 1f, i / (float)totalProjectilesToShoot)); - + // Fire one charged arrow every frame until you're out of arrows. + ShootProjectiles(tipPosition, 1f); + --ArrowsLoaded; Main.PlaySound(SoundID.DD2_BallistaTowerShot); } + else + { + + // Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows. + if (FramesToLoadNextArrow == 0f) + FramesToLoadNextArrow = Owner.ActiveItem().useAnimation; + + // Actually make progress towards loading more arrows. + ++CurrentChargingFrames; + + // If no arrows are loaded, spawn a bit of dust to indicate it's not ready yet. + // Spawn the same dust if the max number of arrows have been loaded. + if (ArrowsLoaded <= 0f || ArrowsLoaded >= Condemnation.MaxLoadedArrows) + SpawnCannotLoadArrowsDust(tipPosition); + + // If it is time to load an arrow, produce a pulse of dust and add an arrow. + // Also accelerate charging, because it's fucking awesome. + if (CurrentChargingFrames >= FramesToLoadNextArrow && ArrowsLoaded < Condemnation.MaxLoadedArrows) + { + SpawnArrowLoadedDust(tipPosition); + CurrentChargingFrames = 0f; + ++ArrowsLoaded; + --FramesToLoadNextArrow; + + // Play a sound for additional notification that an arrow has been loaded. + var loadSound = Main.PlaySound(SoundID.Item108); + if (loadSound != null) + loadSound.Volume *= 0.3f; + + if (ArrowsLoaded >= Condemnation.MaxLoadedArrows) + Main.PlaySound(SoundID.MaxMana); + } + } UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); - ChargeUpTime++; } - public void ReleaseInitialBurstDust(Vector2 tipPosition) + public void SpawnArrowLoadedDust(Vector2 tipPosition) { if (Main.dedServ) return; @@ -74,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged } } - public void ReleaseInitialChargeDust(Vector2 tipPosition) + public void SpawnCannotLoadArrowsDust(Vector2 tipPosition) { if (Main.dedServ) return; @@ -90,24 +117,25 @@ namespace CalamityMod.Projectiles.Ranged } public void ShootProjectiles(Vector2 tipPosition, float speedFactor) - { + { if (Main.myPlayer != projectile.owner) return; Item heldItem = Owner.ActiveItem(); - int projectileType = ModContent.ProjectileType(); + // calculate damage at the instant this arrow is fired + int arrowDamage = (int)(heldItem.damage * Owner.RangedDamage()); float shootSpeed = heldItem.shootSpeed * speedFactor * 1.5f; - int damage = (int)(Owner.GetWeaponDamage(heldItem) * 1.45); float knockback = heldItem.knockBack; bool uselessFuckYou = OwnerCanShoot; - Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref damage, ref knockback, false); + int projectileType = 0; + Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref arrowDamage, ref knockback, false); projectileType = ModContent.ProjectileType(); knockback = Owner.GetWeaponKnockback(heldItem, knockback); Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; - Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, damage, knockback, projectile.owner, 0f, 0f); + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, arrowDamage, knockback, projectile.owner, 0f, 0f); } public void UpdateProjectileHeldVariables(Vector2 armPosition) @@ -133,7 +161,7 @@ namespace CalamityMod.Projectiles.Ranged } public void ManipulatePlayerVariables() - { + { Owner.ChangeDir(projectile.direction); Owner.heldProj = projectile.whoAmI; Owner.itemTime = 2; From 14c6062dd8c73703b7f24cb587812c7024679049 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 21:21:29 -0400 Subject: [PATCH 13/57] Thanatos has a 65% resist to Hadopelagic Echo. --- NPCs/CalamityGlobalNPC.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b2c3198a33..27d1a4bffc 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3513,8 +3513,8 @@ namespace CalamityMod.NPCs if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.25); - // 65% resist to true melee. - else if (projectile.Calamity().trueMelee) + // 65% resist to true melee and Hadopelagic Echo. + else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) damage = (int)(damage * 0.35); // 50% resist to Chicken Cannon. From c89f05b833966303ca4019a10e1bb2543cc96540 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 21:22:29 -0400 Subject: [PATCH 14/57] Initial nerfs to Daawnlight Spirit Origin. Should be about 1/2 as powerful. --- Items/Accessories/DaawnlightSpiritOrigin.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 458100ccb3..1d8e2ec119 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -11,17 +11,15 @@ namespace CalamityMod.Items.Accessories { public class DaawnlightSpiritOrigin : ModItem { - // Despite the seemingly insane numbers here, I think this item might actually be underpowered - // I left all the numbers easily accessible so it can be quickly rebalanced - // Regular crits can be intentionally weak; bullseyes should be doing all the work - // If the item is too weak, increase BullseyeCritRatio (originally 3.8f) until bullseyes are doing enough damage - // - Ozzatron + // "Despite the seemingly insane numbers here, I think this item might actually be underpowered" + // hindsight: the item was not underpowered. Ozzatron 05NOV2021 // - private const float BullseyeCritRatio = 3.8f; // Bullseye crits deal x3.8 damage instead of x2. - private const float StoredCritConversionRatio = 0.02f; // Add +2% more damage to crits for every 1% critical chance the player would have had. + // Regular crits are intentionally weak; bullseyes should be doing all the work + private const float BullseyeCritRatio = 3.5f; // Bullseye crits deal x3.5 damage instead of x2. + private const float StoredCritConversionRatio = 0.01f; // Add +1% more damage to crits for every 1% critical chance the player would have had. private const float MinUseTimeForSlowBonus = 11f; private const float MaxSlowBonusUseTime = 72f; - private const float MaxSlowWeaponBonus = 0.96f; // Up to +96% more damage to crits for slower weapons. + private const float MaxSlowWeaponBonus = 0.33f; // Up to +33% more damage to crits for slower weapons. internal static float GetDamageMultiplier(Player p, CalamityPlayer mp, bool hitBullseye) { From 57912a05e2fdce529e871a55ffb923519b493af2 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 5 Nov 2021 21:56:40 -0400 Subject: [PATCH 15/57] Malice has a warning tooltip for its incredible difficulty. --- Items/DifficultyItems/Malice.cs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs index 540b47936f..a88cc5169b 100644 --- a/Items/DifficultyItems/Malice.cs +++ b/Items/DifficultyItems/Malice.cs @@ -17,21 +17,25 @@ namespace CalamityMod.Items.DifficultyItems { DisplayName.SetDefault("Malice"); Tooltip.SetDefault("Enables/disables Malice Mode.\n" + + // Overall description and warning lines + "[c/c01818:This mode is intentionally extremely hard. You should prepare as much as possible.]\n" + + "[c/c01818:You will need to master a boss inside and out to defeat it on-tier.]\n" + + "All Challenge Drops and Legendary Challenge Drops from this mode are 100% guaranteed.\n\n" + - // Misc lines - "Greatly nerfs the effectiveness of life steal.\n" + - "Nerfs the effectiveness of the Titanium Armor set bonus, doesn't stack with Revengeance Mode.\n" + - "The Nurse no longer heals you while a boss is alive.\n" + - "Defense damage is 5% higher than Death Mode.\n" + - "Increases damage done by 50% for several debuffs and all alcohols that reduce life regen.\n" + + // Misc lines + "Greatly nerfs the effectiveness of life steal.\n" + + "Nerfs the effectiveness of the Titanium Armor set bonus, doesn't stack with Revengeance Mode.\n" + + "The Nurse no longer heals you while a boss is alive.\n" + + "Defense damage is 5% higher than Death Mode.\n" + + "Increases damage done by 50% for several debuffs and all alcohols that reduce life regen.\n" + - // Boss lines - "All boss minions no longer drop hearts.\n" + - "Gives every boss a new enraged AI and allows them to drop special items.\n" + - "Bosses and their projectiles deal 35% more damage.\n" + - "Most bosses will enter later phases sooner if the fight has gone on for a long time.\n" + - "Increases the velocity of most boss projectiles by 25%, this is increased to 35% during Boss Rush.\n" + - "Boss reactive DR is always active outside of Boss Rush and is increased by 50%."); + // Boss lines + "All boss minions no longer drop hearts.\n" + + "Gives every boss a new enraged AI and allows them to drop special items.\n" + + "Bosses and their projectiles deal 35% more damage.\n" + + "Most bosses will enter later phases sooner if the fight has gone on for a long time.\n" + + "Increases the velocity of most boss projectiles by 25%, this is increased to 35% during Boss Rush.\n" + + "Boss reactive DR is always active outside of Boss Rush and is increased by 50%."); } public override void SetDefaults() From 78303b0ce955f5288b957fe5b067f4dd93bf0d70 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 5 Nov 2021 22:00:50 -0500 Subject: [PATCH 16/57] 1 - Thanatos increases velocity the further he is away from the target. --- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 5c5785dcb1..4f7a8ad9d6 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -446,6 +446,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos destination += new Vector2(0f, 2400f); } + // Distance from target + float distanceFromTarget = Vector2.Distance(npc.Center, destination); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 500f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + // Charge variables float turnDistance = baseTurnDistance; float chargeLocationDistance = turnDistance * 0.2f; @@ -462,6 +474,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Increase top velocity if target is dead or if Thanatos is uncoiling if (targetDead || speedUp) baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.25f : 1f); @@ -484,9 +498,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : berserk ? 0.02f : 0.01f; float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; - // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, destination); - // Passive and Immune phases switch ((int)SecondaryAIState) { From 5f416afd1f0de27c3629ea72647f0372cdff2663 Mon Sep 17 00:00:00 2001 From: Merkalto Date: Fri, 5 Nov 2021 22:15:01 -0500 Subject: [PATCH 17/57] Rewrote implied universal challenge drops line. --- Items/DifficultyItems/Malice.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs index a88cc5169b..40864a0558 100644 --- a/Items/DifficultyItems/Malice.cs +++ b/Items/DifficultyItems/Malice.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.DifficultyItems // Overall description and warning lines "[c/c01818:This mode is intentionally extremely hard. You should prepare as much as possible.]\n" + "[c/c01818:You will need to master a boss inside and out to defeat it on-tier.]\n" + - "All Challenge Drops and Legendary Challenge Drops from this mode are 100% guaranteed.\n\n" + + "While enabled, bosses will drop Challenge and Legendary Challenge items.\n" + // Misc lines "Greatly nerfs the effectiveness of life steal.\n" + From efbd69096a22642d52620a07ce85d51f3209c1db Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 6 Nov 2021 01:06:01 -0500 Subject: [PATCH 18/57] 1 - Removed some rather unnecessary run speed/acceleration boosts. 2 - Post-ML mage armors give an extra 10% magic damage because of the magic power nerf. --- CalPlayer/CalamityPlayer.cs | 6 ------ Items/Armor/AuricTeslaHelm.cs | 3 +-- Items/Armor/AuricTeslaHoodedFacemask.cs | 3 +-- Items/Armor/AuricTeslaPlumedHelm.cs | 1 - Items/Armor/AuricTeslaSpaceHelmet.cs | 2 +- Items/Armor/AuricTeslaWireHemmedVisage.cs | 6 +++--- Items/Armor/BloodflareHornedMask.cs | 4 ++-- Items/Armor/PrismaticHelmet.cs | 4 ++-- Items/Armor/SilvaMaskedCap.cs | 4 ++-- Items/Armor/TarragonMask.cs | 4 ++-- Items/Placeables/Furniture/BlueCandle.cs | 2 +- NPCs/ExoMechs/Apollo/Apollo.cs | 3 --- 12 files changed, 15 insertions(+), 27 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c11fc4a73a..51a2586638 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4047,12 +4047,9 @@ namespace CalamityMod.CalPlayer ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + - (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + @@ -4064,12 +4061,9 @@ namespace CalamityMod.CalPlayer ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + - (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 1ee38c876c..a905a20cd4 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "Melee Tarragon, Bloodflare and God Slayer effects\n" + "Enemies are more likely to target you\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; + "All projectiles spawn healing auric orbs on enemy hits"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index de65feb360..ddf27452c1 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -39,8 +39,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Ranged Tarragon, Bloodflare and God Slayer armor effects\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; + "All projectiles spawn healing auric orbs on enemy hits"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraRanged = true; diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index c106bf807f..43ce5c8dd7 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor { player.setBonus = "Rogue Tarragon, Bloodflare and God Slayer armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 130\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 1de4379692..0afefd77ca 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "Summoner Tarragon, Bloodflare and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + + "Max run speed and acceleration boosted by 5%\n" + "+6 max minions and 90% increased minion damage"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index d6b19304f2..92f44f24dc 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Wire-Hemmed Visage"); - Tooltip.SetDefault("20% increased magic damage and critical strike chance, +100 max mana, and 20% reduced mana usage\n" + + Tooltip.SetDefault("30% increased magic damage, 20% increased magic critical strike chance, +100 max mana and 20% reduced mana usage\n" + "Not moving boosts all damage and critical strike chance"); } @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "Magic Tarragon, Bloodflare and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; + "Max run speed and acceleration boosted by 5%"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMage = true; @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; player.manaCost *= 0.8f; - player.magicDamage += 0.2f; + player.magicDamage += 0.3f; player.magicCrit += 20; player.statManaMax2 += 100; } diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 248aa660ec..fafd8cfc4e 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Hydra Hood"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased magic damage and critical strike chance, +100 max mana, and 17% reduced mana usage"); + "20% increased magic damage, 10% increased magic critical strike chance, +100 max mana and 17% reduced mana usage"); } public override void SetDefaults() @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Armor player.manaCost *= 0.83f; player.lavaMax += 240; player.ignoreWater = true; - player.magicDamage += 0.1f; + player.magicDamage += 0.2f; player.magicCrit += 10; player.statManaMax2 += 100; } diff --git a/Items/Armor/PrismaticHelmet.cs b/Items/Armor/PrismaticHelmet.cs index 4dcae5b085..79380ab3cb 100644 --- a/Items/Armor/PrismaticHelmet.cs +++ b/Items/Armor/PrismaticHelmet.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Prismatic Helmet"); - Tooltip.SetDefault("8% increased magic damage and 12% increased magic crit\n" + + Tooltip.SetDefault("18% increased magic damage and 12% increased magic crit\n" + "20% decreased non-magic damage\n" + "Enemies with less than 500 max health deal no contact damage\n" + "This does not occur while a boss is alive"); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor player.Calamity().prismaticHelmet = true; player.allDamage -= 0.2f; player.magicDamage += 0.2f; - player.magicDamage += 0.08f; + player.magicDamage += 0.18f; player.magicCrit += 12; } diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index cf23909ece..e48c218a3b 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Masked Cap"); - Tooltip.SetDefault("13% increased magic damage and critical strike chance\n" + + Tooltip.SetDefault("23% increased magic damage and 13% increased magic critical strike chance\n" + "+100 max mana and 19% reduced mana usage"); } @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.manaCost *= 0.81f; - player.magicDamage += 0.13f; + player.magicDamage += 0.23f; player.magicCrit += 13; player.statManaMax2 += 100; } diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 1f7b49b661..65a33572fe 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Tarragon Mask"); Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids\n" + - "10% increased magic damage and critical strike chance\n" + + "20% increased magic damage and 10% increased magic critical strike chance\n" + "5% increased damage reduction, +100 max mana, and 15% reduced mana usage"); } @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.manaCost *= 0.85f; - player.magicDamage += 0.1f; + player.magicDamage += 0.2f; player.magicCrit += 10; player.endurance += 0.05f; player.lavaMax += 240; diff --git a/Items/Placeables/Furniture/BlueCandle.cs b/Items/Placeables/Furniture/BlueCandle.cs index e0a2a7009a..d45fe295f7 100644 --- a/Items/Placeables/Furniture/BlueCandle.cs +++ b/Items/Placeables/Furniture/BlueCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { DisplayName.SetDefault("Weightless Candle"); - Tooltip.SetDefault("When placed, nearby players gain 10% movement speed, 10% wing time, and 5% acceleration\n" + + Tooltip.SetDefault("When placed, nearby players gain 10% movement speed, 10% wing time and 5% acceleration\n" + "'The floating flame seems to uplift your very spirit'"); } diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index ac2f792d14..18e933730f 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -217,15 +217,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Check if the other exo mechs are alive int otherExoMechsAlive = 0; - bool exoTwinRedAlive = false; bool exoWormAlive = false; bool exoPrimeAlive = false; if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) { - exoTwinRedAlive = true; - // Link the HP of both twins if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; From 9df14cc8f32e887278067e545c9d0a7203734b10 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 6 Nov 2021 01:30:45 -0500 Subject: [PATCH 19/57] 1 - Apollo fireballs are slower. 2 - Apollo split shots take more time to reach full speed. 3 - Artemis laser shotgun spreads have more downtime between them when in final phase. --- NPCs/ExoMechs/Apollo/Apollo.cs | 4 ++-- NPCs/ExoMechs/Artemis/Artemis.cs | 2 +- Projectiles/Boss/AresPlasmaBolt.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 18e933730f..98d795141a 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -404,7 +404,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float chargeTime = (float)chargeDistance / chargeVelocity; // Plasma and rocket projectile velocities - float projectileVelocity = 14f; + float projectileVelocity = 12f; if (lastMechAlive) projectileVelocity *= 1.2f; else if (berserk) @@ -865,7 +865,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(SoundID.Item36, npc.Center); - Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; + Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity * 1.2f; Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; Projectile.NewProjectile(npc.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index e6d22332d4..66d6f940d1 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -454,7 +454,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; // Laser shotgun variables - float laserShotgunDuration = 90f; + float laserShotgunDuration = lastMechAlive ? 120f : 90f; // If Artemis can fire projectiles, cannot fire if too close to the target bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f && canFireLasers; diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index ec39b0d058..0d55b8a7fa 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -39,11 +39,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // 23 frames starting at 0.5 - // 18 frames starting at 1 + // 22 frames starting at 0.5 + // 17 frames starting at 1 if (projectile.velocity.Length() < maxVelocity) { - projectile.velocity *= 1.15f; + projectile.velocity *= 1.075f; if (projectile.velocity.Length() > maxVelocity) { projectile.velocity.Normalize(); From 53bbf03de1e6f325ee186707de3d43ec52db36e7 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 6 Nov 2021 04:28:48 -0500 Subject: [PATCH 20/57] 1 - Reduced Old Duke Sharkron velocity. 2 - Reduced Old Duke Tooth Ball and split teeth velocity. --- NPCs/OldDuke/OldDukeSharkron.cs | 4 ++-- NPCs/OldDuke/OldDukeToothBall.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 250e81f5e2..8286fa9b58 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.OldDuke aiGateValue -= extraTime * 0.3f; float explodeIntoGoreGateValue = aiGateValue + extraTime; float fallDownGateValue = aiGateValue + extraTime * 0.5f; - float maxVelocity = malice ? 25f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + float maxVelocity = malice ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; if (npc.ai[0] == 0f) { @@ -138,7 +138,7 @@ namespace CalamityMod.NPCs.OldDuke Vector2 vector17 = Main.player[npc.target].Center - npc.Center; vector17.Normalize(); vector17 *= scaleFactor2; - float inertia = malice ? 15f : death ? 18f : revenge ? 20f : expertMode ? 22f : 25f; + float inertia = malice ? 16f : death ? 18f : revenge ? 20f : expertMode ? 22f : 25f; npc.velocity = (npc.velocity * (inertia - 1f) + vector17) / inertia; npc.velocity.Normalize(); npc.velocity *= scaleFactor2; diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 8f9d17ce3f..1083604ba9 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.OldDuke float num1372 = death ? 14f : revenge ? 13f : 12f; if (expertMode || malice) { - float speedUpMult = BossRushEvent.BossRushActive ? 0.02f : CalamityWorld.malice ? 0.015f : 0.01f; + float speedUpMult = BossRushEvent.BossRushActive ? 0.015f : CalamityWorld.malice ? 0.0125f : 0.01f; num1372 += Vector2.Distance(player.Center, npc.Center) * speedUpMult; } @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.OldDuke npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; } - float num1247 = CalamityWorld.malice ? 0.75f : 0.5f; + float num1247 = CalamityWorld.malice ? 0.65f : 0.5f; for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) { if (Main.npc[num1248].active) @@ -227,7 +227,7 @@ namespace CalamityMod.NPCs.OldDuke int damage = Main.expertMode ? 55 : 70; for (int k = 0; k < totalProjectiles; k++) { - float velocity = Main.rand.Next(7, 11); + float velocity = (CalamityWorld.malice || BossRushEvent.BossRushActive) ? Main.rand.Next(6, 10) : Main.rand.Next(7, 11); Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 360; From ca098b9bfe593a3c0e8099d21b1a4124a057f105 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 6 Nov 2021 23:14:21 -0400 Subject: [PATCH 21/57] Helium Flash 3875 -> 3474 --- Items/Weapons/Magic/HeliumFlash.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index c55133f9b7..9b7581ff0f 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 112; item.height = 112; item.magic = true; - item.damage = 3875; + item.damage = 3474; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; From ae27bb4f842529d638dcc1f31a3c5a23c777c973 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:02:08 -0400 Subject: [PATCH 22/57] Unnerfed vanilla Laser Machinegun. May be overpowered vs Duke though. --- Items/CalamityGlobalItem.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 95f7dcbfd1..b49c59f644 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -684,10 +684,6 @@ namespace CalamityMod.Items item.mana = 7; break; - case ItemID.LaserMachinegun: - item.damage = 39; - break; - case ItemID.StardustDragonStaff: item.damage = 20; item.useTime = 19; From 1f6dead845661c7a15d34da07fc11a18e02ab377 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:02:42 -0400 Subject: [PATCH 23/57] Fixed all linear laser projectiles being blue. "But everything is turning blue!" --- Projectiles/LaserProj.png | Bin 153 -> 154 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Projectiles/LaserProj.png b/Projectiles/LaserProj.png index d2fb806a1ade54757c6afa64cf1177b47bca477c..beef1ad6cb6e30635c57e5be6660492e96343496 100644 GIT binary patch delta 95 zcmbQqIE!(DQ$&GBWHAE+-(e7DJf6QIg@J)V-_yl0L?S%7p|SGwv%l<#8q*s&y^04z)Q}FBBQsU4At;GBOzb5V-IpN8uSzCxfS}pUXO@geCyT?j#ui From 21412edadc23de184993abe15c2e31a00b0349b2 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:03:22 -0400 Subject: [PATCH 24/57] Draw angle fix, found by Dom, fixes ALL Laser Machinegun style lasers. --- Utilities/ProjectileUtils.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 0b829de25e..f36cef0bfa 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -222,7 +222,8 @@ namespace CalamityMod Color color = projectile.GetAlpha(lightColor); color *= (maxTrailPoints - (float)i) / maxTrailPoints; color.A = 0; - Main.spriteBatch.Draw(texture, drawPos - offset, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + float fixedRotation = projectile.rotation + MathHelper.PiOver2; + Main.spriteBatch.Draw(texture, drawPos - offset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f); } } return false; From 9880119aeb48eeb96b289606c50502895780b434 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:03:46 -0400 Subject: [PATCH 25/57] Minor cleanup to Condemnation --- Projectiles/Ranged/CondemnationHoldout.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 4bb1b99836..3377e0049f 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged { public class CondemnationHoldout : ModProjectile { - public Player Owner => Main.player[projectile.owner]; - public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; - public ref float CurrentChargingFrames => ref projectile.ai[0]; - public ref float ArrowsLoaded => ref projectile.ai[1]; - public ref float FramesToLoadNextArrow => ref projectile.localAI[0]; + private Player Owner => Main.player[projectile.owner]; + private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + private ref float CurrentChargingFrames => ref projectile.ai[0]; + private ref float ArrowsLoaded => ref projectile.ai[1]; + private ref float FramesToLoadNextArrow => ref projectile.localAI[0]; public override string Texture => "CalamityMod/Items/Weapons/Ranged/Condemnation"; public override void SetStaticDefaults() => DisplayName.SetDefault("Condemnation"); @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged } // Fire one charged arrow every frame until you're out of arrows. - ShootProjectiles(tipPosition, 1f); + ShootProjectiles(tipPosition); --ArrowsLoaded; Main.PlaySound(SoundID.DD2_BallistaTowerShot); } @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Ranged } } - public void ShootProjectiles(Vector2 tipPosition, float speedFactor) + public void ShootProjectiles(Vector2 tipPosition) { if (Main.myPlayer != projectile.owner) return; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged Item heldItem = Owner.ActiveItem(); // calculate damage at the instant this arrow is fired int arrowDamage = (int)(heldItem.damage * Owner.RangedDamage()); - float shootSpeed = heldItem.shootSpeed * speedFactor * 1.5f; + float shootSpeed = heldItem.shootSpeed * 1.5f; // Loaded arrows move faster than normal. float knockback = heldItem.knockBack; bool uselessFuckYou = OwnerCanShoot; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, arrowDamage, knockback, projectile.owner, 0f, 0f); } - public void UpdateProjectileHeldVariables(Vector2 armPosition) + private void UpdateProjectileHeldVariables(Vector2 armPosition) { if (Main.myPlayer == projectile.owner) { @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 2; } - public void ManipulatePlayerVariables() + private void ManipulatePlayerVariables() { Owner.ChangeDir(projectile.direction); Owner.heldProj = projectile.whoAmI; From 71aa03f9f7a22aa2fb4c4b5e58ec116137d1f4cf Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:04:57 -0400 Subject: [PATCH 26/57] 1 - Total visual rework to Nano Purge. 2 - Nano Purge 50 -> 66, but it shoots less lasers. 3 - Nano Purge accuracy increased, lasers fire in a different pattern. 4 - Nano Purge's fire rate is now buffed by speed reforges. 5 - Start of unfinished work on T1000. --- CalamityLists.cs | 4 +- Items/Weapons/Magic/Purge.cs | 23 +-- Items/Weapons/Magic/T1000.cs | 4 +- Projectiles/Magic/NanoPurgeHoldout.cs | 157 ++++++++++++++++++ .../{PurgeProj.png => NanoPurgeHoldout.png} | Bin .../{PurgeLaser.cs => NanoPurgeLaser.cs} | 7 +- Projectiles/Magic/PurgeProj.cs | 139 ---------------- .../Magic/{T1000Proj.cs => T1000Holdout.cs} | 10 +- .../Magic/{T1000Proj.png => T1000Holdout.png} | Bin 9 files changed, 184 insertions(+), 160 deletions(-) create mode 100644 Projectiles/Magic/NanoPurgeHoldout.cs rename Projectiles/Magic/{PurgeProj.png => NanoPurgeHoldout.png} (100%) rename Projectiles/Magic/{PurgeLaser.cs => NanoPurgeLaser.cs} (93%) delete mode 100644 Projectiles/Magic/PurgeProj.cs rename Projectiles/Magic/{T1000Proj.cs => T1000Holdout.cs} (94%) rename Projectiles/Magic/{T1000Proj.png => T1000Holdout.png} (100%) diff --git a/CalamityLists.cs b/CalamityLists.cs index 682fa5f663..46b6ff7609 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -576,8 +576,8 @@ namespace CalamityMod ProjectileType(), ProjectileType(), - ProjectileType(), - ProjectileType(), + ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index 783abdb907..a4af0eade2 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Weapons.Magic { public class Purge : ModItem { + public const int UseTime = 20; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nano Purge"); @@ -16,23 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 50; + item.damage = 66; item.magic = true; item.mana = 6; - item.width = 20; - item.height = 12; - item.useTime = 20; - item.useAnimation = 20; + item.width = 62; + item.height = 34; + item.useTime = item.useAnimation = UseTime; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.noUseGraphic = true; item.channel = true; item.knockBack = 3f; - item.value = Item.buyPrice(0, 95, 0, 0); item.rare = ItemRarityID.Cyan; + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -40,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 20); recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ItemID.FragmentVortex, 20); recipe.AddIngredient(ItemID.Nanites, 100); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); @@ -50,7 +51,9 @@ namespace CalamityMod.Items.Weapons.Magic 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); + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + Projectile.NewProjectile(position, shootDirection, type, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 9732ac2fda..2b3cbc14b7 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Purple; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic 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); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; } } diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs new file mode 100644 index 0000000000..1f63655730 --- /dev/null +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -0,0 +1,157 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NanoPurgeHoldout : ModProjectile + { + private const int FramesPerFireRateIncrease = 36; + private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 }; + + private Player Owner => Main.player[projectile.owner]; + private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + private ref float DeployedFrames => ref projectile.ai[0]; + private ref float ChargeTowardsNextShot => ref projectile.ai[1]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nano Purge"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 62; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.5f; + + // If the player is unable to continue using the holdout, delete it. + if (!OwnerCanShoot) + { + projectile.Kill(); + return; + } + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Item nanoPurge = Owner.ActiveItem(); + projectile.damage = (int)((nanoPurge?.damage ?? 0) * Owner.MagicDamage()); + + // Get the original weapon's use time. + int itemUseTime = nanoPurge?.useAnimation ?? Purge.UseTime; + + // Update time. + DeployedFrames += 1f; + + // Choose fire rate multiplier (1x, 2x, 3x, 4x) based on current time spent firing. + int fireRate = (int)MathHelper.Clamp(DeployedFrames / FramesPerFireRateIncrease, 1f, 4f); + + // Increment counter towards the item's use time by an amount equal to the current fire rate. + ChargeTowardsNextShot += fireRate; + + // If enough charging progress is made, perform a shoot event if enough mana is available. + if (ChargeTowardsNextShot >= itemUseTime) + { + ChargeTowardsNextShot -= itemUseTime; + + // Update the animation. + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + + bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false); + if (manaCostPaid) + { + Main.PlaySound(SoundID.Item91, projectile.Center); + + int projID = ModContent.ProjectileType(); + float shootSpeed = nanoPurge.shootSpeed; + float inaccuracyRatio = 0.045f; + Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 perp = shootDirection.RotatedBy(MathHelper.PiOver2); + + // Fire a pair of lasers, one with a negative offset, one with a positive offset. + for (int i = -1; i <= 1; i += 2) + { + Vector2 spread = Main.rand.NextVector2CircularEdge(shootSpeed, shootSpeed); + Vector2 shootVelocity = shootDirection * shootSpeed + inaccuracyRatio * spread; + Vector2 splitBarrelPos = gunBarrelPos + i * LaserOffsetByAnimationFrame[projectile.frame] * perp; + Projectile.NewProjectile(splitBarrelPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + SpawnFiringDust(splitBarrelPos, shootVelocity); + } + } + + // Delete the laser gun if a mana cost cannot be paid. + else + { + projectile.Kill(); + return; + } + } + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + } + + private void UpdateProjectileHeldVariables(Vector2 armPosition) + { + if (Main.myPlayer == projectile.owner) + { + float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = projectile.velocity; + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (projectile.velocity != oldVelocity) + { + projectile.netSpam = 0; + projectile.netUpdate = true; + } + } + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + } + + private void ManipulatePlayerVariables() + { + Owner.ChangeDir(projectile.direction); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity) + { + int dustID = 107; + int dustRadius = 5; + int dustDiameter = 2 * dustRadius; + Vector2 dustCorner = gunBarrelPos - Vector2.One * dustRadius; + for (int i = 0; i < 2; i++) + { + Vector2 dustVel = laserVelocity + Main.rand.NextVector2Circular(7f, 7f); + Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y); + d.velocity *= 0.125f; + d.noGravity = true; + d.scale = 1.4f; + } + } + + public override bool CanDamage() => false; + + // prevents the item from appearing backwards frame 1 + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; + } +} diff --git a/Projectiles/Magic/PurgeProj.png b/Projectiles/Magic/NanoPurgeHoldout.png similarity index 100% rename from Projectiles/Magic/PurgeProj.png rename to Projectiles/Magic/NanoPurgeHoldout.png diff --git a/Projectiles/Magic/PurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs similarity index 93% rename from Projectiles/Magic/PurgeLaser.cs rename to Projectiles/Magic/NanoPurgeLaser.cs index 52520b9204..8a0fdcee82 100644 --- a/Projectiles/Magic/PurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -4,13 +4,13 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class PurgeLaser : ModProjectile + public class NanoPurgeLaser : ModProjectile { public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Laser"); + DisplayName.SetDefault("Nano Beam"); } public override void SetDefaults() @@ -23,6 +23,9 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 2; projectile.timeLeft = 600; projectile.magic = true; + + // hmmmm + projectile.scale = 0.5f; } public override void AI() diff --git a/Projectiles/Magic/PurgeProj.cs b/Projectiles/Magic/PurgeProj.cs deleted file mode 100644 index e0d68f4db5..0000000000 --- a/Projectiles/Magic/PurgeProj.cs +++ /dev/null @@ -1,139 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class PurgeProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purge"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 64; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item91, projectile.position); - } - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float speed = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 spawnPos = playerPos; - Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - spawnPos; - if (player.gravDir == -1f) - { - direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - spawnPos.Y; - } - Vector2 velocity = Vector2.Normalize(direction); - if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y)) - { - velocity = -Vector2.UnitY; - } - velocity *= speed; - if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = velocity; - int projType = ModContent.ProjectileType(); - float velocityMult = 14f; - float randNum = 7f; - for (int j = 0; j < 3; j++) - { - spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.Kill(); - } - } - } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + Vector2.UnitX * 8f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - - public override bool CanDamage() => false; - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; - } -} diff --git a/Projectiles/Magic/T1000Proj.cs b/Projectiles/Magic/T1000Holdout.cs similarity index 94% rename from Projectiles/Magic/T1000Proj.cs rename to Projectiles/Magic/T1000Holdout.cs index 9b0e6ede7b..fba6cd1090 100644 --- a/Projectiles/Magic/T1000Proj.cs +++ b/Projectiles/Magic/T1000Holdout.cs @@ -1,12 +1,12 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { - public class T1000Proj : ModProjectile + public class T1000Holdout : ModProjectile { public override void SetStaticDefaults() { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic { Player player = Main.player[projectile.owner]; Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) + if (projectile.type == ModContent.ProjectileType()) { projectile.ai[0] += 1f; int num2 = 0; @@ -96,9 +96,9 @@ namespace CalamityMod.Projectiles.Magic float randNum = 4f; for (int j = 0; j < 4; j++) { - spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); + spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default); + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default); if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) { spinningpoint = -Vector2.UnitY; diff --git a/Projectiles/Magic/T1000Proj.png b/Projectiles/Magic/T1000Holdout.png similarity index 100% rename from Projectiles/Magic/T1000Proj.png rename to Projectiles/Magic/T1000Holdout.png From 5884df23c962707441622ccef0fc2d7ceaa22fdc Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 01:19:34 -0400 Subject: [PATCH 27/57] Visual cleanup to Nano Purge lasers. They're small now! --- Projectiles/Magic/NanoPurgeLaser.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index 8a0fdcee82..32f4ca0166 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -23,9 +23,6 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 2; projectile.timeLeft = 600; projectile.magic = true; - - // hmmmm - projectile.scale = 0.5f; } public override void AI() @@ -59,18 +56,20 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, 0); + public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 2f, lightColor); public override void Kill(int timeLeft) { + int dustID = 107; int dustAmt = Main.rand.Next(3, 7); - for (int d = 0; d < dustAmt; d++) + Vector2 dustPos = projectile.Center - projectile.velocity / 2f; + for (int i = 0; i < dustAmt; ++i) { - int nano = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f); - Main.dust[nano].velocity *= 2f; - Main.dust[nano].noGravity = true; + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 0.8f); + d.velocity *= 1.15f; + d.noGravity = true; } } } From 057e393f68419c8263be00462a84e91df77413a2 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 03:00:59 -0500 Subject: [PATCH 28/57] Tiny fixes to Nano Purge lasers --- Projectiles/Magic/NanoPurgeHoldout.cs | 2 +- Projectiles/Magic/NanoPurgeLaser.cs | 34 ++++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 1f63655730..09450954ae 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -152,6 +152,6 @@ namespace CalamityMod.Projectiles.Magic public override bool CanDamage() => false; // prevents the item from appearing backwards frame 1 - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => DeployedFrames > 0f; } } diff --git a/Projectiles/Magic/NanoPurgeLaser.cs b/Projectiles/Magic/NanoPurgeLaser.cs index 32f4ca0166..4690723997 100644 --- a/Projectiles/Magic/NanoPurgeLaser.cs +++ b/Projectiles/Magic/NanoPurgeLaser.cs @@ -6,6 +6,9 @@ namespace CalamityMod.Projectiles.Magic { public class NanoPurgeLaser : ModProjectile { + private const float LaserLength = 40f; + private const float LaserLengthChangeRate = 1.5f; + public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() @@ -27,38 +30,37 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + // Very rapidly fade into existence. if (projectile.alpha > 0) - { projectile.alpha -= 25; - } if (projectile.alpha < 0) - { projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; + + // Emit light. + Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.1f); + + // Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer. if (projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } + projectile.localAI[0] += LaserLengthChangeRate; + + // Cap it at max length. + if (projectile.localAI[0] > LaserLength) + projectile.localAI[0] = LaserLength; } + + // Otherwise it's shrinking. Once it reaches zero length it dies for good. else { - projectile.localAI[0] -= num56; + projectile.localAI[0] -= LaserLengthChangeRate; if (projectile.localAI[0] <= 0f) - { projectile.Kill(); - } } } public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 2f, lightColor); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor); public override void Kill(int timeLeft) { From 979ca98e8d3752bb1198506a02b695690250daa7 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 03:01:42 -0500 Subject: [PATCH 29/57] Calamity can now draw curved lasers. --- Utilities/ProjectileUtils.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index f36cef0bfa..123626f546 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -192,7 +192,7 @@ namespace CalamityMod } } - public static bool DrawBeam(this Projectile projectile, float length, float width, Color lightColor, Texture2D texture = null) + public static bool DrawBeam(this Projectile projectile, float length, float spacer, Color lightColor, Texture2D texture = null, bool curve = false) { if (texture is null) texture = Main.projectileTexture[projectile.type]; @@ -211,19 +211,30 @@ namespace CalamityMod Vector2 drawPos = projectile.position - Main.screenPosition + origin; drawPos.Y += projectile.gfxOffY; float maxTrailPoints = length; - float wide = width; + if (projectile.ai[1] == 1f) - { maxTrailPoints = (int)projectile.localAI[0]; - } + + Vector2 cumulativeOffset = Vector2.Zero; for (int i = 1; i <= (int)projectile.localAI[0]; i++) { - Vector2 offset = Vector2.Normalize(projectile.velocity) * (float)i * wide; + Vector2 velToUseThisIter = projectile.velocity; + if (curve) + { + float oldVelRatio = i / projectile.localAI[0]; + int oldVelIndex = (int)(oldVelRatio * projectile.oldRot.Length); + if (oldVelIndex > 0) + { + float angleChange = projectile.oldRot[oldVelIndex - 1] - projectile.rotation; + velToUseThisIter = projectile.velocity.RotatedBy(angleChange); + } + } + cumulativeOffset += Vector2.Normalize(velToUseThisIter) * spacer; Color color = projectile.GetAlpha(lightColor); color *= (maxTrailPoints - (float)i) / maxTrailPoints; color.A = 0; float fixedRotation = projectile.rotation + MathHelper.PiOver2; - Main.spriteBatch.Draw(texture, drawPos - offset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, drawPos - cumulativeOffset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f); } } return false; From 60f62a185c19fefae3bcc1455d70c780d9bec8e6 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 03:02:00 -0500 Subject: [PATCH 30/57] T1000 rework. It is now the Auric Wave Beam. --- Items/Weapons/Magic/T1000.cs | 28 ++-- Projectiles/Magic/T1000Holdout.cs | 217 ++++++++++++++++++------------ Projectiles/Magic/T1000Laser.cs | 101 ++++++++++---- 3 files changed, 224 insertions(+), 122 deletions(-) diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 2b3cbc14b7..0a74447065 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -10,32 +10,35 @@ namespace CalamityMod.Items.Weapons.Magic { public class T1000 : ModItem { + public const int UseTime = 36; + public override void SetStaticDefaults() { DisplayName.SetDefault("T1000"); - Tooltip.SetDefault("Fires a spread of rainbow lasers"); + Tooltip.SetDefault("Fires a barrage of phased god rays that pass through terrain\n" + + "God rays pierce once without triggering pierce resistances"); } public override void SetDefaults() { - item.damage = 250; + item.damage = 227; item.magic = true; - item.mana = 10; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; + item.mana = 8; + item.width = 94; + item.height = 54; + item.useTime = item.useAnimation = UseTime; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.noUseGraphic = true; item.channel = true; item.knockBack = 4f; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = ItemRarityID.Purple; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; + + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -44,7 +47,10 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); @@ -52,7 +58,9 @@ namespace CalamityMod.Items.Weapons.Magic 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); + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + Projectile.NewProjectile(position, shootDirection, type, damage, knockBack, player.whoAmI); return false; } } diff --git a/Projectiles/Magic/T1000Holdout.cs b/Projectiles/Magic/T1000Holdout.cs index fba6cd1090..d53d1c73a1 100644 --- a/Projectiles/Magic/T1000Holdout.cs +++ b/Projectiles/Magic/T1000Holdout.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,16 @@ namespace CalamityMod.Projectiles.Magic { public class T1000Holdout : ModProjectile { + private const int FramesPerFireRateIncrease = 36; + + private Player Owner => Main.player[projectile.owner]; + private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + + private ref float DeployedFrames => ref projectile.ai[0]; + private ref float AnimationRate => ref projectile.ai[1]; + private ref float LastShootAttemptTime => ref projectile.localAI[0]; + private ref float LastAnimationTime => ref projectile.localAI[1]; + public override void SetStaticDefaults() { DisplayName.SetDefault("T1000"); @@ -27,105 +38,135 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Player player = Main.player[projectile.owner]; - Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == ModContent.ProjectileType()) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item91, projectile.position); - } - projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float speed = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 spawnPos = playerPos + projectile.velocity * 0.75f; - Vector2 velocity = (Main.MouseWorld - projectile.Center).SafeNormalize(-Vector2.UnitY) * speed; - if (projectile.WithinRange(Main.MouseWorld, 50f)) - velocity = projectile.velocity; - if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) - projectile.netUpdate = true; + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.4f; - projectile.velocity = velocity; - int projType = ModContent.ProjectileType(); - float velocityMult = 21f; - float randNum = 4f; - for (int j = 0; j < 4; j++) - { - spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else + // If the player is unable to continue using the holdout, delete it. + if (!OwnerCanShoot) + { + projectile.Kill(); + return; + } + + // Play a sound frame 1. + if (DeployedFrames <= 0f) + { + var sound = Main.PlaySound(SoundID.DD2_DarkMageCastHeal, projectile.Center); + if (sound != null) + sound.Volume *= 1.5f; + } + + // Update damage based on curent magic damage stat (so Mana Sickness affects it) + Item t1000Item = Owner.ActiveItem(); + projectile.damage = (int)((t1000Item?.damage ?? 0) * Owner.MagicDamage()); + + // Get the original weapon's use time. + int itemUseTime = t1000Item?.useAnimation ?? T1000.UseTime; + // 36, base use time, will result in 5. Speed increasing reforges push it to 4. + int framesPerShot = itemUseTime / 7; + + // Update time. + DeployedFrames += 1f; + + // Determine animation rate. If the gun is spinning up, it increases linearly. Otherwise it's maxed. + AnimationRate = DeployedFrames >= itemUseTime ? 2f : MathHelper.Lerp(7f, 2f, DeployedFrames / itemUseTime); + + // Update the animation. This occurs even when firing is not occurring. + if (DeployedFrames - LastAnimationTime >= AnimationRate) + { + LastAnimationTime = DeployedFrames; + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + } + + // Once past the initial spin-up time, fire constantly as long as mana is available. + // Before the spin-up is done, sparks are produced but no lasers come out (and no mana is consumed). + if (DeployedFrames - LastShootAttemptTime >= framesPerShot) + { + LastShootAttemptTime = DeployedFrames; + bool actuallyShoot = DeployedFrames >= itemUseTime; + bool manaOK = !actuallyShoot || Owner.CheckMana(Owner.ActiveItem(), -1, true, false); + if (manaOK) + { + if (actuallyShoot) + Main.PlaySound(SoundID.Item91, projectile.Center); + + int projID = ModContent.ProjectileType(); + float shootSpeed = t1000Item.shootSpeed; + Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; + float dustInaccuracy = 0.045f; + + for (int i = 0; i < 3; ++i) { - projectile.Kill(); + Vector2 laserStartPos = gunBarrelPos + Main.rand.NextVector2CircularEdge(6f, 6f); + Vector2 dustOnlySpread = Main.rand.NextVector2Circular(shootSpeed, shootSpeed); + Vector2 dustVelocity = shootVelocity + dustInaccuracy * dustOnlySpread; + if (actuallyShoot) + Projectile.NewProjectile(laserStartPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + SpawnFiringDust(gunBarrelPos, dustVelocity); } } + + // Delete the laser gun if a mana cost cannot be paid. + else + { + projectile.Kill(); + return; + } } + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + } + + private void UpdateProjectileHeldVariables(Vector2 armPosition) + { + if (Main.myPlayer == projectile.owner) + { + float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = projectile.velocity; + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (projectile.velocity != oldVelocity) + { + projectile.netSpam = 0; + projectile.netUpdate = true; + } + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * 8f; - projectile.position.Y -= 8f; + projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + private void ManipulatePlayerVariables() + { + Owner.ChangeDir(projectile.direction); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity) + { + int dustID = 133; + int dustRadius = 12; + float dustRandomness = 11f; + int dustDiameter = 2 * dustRadius; + Vector2 dustCorner = gunBarrelPos - Vector2.One * dustRadius; + for (int i = 0; i < 2; i++) + { + Vector2 dustVel = laserVelocity + Main.rand.NextVector2Circular(dustRandomness, dustRandomness); + Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y); + d.velocity *= 0.18f; + d.noGravity = true; + d.scale = 0.6f; + } } public override bool CanDamage() => false; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; + // prevents the item from appearing backwards frame 1 + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => FramesPerFireRateIncrease > 0f; } } diff --git a/Projectiles/Magic/T1000Laser.cs b/Projectiles/Magic/T1000Laser.cs index 7220a303a6..5751b5fed6 100644 --- a/Projectiles/Magic/T1000Laser.cs +++ b/Projectiles/Magic/T1000Laser.cs @@ -1,16 +1,23 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class T1000Laser : ModProjectile { + private const float LaserLength = 80f; + private const float LaserLengthChangeRate = 2f; public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Laser"); + DisplayName.SetDefault("Phased God Ray"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() @@ -20,54 +27,100 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 600; + projectile.extraUpdates = 3; + projectile.timeLeft = 300; projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; } public override void AI() { + // Very rapidly fade into existence. if (projectile.alpha > 0) - { projectile.alpha -= 25; - } if (projectile.alpha < 0) - { projectile.alpha = 0; + + float theta = 0.09f; + float maxWaveFrames = 9f; + float waveSign = projectile.localAI[1] < 0f ? -1f : 1f; + + // Choose a waving direction initially at random. + if (projectile.localAI[1] == 0f) + { + float coinflip = Main.rand.NextBool() ? -1f : 1f; + waveSign = -coinflip; + projectile.localAI[1] = coinflip * maxWaveFrames * 0.5f; + + // Backfill old rotations to prevent visual glitches. + float startingRotation = projectile.velocity.ToRotation(); + for (int i = 0; i < projectile.oldRot.Length; ++i) + projectile.oldRot[i] = startingRotation; + + // Adjust initial position to prevent ugly splitting. + Vector2 perp = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); + float distance = Main.rand.NextFloat(13f, 30f); + projectile.position -= coinflip * distance * perp; } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; + // Switch waving directions as necessary. + else if (Math.Abs(projectile.localAI[1]) > maxWaveFrames) + projectile.localAI[1] = -waveSign; + else + projectile.localAI[1] += waveSign; + + // Apply a constant, rapid wave to the laser's motion. + projectile.velocity = projectile.velocity.RotatedBy(waveSign * theta); + projectile.rotation = projectile.velocity.ToRotation(); + + // Emit light. + Lighting.AddLight(projectile.Center, 0.87f, 0.65f, 0.1725f); + + // Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer. if (projectile.ai[1] == 0f) { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } + projectile.localAI[0] += 10f; // LaserLengthChangeRate; + + // Cap it at max length. + if (projectile.localAI[0] > LaserLength) + projectile.localAI[0] = LaserLength; } + + // Otherwise it's shrinking. Once it reaches zero length it dies for good. else { - projectile.localAI[0] -= num56; + projectile.localAI[0] -= LaserLengthChangeRate; if (projectile.localAI[0] <= 0f) - { projectile.Kill(); - } } } - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Get an extra hit in despite not being officially piercing. + if (projectile.ai[0] == 0f) + { + ++projectile.penetrate; + projectile.ai[0] += 1f; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); + public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true); public override void Kill(int timeLeft) { - int dustAmt = Main.rand.Next(3, 7); - for (int d = 0; d < dustAmt; d++) + int dustID = 269; + int dustAmt = 4; + Vector2 dustPos = projectile.Center - projectile.velocity / 2f; + Vector2 dustVel = projectile.velocity / 4f; + for (int i = 0; i < dustAmt; ++i) { - int rainbow = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); - Main.dust[rainbow].velocity *= 2f; - Main.dust[rainbow].noGravity = true; + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f); + d.velocity += dustVel; + d.velocity *= Main.rand.NextFloat(0.4f, 1f); + d.noGravity = true; } } } From e5876c484a1570d721da979dcbf53b513e335c71 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 03:11:08 -0500 Subject: [PATCH 31/57] T1000 renamed to Aetherflux Cannon. --- CalamityLists.cs | 2 +- Items/Weapons/Magic/T1000.cs | 4 ++-- ...T1000Holdout.cs => AetherfluxCannonHoldout.cs} | 14 +++++++------- ...000Holdout.png => AetherfluxCannonHoldout.png} | Bin .../Magic/{T1000Laser.cs => PhasedGodRay.cs} | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename Projectiles/Magic/{T1000Holdout.cs => AetherfluxCannonHoldout.cs} (93%) rename Projectiles/Magic/{T1000Holdout.png => AetherfluxCannonHoldout.png} (100%) rename Projectiles/Magic/{T1000Laser.cs => PhasedGodRay.cs} (99%) diff --git a/CalamityLists.cs b/CalamityLists.cs index 46b6ff7609..429044831f 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -577,7 +577,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 0a74447065..838da06e38 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { - DisplayName.SetDefault("T1000"); + DisplayName.SetDefault("Aetherflux Cannon"); Tooltip.SetDefault("Fires a barrage of phased god rays that pass through terrain\n" + "God rays pierce once without triggering pierce resistances"); } @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.channel = true; item.knockBack = 4f; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.rare = ItemRarityID.Purple; diff --git a/Projectiles/Magic/T1000Holdout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs similarity index 93% rename from Projectiles/Magic/T1000Holdout.cs rename to Projectiles/Magic/AetherfluxCannonHoldout.cs index d53d1c73a1..c3f32ac6cf 100644 --- a/Projectiles/Magic/T1000Holdout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class T1000Holdout : ModProjectile + public class AetherfluxCannonHoldout : ModProjectile { private const int FramesPerFireRateIncrease = 36; @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { - DisplayName.SetDefault("T1000"); + DisplayName.SetDefault("Aetherflux Cannon"); Main.projFrames[projectile.type] = 8; } @@ -57,11 +57,11 @@ namespace CalamityMod.Projectiles.Magic } // Update damage based on curent magic damage stat (so Mana Sickness affects it) - Item t1000Item = Owner.ActiveItem(); - projectile.damage = (int)((t1000Item?.damage ?? 0) * Owner.MagicDamage()); + Item weaponItem = Owner.ActiveItem(); + projectile.damage = (int)((weaponItem?.damage ?? 0) * Owner.MagicDamage()); // Get the original weapon's use time. - int itemUseTime = t1000Item?.useAnimation ?? T1000.UseTime; + int itemUseTime = weaponItem?.useAnimation ?? T1000.UseTime; // 36, base use time, will result in 5. Speed increasing reforges push it to 4. int framesPerShot = itemUseTime / 7; @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Magic if (actuallyShoot) Main.PlaySound(SoundID.Item91, projectile.Center); - int projID = ModContent.ProjectileType(); - float shootSpeed = t1000Item.shootSpeed; + int projID = ModContent.ProjectileType(); + float shootSpeed = weaponItem.shootSpeed; Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; float dustInaccuracy = 0.045f; diff --git a/Projectiles/Magic/T1000Holdout.png b/Projectiles/Magic/AetherfluxCannonHoldout.png similarity index 100% rename from Projectiles/Magic/T1000Holdout.png rename to Projectiles/Magic/AetherfluxCannonHoldout.png diff --git a/Projectiles/Magic/T1000Laser.cs b/Projectiles/Magic/PhasedGodRay.cs similarity index 99% rename from Projectiles/Magic/T1000Laser.cs rename to Projectiles/Magic/PhasedGodRay.cs index 5751b5fed6..5524a29641 100644 --- a/Projectiles/Magic/T1000Laser.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class T1000Laser : ModProjectile + public class PhasedGodRay : ModProjectile { private const float LaserLength = 80f; private const float LaserLengthChangeRate = 2f; From cacf8581003d1e3e7cfbbd63bad6471c3e94c23e Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 5 Nov 2021 15:04:44 -0500 Subject: [PATCH 32/57] PBG bees use the correct death sound --- NPCs/PlaguebringerGoliath/PlagueBeeG.cs | 2 +- NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index e8c7285bad..c89e9c0190 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.9f; animationType = NPCID.Bee; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -264,6 +263,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } if (npc.life <= 0) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); for (int k = 0; k < 10; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index 5955282814..b8ea117dcd 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath aiType = -1; npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.95f; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -157,6 +156,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } if (npc.life <= 0) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center); for (int k = 0; k < 10; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); From e04f65524ffe8920eceae0728ef6b63138854159 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Fri, 5 Nov 2021 15:06:12 -0500 Subject: [PATCH 33/57] More Boss Checklist fixes --- ModSupport/WeakReferenceSupport.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index f0be6537aa..2007e49f5d 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -506,8 +506,8 @@ namespace CalamityMod BossDifficulty.TryGetValue("StormWeaver", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in Space"; string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE)); string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist"; @@ -556,7 +556,7 @@ namespace CalamityMod int type = NPCType(); int summon = ItemType(); List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); string bossLogTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist"; From 257b3d5b3b1c0e1471e62f7dcdea83f20b03cd50 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 6 Nov 2021 22:40:15 -0500 Subject: [PATCH 34/57] Oblatory is more dangerous to use --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 51a2586638..3d5fa5839e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -10919,7 +10919,7 @@ namespace CalamityMod.CalPlayer public override void OnConsumeMana(Item item, int manaConsumed) { CalamityPlayer modPlayer = player.Calamity(); - if (Main.rand.NextBool(4) && modPlayer.lifeManaEnchant) + if (Main.rand.NextBool(2) && modPlayer.lifeManaEnchant) { if (Main.myPlayer == player.whoAmI) { From 2552c1d114cc736b0bcdec9b9f2b7798687f7bdb Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 6 Nov 2021 23:37:22 -0500 Subject: [PATCH 35/57] Made Vehemence more consistent --- Items/Weapons/Magic/Vehemenc.cs | 6 ++---- Projectiles/Magic/Vehemence.cs | 10 ---------- Projectiles/Magic/VehemenceSkull.cs | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index 800661a0ae..0fc96b79d4 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -13,17 +13,15 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Vehemence"); Tooltip.SetDefault("Casts an intense energy blast\n" + - "Does far more damage the more HP an enemy has left\n" + - "Max damage is capped at 200,000\n" + "If an enemy has full HP it will inflict Demon Flames for an extremely long time"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 3; + item.damage = 1412; item.magic = true; - item.mana = 590; + item.mana = 200; item.width = 44; item.height = 44; item.useTime = item.useAnimation = 50; diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 0f7433da39..ba175dc77a 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -113,16 +113,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - double lifeAmount = target.life; - double lifeMax = target.lifeMax; - double damageExponent = lifeAmount / lifeMax * 7; - damage = (int)Math.Pow(damage, damageExponent); - if (damage > 200000) - damage = 200000; - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (target.life == target.lifeMax) diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index c67b98462e..af63e4f32c 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; projectile.magic = true; } From ab715d900fbac3bee7a6395df6832083784ffa75 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Sun, 7 Nov 2021 03:14:23 -0500 Subject: [PATCH 36/57] Reduce Vehemence mana cost to a reasonable number for regular use --- Items/Weapons/Magic/Vehemenc.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index 0fc96b79d4..04c369fa4e 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { item.damage = 1412; item.magic = true; - item.mana = 200; + item.mana = 41; item.width = 44; item.height = 44; item.useTime = item.useAnimation = 50; From 6965291502ffae7f4ebcda0385d740b5a7cc00c5 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 03:43:47 -0500 Subject: [PATCH 37/57] 1 - Vehemence damage massively boosted to compensate for formula removal 2 - Vehemence skulls slightly nerfed 3 - Vehemence skulls now produce light 4 - Vehemence's projectile is now faster 5 - Other minor touchups to Vehemence --- Items/Weapons/Magic/Vehemenc.cs | 23 +++++++++++++---------- Projectiles/Magic/Vehemence.cs | 7 +++---- Projectiles/Magic/VehemenceHoldout.cs | 7 +++++-- Projectiles/Magic/VehemenceSkull.cs | 25 +++++++++++++++---------- 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index 04c369fa4e..effaf9e85f 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -6,44 +6,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class Vehemenc : ModItem + public class Vehemenc : ModItem { - public const int VehemenceSkullDamage = 1250; + public const int VehemenceSkullDamage = 830; public override void SetStaticDefaults() { DisplayName.SetDefault("Vehemence"); - Tooltip.SetDefault("Casts an intense energy blast\n" + - "If an enemy has full HP it will inflict Demon Flames for an extremely long time"); + Tooltip.SetDefault("Casts intense bolts of hellish power that explode into skulls\n" + + "Direct hits inflict Demon Flames for an extended period of time"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 1412; + item.damage = 6666; item.magic = true; item.mana = 41; item.width = 44; item.height = 44; - item.useTime = item.useAnimation = 50; + item.useTime = item.useAnimation = 43; item.noUseGraphic = true; item.channel = true; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.75f; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item73; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; + + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.Rarity15BuyPrice; } public override Vector2? HoldoutOrigin() => new Vector2(25, 25); 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, Vector2.Zero, type, damage, knockBack, player.whoAmI); - player.AddBuff(BuffID.ManaSickness, 600, true); + Item v = player.ActiveItem(); + int chargeTime = 2 * v.useAnimation; + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, chargeTime); return false; } diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index ba175dc77a..bb11d1803c 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic public Player Owner => Main.player[projectile.owner]; public override void SetStaticDefaults() { - DisplayName.SetDefault("Vehemence"); + DisplayName.SetDefault("Blast of Vehemence"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 1; } @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.ignoreWater = true; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; projectile.timeLeft = 300; projectile.magic = true; } @@ -115,8 +115,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.life == target.lifeMax) - target.AddBuff(ModContent.BuffType(), 18000); + target.AddBuff(ModContent.BuffType(), 1800); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index f5cbe5d1a2..e759f6527a 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public Player Owner => Main.player[projectile.owner]; public ref float Time => ref projectile.ai[0]; + public ref float ChargeTime => ref projectile.ai[1]; - public const int ChargeTime = 90; public override string Texture => "CalamityMod/Items/Weapons/Magic/Vehemenc"; public override void SetStaticDefaults() { @@ -25,12 +25,14 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = false; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.timeLeft = ChargeTime + 1; + projectile.timeLeft = 91; } public override void AI() { UpdatePlayerVisuals(); + if (projectile.timeLeft > ChargeTime + 5) + projectile.timeLeft = (int)ChargeTime + 5; if (Time == ChargeTime) ShootBolt(); else if (Time < ChargeTime) @@ -38,6 +40,7 @@ namespace CalamityMod.Projectiles.Magic Time++; + // If the player aborts the charge by releasing LMB, it cancels. if (Main.mouseLeftRelease && Time >= 5f && Time < ChargeTime) projectile.Kill(); } diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index af63e4f32c..1dc6c05b20 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic public ref float Time => ref projectile.ai[0]; public override void SetStaticDefaults() { - DisplayName.SetDefault("Brimstone Skull"); + DisplayName.SetDefault("Vehement Skull"); Main.projFrames[projectile.type] = 10; } @@ -37,16 +38,18 @@ namespace CalamityMod.Projectiles.Magic projectile.frameCounter = 0; } - if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames. - { - if (projectile.frame >= 4) - projectile.frame = 0; - } + if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames. + { + if (projectile.frame >= 4) + projectile.frame = 0; + } + else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + projectile.Kill(); - else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) - projectile.Kill(); + // Produce some light. + Lighting.AddLight(projectile.Center, 0.36f, 0.09f, 0.09f); - projectile.velocity *= 0.98f; + projectile.velocity *= 0.972f; if (projectile.alpha > 110) { projectile.alpha -= 30; @@ -58,6 +61,8 @@ namespace CalamityMod.Projectiles.Magic projectile.spriteDirection = -projectile.direction; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); + public override Color? GetAlpha(Color lightColor) => new Color(191, 63, 54, 100); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } From cbd9833dced40918cecd52d1348e5edd57d0eca5 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 13:42:51 -0500 Subject: [PATCH 38/57] Vehemence 6666 -> 5185, skulls 830 -> 414 (ratio instead of hardcoded) --- Items/Weapons/Magic/Vehemenc.cs | 6 ++++-- Projectiles/Magic/Vehemence.cs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index effaf9e85f..417ad6f889 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -8,7 +8,9 @@ namespace CalamityMod.Items.Weapons.Magic { public class Vehemenc : ModItem { - public const int VehemenceSkullDamage = 830; + public const int BaseDamage = 5185; + public const float SkullRatio = 0.08f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Vehemence"); @@ -19,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 6666; + item.damage = BaseDamage; item.magic = true; item.mana = 41; item.width = 44; diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index bb11d1803c..3702c3faa3 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -84,9 +84,10 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item74, projectile.position); if (Main.myPlayer == projectile.owner) { - int damage = (int)(Vehemenc.VehemenceSkullDamage * Owner.MagicDamage()); + int skullID = ModContent.ProjectileType(); + int damage = (int)(projectile.damage * Vehemenc.SkullRatio); for (int i = 0; i < 18; i++) - Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), skullID, damage, projectile.knockBack, projectile.owner); } if (!Main.dedServ) From 396947af1040cb8fe90c0ed78641c9d7f02660d8 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 13:54:13 -0500 Subject: [PATCH 39/57] Fixed Thanatos Hadopelagic Echo resist --- NPCs/CalamityGlobalNPC.cs | 2 +- Projectiles/Magic/HadopelagicEcho2.cs | 10 +-- Projectiles/Magic/HadopelagicEchoSoundwave.cs | 72 +++++++++---------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 27d1a4bffc..dbc028428d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3514,7 +3514,7 @@ namespace CalamityMod.NPCs damage = (int)(damage * 0.25); // 65% resist to true melee and Hadopelagic Echo. - else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) + else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.35); // 50% resist to Chicken Cannon. diff --git a/Projectiles/Magic/HadopelagicEcho2.cs b/Projectiles/Magic/HadopelagicEcho2.cs index 7a1cf33ad1..38e2255fb7 100644 --- a/Projectiles/Magic/HadopelagicEcho2.cs +++ b/Projectiles/Magic/HadopelagicEcho2.cs @@ -31,19 +31,19 @@ namespace CalamityMod.Projectiles.Magic projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.timeLeft = 30; - projectile.extraUpdates = 1; - projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.tileCollide = false; } public override void AI() { projectile.width = (int)(36f * projectile.scale); - projectile.height = (int)(36f * projectile.scale); + projectile.height = (int)(36f * projectile.scale); if (projectile.alpha > 100) projectile.alpha -= 25; - if (projectile.alpha < 100) - projectile.alpha = 100; + if (projectile.alpha < 100) + projectile.alpha = 100; projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } diff --git a/Projectiles/Magic/HadopelagicEchoSoundwave.cs b/Projectiles/Magic/HadopelagicEchoSoundwave.cs index 57c09aec8e..414242d895 100644 --- a/Projectiles/Magic/HadopelagicEchoSoundwave.cs +++ b/Projectiles/Magic/HadopelagicEchoSoundwave.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Magic { public override string Texture => "CalamityMod/Projectiles/Magic/EidolicWailSoundwave"; - private int echoCooldown = 0; - private bool playedSound = false; - private static int penetrationAmt = 50; + private int echoCooldown = 0; + private bool playedSound = false; + private static int penetrationAmt = 50; public override void SetStaticDefaults() { @@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Magic projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; projectile.timeLeft = 450; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override void AI() { - if (projectile.ai[0] == 0f || projectile.ai[0] == 4f) - { - if (!playedSound) - { - Main.PlaySound(Main.rand.NextBool(100) ? mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)projectile.Center.X, (int)projectile.Center.Y); - playedSound = true; - } - } + if (projectile.ai[0] == 0f || projectile.ai[0] == 4f) + { + if (!playedSound) + { + Main.PlaySound(Main.rand.NextBool(100) ? mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)projectile.Center.X, (int)projectile.Center.Y); + playedSound = true; + } + } if (projectile.localAI[0] < 1f) { @@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 36; } - if (echoCooldown > 0) - echoCooldown--; + if (echoCooldown > 0) + echoCooldown--; projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } @@ -97,28 +97,28 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Electrified, 600); projectile.velocity *= 0.85f; - if (echoCooldown <= 0) - { - echoCooldown = 60; - int echoID = ModContent.ProjectileType(); - int echoDamage = (int)(0.2f * projectile.damage); - float echoKB = projectile.knockBack / 3; - int echos = 5; - for (int i = 0; i < echos; ++i) - { - float startDist = Main.rand.NextFloat(260f, 270f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = target.Center + (startDir * startDist); + if (echoCooldown <= 0) + { + echoCooldown = 60; + int echoID = ModContent.ProjectileType(); + int echoDamage = (int)(0.2f * projectile.damage); + float echoKB = projectile.knockBack / 3; + int echos = 5; + for (int i = 0; i < echos; ++i) + { + float startDist = Main.rand.NextFloat(260f, 270f); + Vector2 startDir = Main.rand.NextVector2Unit(); + Vector2 startPoint = target.Center + (startDir * startDist); - float echoSpeed = Main.rand.NextFloat(15f, 18f); - Vector2 velocity = startDir * (-echoSpeed); + float echoSpeed = Main.rand.NextFloat(15f, 18f); + Vector2 velocity = startDir * (-echoSpeed); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner); - } - } - } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner); + } + } + } } public override Color? GetAlpha(Color lightColor) From 25b20be9b00513831ae00447ba5c2836c401f8fd Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 14:00:01 -0500 Subject: [PATCH 40/57] big sacrifice nerf, iframes were messed up. Didn't touch SS --- Items/Weapons/Rogue/Sacrifice.cs | 15 ++++++++------- Projectiles/Rogue/SacrificeProjectile.cs | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index df429d45e3..18a4994f3d 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -12,29 +12,30 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sacrifice"); - Tooltip.SetDefault("Releases a dagger that sticks to enemies\n" + - "Right clicking causes all stuck daggers to fly back at you and give you life\n" + + Tooltip.SetDefault("Throws sacrificial daggers that lodge themselves in enemies\n" + + "Right click causes all stuck daggers to fly back at you and give you life\n" + "Daggers stuck to enemies release bloodsplosions over time\n" + "Stealth strikes provide much more life when returning to you"); } public override void SafeSetDefaults() { - item.damage = 266; + item.damage = 215; item.width = item.height = 68; - item.useAnimation = item.useTime = 6; + item.useAnimation = item.useTime = 9; item.noMelee = true; item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4f; - item.rare = ItemRarityID.Purple; - item.Calamity().customRarity = CalamityRarity.Violet; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; + + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[item.shoot] > 0; diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index f936abd54b..4c553e7c43 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sacrifice"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Sacrifice"); + DisplayName.SetDefault("Sacrificial Dagger"); ProjectileID.Sets.TrailingMode[projectile.type] = 1; ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; } @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + projectile.localNPCHitCooldown = 20; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(AbleToHealOwner); From 1f7b2840938ea0931bb4f794bf109c1975208e9a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 14:28:38 -0500 Subject: [PATCH 41/57] Aetherflux Cannon only shoots 2 lasers instead of 3 in a perfect wave. Nerfed DPS significantly --- Items/Weapons/Magic/T1000.cs | 5 +- Projectiles/Magic/AetherfluxCannonHoldout.cs | 19 +++++-- Projectiles/Magic/PhasedGodRay.cs | 56 ++++++++++---------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 838da06e38..516320beff 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -15,13 +15,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Aetherflux Cannon"); - Tooltip.SetDefault("Fires a barrage of phased god rays that pass through terrain\n" + - "God rays pierce once without triggering pierce resistances"); + Tooltip.SetDefault("Fires a barrage of phased god rays that pass through terrain"); } public override void SetDefaults() { - item.damage = 227; + item.damage = 171; item.magic = true; item.mana = 8; item.width = 94; diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index c3f32ac6cf..aee42ff97c 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -92,16 +92,27 @@ namespace CalamityMod.Projectiles.Magic int projID = ModContent.ProjectileType(); float shootSpeed = weaponItem.shootSpeed; - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; + Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY); + Vector2 shootVelocity = shootDirection * shootSpeed; + + // Waving beams need to start offset so they cross each other neatly. + float waveSideOffset = Main.rand.NextFloat(18f, 28f); + Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; + + // Dust chaotically sheds off the crystal while charging or firing. float dustInaccuracy = 0.045f; - for (int i = 0; i < 3; ++i) + for (int i = -1; i <= 1 ; i += 2) { - Vector2 laserStartPos = gunBarrelPos + Main.rand.NextVector2CircularEdge(6f, 6f); + Vector2 laserStartPos = gunBarrelPos + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); Vector2 dustOnlySpread = Main.rand.NextVector2Circular(shootSpeed, shootSpeed); Vector2 dustVelocity = shootVelocity + dustInaccuracy * dustOnlySpread; if (actuallyShoot) - Projectile.NewProjectile(laserStartPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + { + Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + // Tell this Phased God Ray exactly which way it should be waving. + godRay.localAI[1] = i * 0.5f; + } SpawnFiringDust(gunBarrelPos, dustVelocity); } } diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index 5524a29641..7ad38172be 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -11,6 +11,13 @@ namespace CalamityMod.Projectiles.Magic { private const float LaserLength = 80f; private const float LaserLengthChangeRate = 2f; + + // Do not change these unless you are absolutely sure you know how to fix the wave math. + // They are extremely carefully chosen and barely work as is! + private const float WaveTheta = 0.09f; + private const int WaveTwistFrames = 9; + private ref float WaveFrameState => ref projectile.localAI[1]; + public override string Texture => "CalamityMod/Projectiles/LaserProj"; public override void SetStaticDefaults() @@ -26,9 +33,11 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 5; projectile.friendly = true; projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 300; + projectile.penetrate = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 12; + projectile.MaxUpdates = 3; + projectile.timeLeft = 280; projectile.magic = true; projectile.tileCollide = false; projectile.ignoreWater = true; @@ -42,35 +51,32 @@ namespace CalamityMod.Projectiles.Magic if (projectile.alpha < 0) projectile.alpha = 0; - float theta = 0.09f; - float maxWaveFrames = 9f; - float waveSign = projectile.localAI[1] < 0f ? -1f : 1f; + float waveSign = WaveFrameState < 0f ? -1f : 1f; - // Choose a waving direction initially at random. - if (projectile.localAI[1] == 0f) + // Initialize waving. Setting localAI[1] to a number between -1 and 1 tells it which way to wave. + // Exactly 0 is a coinflip. + if (Math.Abs(WaveFrameState) < 1f) { - float coinflip = Main.rand.NextBool() ? -1f : 1f; - waveSign = -coinflip; - projectile.localAI[1] = coinflip * maxWaveFrames * 0.5f; + float dirToUse = WaveFrameState == 0f ? (Main.rand.NextBool() ? -1f : 1f) : waveSign; + waveSign = -dirToUse; + WaveFrameState = dirToUse * WaveTwistFrames * 0.5f; // Backfill old rotations to prevent visual glitches. - float startingRotation = projectile.velocity.ToRotation(); + float iterRotation = projectile.velocity.ToRotation(); for (int i = 0; i < projectile.oldRot.Length; ++i) - projectile.oldRot[i] = startingRotation; - - // Adjust initial position to prevent ugly splitting. - Vector2 perp = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); - float distance = Main.rand.NextFloat(13f, 30f); - projectile.position -= coinflip * distance * perp; + { + projectile.oldRot[i] = iterRotation; + iterRotation += waveSign * WaveTheta; + } } // Switch waving directions as necessary. - else if (Math.Abs(projectile.localAI[1]) > maxWaveFrames) - projectile.localAI[1] = -waveSign; + else if (Math.Abs(WaveFrameState) > WaveTwistFrames) + WaveFrameState = -waveSign; else - projectile.localAI[1] += waveSign; + WaveFrameState += waveSign; // Apply a constant, rapid wave to the laser's motion. - projectile.velocity = projectile.velocity.RotatedBy(waveSign * theta); + projectile.velocity = projectile.velocity.RotatedBy(waveSign * WaveTheta); projectile.rotation = projectile.velocity.ToRotation(); // Emit light. @@ -97,12 +103,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - // Get an extra hit in despite not being officially piercing. - if (projectile.ai[0] == 0f) - { - ++projectile.penetrate; - projectile.ai[0] += 1f; - } } public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); From 6041f7cde3e361f3557940b35493a2cc4eb4e3e1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 14:35:12 -0500 Subject: [PATCH 42/57] even more resists for thanatos --- NPCs/CalamityGlobalNPC.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index dbc028428d..0f5fa90ded 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3521,16 +3521,16 @@ namespace CalamityMod.NPCs if (projectile.type == ProjectileType()) damage = (int)(damage * 0.5); - // 40% resist to Wrathwing stealth strike. - else if (projectile.type == ProjectileType()) + // 40% resist to Wrathwing stealth strike, Rancor, and Yharim's Crystal. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.6); - // 25% resist to Eradicator beams. - else if (projectile.type == ProjectileType()) - damage = (int)(damage * 0.75); + // 20% resist to Eradicator beams and Voltaic Climax / Void Vortex hitscan. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.8); - // 15% resist to God Slayer Slugs and Luminite Bullets. - else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType()) + // 15% resist to God Slayer Slugs, Luminite Bullets, and Gruesome Eminence. + else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.85); } From fbe28a9045da6229a4c84cc5c26754f0650929d9 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 15:04:32 -0500 Subject: [PATCH 43/57] Optimized MagnetSphereHitscan to not perform unnecessary homing checks. --- Projectiles/CalamityGlobalProjectile.cs | 127 ++++++++++++------------ 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7a2612ef8b..8ea687ece0 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2584,87 +2584,92 @@ namespace CalamityMod.Projectiles public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false) { - float maxDistance = distanceRequired; - bool homeIn = false; - int[] targetArray = new int[maxTargets]; - int targetArrayIndex = 0; + // Only shoot once every N frames. + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > projectileTimer) + { + projectile.localAI[0] = 0f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + // Only search for targets if projectiles could be fired. + float maxDistance = distanceRequired; + bool homeIn = false; + int[] targetArray = new int[maxTargets]; + int targetArrayIndex = 0; - bool canHit = true; - if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit) - { - if (targetArrayIndex < maxTargets) - { - targetArray[targetArrayIndex] = i; - targetArrayIndex++; - homeIn = true; - } - else - break; - } - } - } + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); - if (homeIn) - { - int randomTarget = Main.rand.Next(targetArrayIndex); - randomTarget = targetArray[randomTarget]; + if (projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit) + { + if (targetArrayIndex < maxTargets) + { + targetArray[targetArrayIndex] = i; + targetArrayIndex++; + homeIn = true; + } + else + break; + } + } + } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > projectileTimer) - { - projectile.localAI[0] = 0f; - Vector2 spawnPos = projectile.Center + projectile.velocity * 4f; - Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity; + // If there is anything to actually shoot at, pick targets at random and fire. + if (homeIn) + { + int randomTarget = Main.rand.Next(targetArrayIndex); + randomTarget = targetArray[randomTarget]; - if (attackMultiple) - { - for (int i = 0; i < targetArrayIndex; i++) - { - velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - spawnPos) * homingVelocity; + projectile.localAI[0] = 0f; + Vector2 spawnPos = projectile.Center + projectile.velocity * 4f; + Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + if (attackMultiple) + { + for (int i = 0; i < targetArrayIndex; i++) + { + velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - spawnPos) * homingVelocity; - if (projectile.type == ProjectileType()) + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + + if (projectile.type == ProjectileType()) if (projectile2.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile2].Calamity().forceRogue = true; - } - } + } + } - return; - } + return; + } - if (projectile.type == ProjectileType()) - { - velocity.Y += Main.rand.Next(-30, 31) * 0.05f; - velocity.X += Main.rand.Next(-30, 31) * 0.05f; - } + if (projectile.type == ProjectileType()) + { + velocity.Y += Main.rand.Next(-30, 31) * 0.05f; + velocity.X += Main.rand.Next(-30, 31) * 0.05f; + } - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); - 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()) if (projectile2.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile2].Calamity().forceMelee = true; if (projectile.type == ProjectileType()) if (projectile2.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile2].Calamity().forceRogue = true; - } - } - } + } + } + } } public static void ExpandHitboxBy(Projectile projectile, int width, int height) From 429b0ac7ec3a2d559fc6a2978c61eb03044282a7 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 15:05:17 -0500 Subject: [PATCH 44/57] Voltaic Climax orbs last half as long and can't stack well, but do more damage and have 50% more range. --- Items/Weapons/Magic/Climax.cs | 44 +++++++++++---------------------- Projectiles/Magic/ClimaxBeam.cs | 22 ++++++++--------- Projectiles/Magic/ClimaxProj.cs | 30 +++++++++++----------- 3 files changed, 41 insertions(+), 55 deletions(-) diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 560ac88c2f..4b2085bf21 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,16 +10,18 @@ namespace CalamityMod.Items.Weapons.Magic { public class Climax : ModItem { + public const int OrbFireRate = 10; + public override void SetStaticDefaults() { DisplayName.SetDefault("Voltaic Climax"); - Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Tooltip.SetDefault("Conjures an octagon of supercharged magnet spheres around the mouse"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 105; + item.damage = 140; item.magic = true; item.mana = 30; item.width = 78; @@ -46,34 +47,17 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + int numOrbs = 8; + Vector2 clickPos = Main.MouseWorld; + float orbSpeed = 14f; + Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed); + for (int i = 0; i < numOrbs; i++) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - else - { - num80 = num72 / num80; - } - vector2 += new Vector2(num78, num79); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 1f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers + float timingStagger = Main.rand.Next(OrbFireRate); + Projectile.NewProjectile(clickPos, vel, type, damage, knockBack, player.whoAmI, ai0: timingStagger); + + vel = vel.RotatedBy(MathHelper.TwoPi / numOrbs); } return false; } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 35522d47d9..f82d840373 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -20,18 +20,18 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 90; projectile.magic = true; - projectile.ignoreWater = true; + projectile.ignoreWater = true; projectile.tileCollide = false; - } + } - public override void AI() - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } + public override void AI() + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.1f; + } } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 3c9a8e8308..e9d843cf55 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -1,8 +1,9 @@ +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class ClimaxProj : ModProjectile @@ -18,27 +19,25 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 38; projectile.height = 38; projectile.friendly = true; - projectile.light = 0.5f; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 96; + projectile.timeLeft = 48; projectile.magic = true; projectile.ignoreWater = true; } public override void AI() { - projectile.velocity *= 0.96f; + // Rapidly screech to a halt once spawned. + projectile.velocity *= 0.86f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - else - { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } + // Spin chaotically given a pre-defined spin direction. Choose one initially at random. + float theta = 0.03f; + if (projectile.localAI[0] == 0f) + projectile.localAI[0] = Main.rand.NextBool() ? -theta : theta; + projectile.rotation += projectile.localAI[0]; + // Animate the lightning orb. projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -50,8 +49,11 @@ namespace CalamityMod.Projectiles.Magic } } - if (projectile.timeLeft % 4 == projectile.ai[0]) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); + ++projectile.ai[1]; + // Initial stagger in frames needs to be skipped over before it starts shooting, + // but once it's past that then it can fire constantly + if (projectile.ai[1] > projectile.ai[0]) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, Climax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) From f31349ce705f182cde32665262666e72da0b6f34 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 15:38:55 -0500 Subject: [PATCH 45/57] 1 - Reworked Void Vortex 2 - Void Vortex has the same damage as Voltaic Climax now 3 - Spawns more orbs that fire more slowly 4 - Orb spread pattern completely changed, now looks like a vortex or whirlpool --- Items/Weapons/Magic/Climax.cs | 2 +- Items/Weapons/Magic/VoidVortex.cs | 52 +++++++++++------------------ Projectiles/Magic/ClimaxProj.cs | 12 +++---- Projectiles/Magic/VoidVortexProj.cs | 39 ++++++++++------------ 4 files changed, 44 insertions(+), 61 deletions(-) diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 4b2085bf21..25a16612f4 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Voltaic Climax"); - Tooltip.SetDefault("Conjures an octagon of supercharged magnet spheres around the mouse"); + Tooltip.SetDefault("Conjures an octagon of supercharged magnet spheres around the cursor"); Item.staff[item.type] = true; } diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 2f52d5a79e..3bc70f86c5 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,16 +8,18 @@ namespace CalamityMod.Items.Weapons.Magic { public class VoidVortex : ModItem { + public const int OrbFireRate = 16; + public override void SetStaticDefaults() { DisplayName.SetDefault("Void Vortex"); - Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Tooltip.SetDefault("Conjures a swirling vortex of supercharged magnet spheres around the cursor"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 88; + item.damage = 140; item.magic = true; item.mana = 60; item.width = 130; @@ -45,37 +46,22 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + int numOrbs = 12; + Vector2 clickPos = Main.MouseWorld; + float orbDistance = 48f; + float orbSpeed = 5f; + + float spinCoinflip = Main.rand.NextBool() ? -1f : 1f; + Vector2 dir = Main.rand.NextVector2Unit(); + for (int i = 0; i < numOrbs; i++) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - else - { - num80 = num72 / num80; - } - vector2 += new Vector2(num78, num79); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - float passedVar = 1f; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, passedVar, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, -passedVar, 0f); - passedVar += 1f; + Vector2 orbPos = clickPos + dir * orbDistance; + Vector2 vel = dir.RotatedBy(spinCoinflip * MathHelper.PiOver2) * orbSpeed; + + // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers + float timingStagger = Main.rand.Next(OrbFireRate); + Projectile.NewProjectile(orbPos, vel, type, damage, knockBack, player.whoAmI, timingStagger, spinCoinflip); + dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs); } return false; } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index e9d843cf55..addc5197a5 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -32,10 +32,10 @@ namespace CalamityMod.Projectiles.Magic projectile.velocity *= 0.86f; // Spin chaotically given a pre-defined spin direction. Choose one initially at random. - float theta = 0.03f; - if (projectile.localAI[0] == 0f) - projectile.localAI[0] = Main.rand.NextBool() ? -theta : theta; - projectile.rotation += projectile.localAI[0]; + float spinTheta = 0.11f; + if (projectile.localAI[1] == 0f) + projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; + projectile.rotation += projectile.localAI[1]; // Animate the lightning orb. projectile.frameCounter++; @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Magic } } - ++projectile.ai[1]; // Initial stagger in frames needs to be skipped over before it starts shooting, // but once it's past that then it can fire constantly - if (projectile.ai[1] > projectile.ai[0]) + --projectile.ai[0]; + if (projectile.ai[0] < 0f) CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, Climax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); } diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index eb4b9da4c8..c545e2054a 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -1,16 +1,13 @@ +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class VoidVortexProj : ModProjectile { - private double timeElapsed = 0.0; - private double circleSize = 1.0; - private double circleGrowth = 0.02; - public override void SetStaticDefaults() { DisplayName.SetDefault("Void Vortex"); @@ -23,29 +20,21 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 38; projectile.friendly = true; projectile.ignoreWater = true; - projectile.light = 0.5f; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 420; + projectile.timeLeft = 180; projectile.magic = true; } public override void AI() { - timeElapsed += 0.02; - projectile.velocity.X = (float)(Math.Sin(timeElapsed * (0.5f * projectile.ai[0])) * circleSize); - projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (0.5f * projectile.ai[0])) * circleSize); - circleSize += circleGrowth; - - if (projectile.velocity.X > 0f) - { - projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } - else - { - projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; - } + // Spin chaotically given a pre-defined spin direction. Choose one initially at random. + float spinTheta = 0.11f; + if (projectile.localAI[1] == 0f) + projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; + projectile.rotation += projectile.localAI[1]; + // Animate the lightning orb. projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -57,7 +46,15 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 8f, 2, ModContent.ProjectileType(), 1D, true); + // Spiral outwards in an increasingly chaotic fashion. + float revolutionTheta = 0.12f * projectile.ai[1]; + projectile.velocity = projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + + // Initial stagger in frames needs to be skipped over before it starts shooting, + // but once it's past that then it can fire constantly + --projectile.ai[0]; + if (projectile.ai[0] < 0f) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) From 0526bfb1a3107e5525b1aad7298b0c086251ea3d Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 15:41:05 -0500 Subject: [PATCH 46/57] Thanatos Chicken Cannon resist 50% -> 75% --- NPCs/CalamityGlobalNPC.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 0f5fa90ded..fcf4f100c3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3509,18 +3509,14 @@ namespace CalamityMod.NPCs } else if (ThanatosIDs.Contains(npc.type)) { - // 75% resist to Celestus. - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + // 75% resist to Celestus and Chicken Cannon. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.25); // 65% resist to true melee and Hadopelagic Echo. else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.35); - // 50% resist to Chicken Cannon. - if (projectile.type == ProjectileType()) - damage = (int)(damage * 0.5); - // 40% resist to Wrathwing stealth strike, Rancor, and Yharim's Crystal. else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.6); From 7ac34b65c532cfebaed9afb142e8a318b748c065 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 16:06:00 -0500 Subject: [PATCH 47/57] Fixed Silva Mage set bonus being broken. This will require retesting Helium Flash and Vehemence. --- CalPlayer/CalamityPlayerOnHit.cs | 39 ++++++-------------- Items/Armor/SilvaMaskedCap.cs | 2 +- Projectiles/Magic/SilvaBurst.cs | 53 ++++++++++++++++++++++++++++ Projectiles/Typeless/DirectStrike.cs | 4 +-- Utilities/ProjectileUtils.cs | 2 +- 5 files changed, 68 insertions(+), 32 deletions(-) create mode 100644 Projectiles/Magic/SilvaBurst.cs diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index b41939dbb4..7d1f6857ff 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -86,8 +86,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { // Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage - int cappedDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45); - Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), cappedDamage, 2f, player.whoAmI, 0f, 0f); + int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45); + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, player.whoAmI, 0f, 0f); } if (modPlayer.soaring) { @@ -211,8 +211,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { // Ataxia Melee Geysers: 15%, softcap starts at 240 base damage - int cappedDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36); - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), cappedDamage, 0f, player.whoAmI, 0f, 0f); + int geyserDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), geyserDamage, 0f, player.whoAmI, 0f, 0f); } if (modPlayer.bloodflareMelee && modProj.trueMelee) { @@ -294,8 +294,8 @@ namespace CalamityMod.CalPlayer { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); // Bloodflare Mage Fireballs: 3 x 50%, softcap starts at 500 base damage to not overly punish slow weapons - int cappedDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250); - int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, cappedDamage, 0f, player.whoAmI); + int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250); + int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, bloodflareFireballDamage, 0f, player.whoAmI); if (fire.WithinBounds(Main.maxProjectiles)) { Main.projectile[fire].Calamity().forceTypeless = true; @@ -308,26 +308,9 @@ namespace CalamityMod.CalPlayer { modPlayer.silvaMageCooldown = 300; Main.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103); - CalamityGlobalProjectile.ExpandHitboxBy(proj, 96); - for (int d = 0; d < 3; d++) - { - Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - } - for (int d = 0; d < 30; d++) - { - int explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); - Main.dust[explode].noGravity = true; - Main.dust[explode].velocity *= 3f; - explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[explode].velocity *= 2f; - Main.dust[explode].noGravity = true; - } - // Silva Mage Blasts: 300% - proj.damage *= 3; - proj.localNPCHitCooldown = 10; - proj.usesLocalNPCImmunity = true; - proj.Damage(); - proj.Kill(); + // Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400 + int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, player.whoAmI); } } #endregion @@ -713,8 +696,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 5) || Main.rand.NextBool(4))) { // Umbraphile Rogue Blasts: 25%, softcap starts at 200 base damage - int blastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50); - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), blastDamage, 0f, player.whoAmI); + int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, player.whoAmI); } if (modPlayer.raiderTalisman && modPlayer.raiderStack < 150 && crit && modPlayer.raiderCooldown <= 0) diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index e48c218a3b..5714cebda5 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" + "This effect only triggers once per life\n" + - "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits"; + "Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy"; } public override void UpdateEquip(Player player) diff --git a/Projectiles/Magic/SilvaBurst.cs b/Projectiles/Magic/SilvaBurst.cs new file mode 100644 index 0000000000..851647bc8b --- /dev/null +++ b/Projectiles/Magic/SilvaBurst.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SilvaBurst : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Burst"); + } + + public override void SetDefaults() + { + projectile.width = 96; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.alpha = 255; + projectile.timeLeft = 2; + } + + public override void AI() + { + // Create a bright burst of Silva light. + float brightness = 1.6f; + Lighting.AddLight(projectile.Center, 0.27f * brightness, 0.82f * brightness, 0.157f * brightness); + + // Produce a bunch of dust. + int dustID = 157; + for (int d = 0; d < 3; d++) + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + + for (int d = 0; d < 30; d++) + { + int explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); + Main.dust[explode].noGravity = true; + Main.dust[explode].velocity *= 3f; + explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Main.dust[explode].velocity *= 2f; + Main.dust[explode].noGravity = true; + } + } + } +} diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index 787b439876..e066310c5e 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -19,16 +19,16 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.penetrate = 1; projectile.extraUpdates = 0; + projectile.tileCollide = false; projectile.ignoreWater = true; projectile.alpha = 255; projectile.timeLeft = 2; } // If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC. - // TODO -- this might actually not work in multiplayer if the DirectStrike gets synced... public override bool? CanHitNPC(NPC target) { - if (projectile.ai[0] < 0f || projectile.ai[0] > 199f || projectile.ai[0] == target.whoAmI) + if (projectile.ai[0] < 0f || projectile.ai[0] > 199f || projectile.ai[0] == target.whoAmI) return null; return (bool?)false; } diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 123626f546..a0c0eb267d 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -139,7 +139,7 @@ namespace CalamityMod { // If the incoming damage is less than the cap, don't do anything. if (dmgInput < cap) - return (int)(dmgInput); + return (int)dmgInput; // Ratio of how far over the cap you are. // This is a value from 1.0 upwards to theoretically infinity. From aae924477d8e1d863dadb522d9af00e64cd38455 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 16:14:10 -0500 Subject: [PATCH 48/57] Godly Soul Artifact reworked, it's not broken now --- CalPlayer/CalamityPlayerMiscEffects.cs | 14 ++------------ Items/Accessories/GodlySoulArtifact.cs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3a282d3959..0f7f2b079e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3426,18 +3426,8 @@ namespace CalamityMod.CalPlayer player.maxMinions += 2; } - if (modPlayer.gArtifact) - { - player.maxMinions += 10; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - player.AddBuff(ModContent.BuffType(), 3600, true); - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(AngryChickenStaff.Damage * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); - } - } + if (modPlayer.gArtifact && player.FindBuffIndex(ModContent.BuffType()) != -1) + player.maxMinions += player.ownedProjectileCounts[ModContent.ProjectileType()]; if (modPlayer.pArtifact) { diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 0b0f433ba8..f0edcc0b1d 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Godly Soul Artifact"); Tooltip.SetDefault("Loyalty\n" + - "Summons two Sons of Yharon to fight for you"); + "For each Son of Yharon you have summoned, you gain 1 minion slot"); } public override void SetDefaults() { item.width = 28; item.height = 28; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - } + item.accessory = true; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -36,10 +36,10 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.DemonAltar); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DemonAltar); recipe.SetResult(this); recipe.AddRecipe(); } From ca9f66e66b7de774ca4f116baa68bfe72518966e Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 16:18:26 -0500 Subject: [PATCH 49/57] Violence now ignores pierce resistance because it's basically a yoyo. --- CalamityLists.cs | 3 ++- Projectiles/Melee/ViolenceThrownProjectile.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CalamityLists.cs b/CalamityLists.cs index 429044831f..c85b1642ec 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -2775,7 +2775,8 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType() + ProjectileType(), + ProjectileType(), }; bossTypes = new SortedDictionary() diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 0fcf8ac827..0315288d26 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; - projectile.tileCollide = false; + projectile.tileCollide = false; } public override void AI() From 44bfe91d49f1c1d21ad77de78f6a5ee4ac59a9a8 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 7 Nov 2021 16:58:02 -0500 Subject: [PATCH 50/57] Thanatos resists Vehemence skulls by 50% --- NPCs/CalamityGlobalNPC.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index fcf4f100c3..e79ec416a0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3517,6 +3517,10 @@ namespace CalamityMod.NPCs else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.35); + // 50% resist to Vehemence skulls. + else if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + // 40% resist to Wrathwing stealth strike, Rancor, and Yharim's Crystal. else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) damage = (int)(damage * 0.6); From d060c717b873fc18c9d033848710651cf29534f9 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 7 Nov 2021 21:26:51 -0600 Subject: [PATCH 51/57] 1 - Boss timed biome enrages. --- NPCs/CalamityAI.cs | 11 +++---- NPCs/CalamityGlobalNPC.cs | 3 ++ NPCs/Cryogen/Cryogen.cs | 22 ++++++++++--- NPCs/DesertScourge/DesertScourgeHead.cs | 22 ++++++++++--- NPCs/HiveMind/HiveMind.cs | 18 +++++++++-- NPCs/Leviathan/Leviathan.cs | 26 ++++++++++++---- NPCs/Leviathan/Siren.cs | 26 +++++++++++----- NPCs/Perforator/PerforatorHeadLarge.cs | 20 ++++++++++-- NPCs/Perforator/PerforatorHeadSmall.cs | 31 ++++++++++++++++--- NPCs/Perforator/PerforatorHive.cs | 30 ++++++++++++++++-- .../PlaguebringerGoliath.cs | 21 ++++++++++--- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 16 +++++----- .../ProfanedGuardianBoss2.cs | 17 +++++----- .../ProfanedGuardianBoss3.cs | 17 +++++----- NPCs/Providence/Providence.cs | 25 ++++++++------- 15 files changed, 226 insertions(+), 79 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 74b647f631..fd478601ea 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -4594,17 +4594,14 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - // If target is outside the jungle for more than 3 seconds, enrage + // If target is outside the jungle for more than 5 seconds, enrage if (!player.ZoneJungle) { - if (npc.localAI[1] < 300f) + if (npc.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) npc.localAI[1] += 1f; } else - { - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } + npc.localAI[1] = 0f; // If dragonfolly is off screen, enrage for the next couple attacks if (Vector2.Distance(player.Center, vector) > 1200f) @@ -4612,7 +4609,7 @@ namespace CalamityMod.NPCs // Enrage scale float enrageScale = death ? 1.5f : 1f; - if (npc.localAI[1] >= 300f || malice) + if (npc.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || malice) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 27d1a4bffc..5fa1cc51c7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -84,6 +84,9 @@ namespace CalamityMod.NPCs public const int DoGPhase1KillTime = 5400; public const int DoGPhase2KillTime = 9000; + // Biome enrage timer max + public const int biomeEnrageTimerMax = 300; + public bool ShouldFallThroughPlatforms; /// diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 9fd8c429a5..cd384d6c9c 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -27,7 +27,8 @@ namespace CalamityMod.NPCs.Cryogen [AutoloadBossHead] public class Cryogen : ModNPC { - private int time = 0; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private int time = 0; private int iceShard = 0; private int currentPhase = 1; private int teleportLocationX = 0; @@ -66,7 +67,8 @@ namespace CalamityMod.NPCs.Cryogen public override void SendExtraAI(BinaryWriter writer) { - writer.Write(time); + writer.Write(biomeEnrageTimer); + writer.Write(time); writer.Write(iceShard); writer.Write(teleportLocationX); writer.Write(npc.dontTakeDamage); @@ -76,7 +78,8 @@ namespace CalamityMod.NPCs.Cryogen public override void ReceiveExtraAI(BinaryReader reader) { - time = reader.ReadInt32(); + biomeEnrageTimer = reader.ReadInt32(); + time = reader.ReadInt32(); iceShard = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); @@ -106,8 +109,19 @@ namespace CalamityMod.NPCs.Cryogen bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + // Enrage + if (!player.ZoneSnow && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = death ? 0.5f : 0f; - if (!player.ZoneSnow || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index f2b979ec74..1a1c21c06d 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -25,7 +25,8 @@ namespace CalamityMod.NPCs.DesertScourge [AutoloadBossHead] public class DesertScourgeHead : ModNPC { - private bool TailSpawned = false; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private bool TailSpawned = false; public bool playRoarSound = false; public override void SetStaticDefaults() @@ -69,14 +70,16 @@ namespace CalamityMod.NPCs.DesertScourge public override void SendExtraAI(BinaryWriter writer) { - writer.Write(playRoarSound); + writer.Write(biomeEnrageTimer); + writer.Write(playRoarSound); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - playRoarSound = reader.ReadBoolean(); + biomeEnrageTimer = reader.ReadInt32(); + playRoarSound = reader.ReadBoolean(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } @@ -101,8 +104,19 @@ namespace CalamityMod.NPCs.DesertScourge Player player = Main.player[npc.target]; + // Enrage + if (!player.ZoneDesert && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if (!player.ZoneDesert || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 0051746980..c4029f99da 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -50,6 +50,7 @@ namespace CalamityMod.NPCs.HiveMind } // This block of values can be modified in SetDefaults() based on difficulty mode or something + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private int burrowTimer = 420; private int minimumDriftTime = 300; private int teleportRadius = 300; @@ -157,6 +158,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SendExtraAI(BinaryWriter writer) { + writer.Write(biomeEnrageTimer); writer.Write(npc.dontTakeDamage); writer.Write(npc.noTileCollide); writer.Write(npc.noGravity); @@ -178,6 +180,7 @@ namespace CalamityMod.NPCs.HiveMind public override void ReceiveExtraAI(BinaryReader reader) { + biomeEnrageTimer = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); npc.noTileCollide = reader.ReadBoolean(); npc.noGravity = reader.ReadBoolean(); @@ -362,13 +365,24 @@ namespace CalamityMod.NPCs.HiveMind lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; } + // Enrage + if ((!player.ZoneCorrupt || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if (biomeEnraged && (!player.ZoneCorrupt || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (!player.ZoneCorrupt || malice) + if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 52270b2e0c..18f4f9c341 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -26,9 +26,10 @@ namespace CalamityMod.NPCs.Leviathan [AutoloadBossHead] public class Leviathan : ModNPC { - int counter = 0; - bool initialised = false; - int soundDelay = 0; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private int counter = 0; + private bool initialised = false; + private int soundDelay = 0; public static Texture2D AttackTexture = null; public override void SetStaticDefaults() @@ -68,14 +69,16 @@ namespace CalamityMod.NPCs.Leviathan public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); + writer.Write(biomeEnrageTimer); + writer.Write(npc.dontTakeDamage); writer.Write(soundDelay); writer.Write(npc.Calamity().newAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); + biomeEnrageTimer = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); soundDelay = reader.ReadInt32(); npc.Calamity().newAI[3] = reader.ReadSingle(); } @@ -158,8 +161,19 @@ namespace CalamityMod.NPCs.Leviathan bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + // Enrage + if (notOcean && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if (notOcean || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 4da4020b83..b9bba4ca39 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,6 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Events; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; @@ -17,7 +15,8 @@ namespace CalamityMod.NPCs.Leviathan [AutoloadBossHead] public class Siren : ModNPC { - private bool spawnedLevi = false; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private bool spawnedLevi = false; private bool forceChargeFrames = false; private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; @@ -66,7 +65,8 @@ namespace CalamityMod.NPCs.Leviathan public override void SendExtraAI(BinaryWriter writer) { - writer.Write(spawnedLevi); + writer.Write(biomeEnrageTimer); + writer.Write(spawnedLevi); writer.Write(forceChargeFrames); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[2]); @@ -79,7 +79,8 @@ namespace CalamityMod.NPCs.Leviathan public override void ReceiveExtraAI(BinaryReader reader) { - spawnedLevi = reader.ReadBoolean(); + biomeEnrageTimer = reader.ReadInt32(); + spawnedLevi = reader.ReadBoolean(); forceChargeFrames = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[2] = reader.ReadSingle(); @@ -125,8 +126,19 @@ namespace CalamityMod.NPCs.Leviathan bool expertMode = Main.expertMode || malice; bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + // Enrage + if (notOcean && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if (notOcean || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 742cb16347..0344c14c11 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -15,7 +15,8 @@ namespace CalamityMod.NPCs.Perforator [AutoloadBossHead] public class PerforatorHeadLarge : ModNPC { - private bool TailSpawned = false; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private bool TailSpawned = false; public override void SetStaticDefaults() { @@ -54,12 +55,14 @@ namespace CalamityMod.NPCs.Perforator public override void SendExtraAI(BinaryWriter writer) { + writer.Write(biomeEnrageTimer); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { + biomeEnrageTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } @@ -74,10 +77,21 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + // Enrage + if ((!Main.player[npc.target].ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if (biomeEnraged && (!Main.player[npc.target].ZoneCrimson || malice)) enrageScale += 1f; - if (!Main.player[npc.target].ZoneCrimson || malice) + if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) enrageScale += 1f; if (BossRushEvent.BossRushActive) enrageScale += 1f; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 76b957f403..423f4ba337 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -5,6 +5,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +15,8 @@ namespace CalamityMod.NPCs.Perforator [AutoloadBossHead] public class PerforatorHeadSmall : ModNPC { - private const int MsgType = 23; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private const int MsgType = 23; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -51,7 +53,17 @@ namespace CalamityMod.NPCs.Perforator npc.scale = 1.1f; } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(biomeEnrageTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + biomeEnrageTimer = reader.ReadInt32(); + } + + public override void AI() { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -61,10 +73,21 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; + // Enrage + if ((!Main.player[npc.target].ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if (biomeEnraged && (!Main.player[npc.target].ZoneCrimson || malice)) enrageScale += 1f; - if (!Main.player[npc.target].ZoneCrimson || malice) + if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) enrageScale += 1f; if (BossRushEvent.BossRushActive) enrageScale += 1f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 2c8849a4d5..2c0d8d65bb 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -18,6 +18,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +28,8 @@ namespace CalamityMod.NPCs.Perforator [AutoloadBossHead] public class PerforatorHive : ModNPC { - private bool small = false; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private bool small = false; private bool medium = false; private bool large = false; @@ -69,6 +71,16 @@ namespace CalamityMod.NPCs.Perforator npc.frame.Y = frame * frameHeight; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(biomeEnrageTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + biomeEnrageTimer = reader.ReadInt32(); + } + public override void AI() { CalamityGlobalNPC.perfHive = npc.whoAmI; @@ -118,13 +130,24 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; + // Enrage + if ((!player.ZoneCrimson || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if (biomeEnraged && (!player.ZoneCrimson || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (!Main.player[npc.target].ZoneCrimson || malice) + if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; @@ -153,6 +176,7 @@ namespace CalamityMod.NPCs.Perforator if (npc.timeLeft > 60) npc.timeLeft = 60; + return; } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 2b0d3441bf..51d7314781 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -29,7 +29,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath [AutoloadBossHead] public class PlaguebringerGoliath : ModNPC { - private const float MissileAngleSpread = 60; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private const float MissileAngleSpread = 60; private const int MissileProjectiles = 8; private int MissileCountdown = 0; private int despawnTimer = 120; @@ -74,7 +75,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SendExtraAI(BinaryWriter writer) { - writer.Write(halfLife); + writer.Write(biomeEnrageTimer); + writer.Write(halfLife); writer.Write(canDespawn); writer.Write(flyingFrame2); writer.Write(MissileCountdown); @@ -87,7 +89,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void ReceiveExtraAI(BinaryReader reader) { - halfLife = reader.ReadBoolean(); + biomeEnrageTimer = reader.ReadInt32(); + halfLife = reader.ReadBoolean(); canDespawn = reader.ReadBoolean(); flyingFrame2 = reader.ReadBoolean(); MissileCountdown = reader.ReadInt32(); @@ -192,8 +195,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 distFromPlayer = player.Center - vectorCenter; // Enrage + if (!player.ZoneJungle && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = death ? 0.5f : 0f; - if (!player.ZoneJungle || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1.5f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 8fb195a90f..1315ac41b7 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -24,9 +24,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians { private int spearType = 0; private int dustTimer = 3; - private int immuneTimer = 300; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Guardian"); Main.npcFrameCount[npc.type] = 6; @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { writer.Write(spearType); writer.Write(dustTimer); - writer.Write(immuneTimer); + writer.Write(biomeEnrageTimer); writer.Write(npc.dontTakeDamage); } @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { spearType = reader.ReadInt32(); dustTimer = reader.ReadInt32(); - immuneTimer = reader.ReadInt32(); + biomeEnrageTimer = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); } @@ -155,19 +155,19 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool isHell = player.ZoneUnderworldHeight; if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { - if (immuneTimer > 0) - immuneTimer--; + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; else npc.Calamity().CurrentlyEnraged = true; } else - immuneTimer = 300; + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; if (enraged) npc.Calamity().CurrentlyEnraged = true; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0 && !malice; + npc.dontTakeDamage = biomeEnrageTimer <= 0 && !malice; bool flag100 = false; for (int num569 = 0; num569 < Main.maxNPCs; num569++) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index bc696f885e..91bd066823 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -17,8 +17,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians [AutoloadBossHead] public class ProfanedGuardianBoss2 : ModNPC { - private int immuneTimer = 300; - public override void SetStaticDefaults() + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Guardian"); Main.npcFrameCount[npc.type] = 6; @@ -51,13 +52,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SendExtraAI(BinaryWriter writer) { - writer.Write(immuneTimer); + writer.Write(biomeEnrageTimer); writer.Write(npc.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - immuneTimer = reader.ReadInt32(); + biomeEnrageTimer = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); } @@ -92,16 +93,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Become immune over time if target isn't in hell or hallow if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { - if (immuneTimer > 0) - immuneTimer--; + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; else npc.Calamity().CurrentlyEnraged = true; } else - immuneTimer = 300; + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0 && !malice; + npc.dontTakeDamage = biomeEnrageTimer <= 0 && !malice; Vector2 vectorCenter = npc.Center; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 3fd6e5f742..df79e0d789 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -17,8 +17,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians [AutoloadBossHead] public class ProfanedGuardianBoss3 : ModNPC { - private int immuneTimer = 300; - public override void SetStaticDefaults() + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Guardian"); Main.npcFrameCount[npc.type] = 6; @@ -51,13 +52,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SendExtraAI(BinaryWriter writer) { - writer.Write(immuneTimer); + writer.Write(biomeEnrageTimer); writer.Write(npc.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { - immuneTimer = reader.ReadInt32(); + biomeEnrageTimer = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); } @@ -92,16 +93,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Become immune over time if target isn't in hell or hallow if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { - if (immuneTimer > 0) - immuneTimer--; + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; else npc.Calamity().CurrentlyEnraged = true; } else - immuneTimer = 300; + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0 && !malice; + npc.dontTakeDamage = biomeEnrageTimer <= 0 && !malice; Vector2 vectorCenter = npc.Center; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 70cf6178d3..5387dc401e 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.Providence private int biomeType = 0; private int flightPath = 0; private int phaseChange = 0; - private int immuneTimer = 300; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private int frameUsed = 0; private int healTimer = 0; internal bool challenge = Main.expertMode/* && Main.netMode == NetmodeID.SinglePlayer*/; //Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. @@ -113,7 +113,7 @@ namespace CalamityMod.NPCs.Providence writer.Write(useDefenseFrames); writer.Write(biomeType); writer.Write(phaseChange); - writer.Write(immuneTimer); + writer.Write(biomeEnrageTimer); writer.Write(frameUsed); writer.Write(healTimer); writer.Write(flightPath); @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Providence useDefenseFrames = reader.ReadBoolean(); biomeType = reader.ReadInt32(); phaseChange = reader.ReadInt32(); - immuneTimer = reader.ReadInt32(); + biomeEnrageTimer = reader.ReadInt32(); frameUsed = reader.ReadInt32(); healTimer = reader.ReadInt32(); flightPath = reader.ReadInt32(); @@ -215,7 +215,7 @@ namespace CalamityMod.NPCs.Providence if (nightTime) projectileDamageMult = 2; - npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || enraged; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || enraged || biomeEnrageTimer <= 0; // Projectile damage values int holyLaserDamage = npc.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; @@ -344,14 +344,15 @@ namespace CalamityMod.NPCs.Providence // Become immune over time if target isn't in hell or hallow if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { - if (immuneTimer > 0) - immuneTimer--; + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; } else - immuneTimer = 300; + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0 && !malice; + // Take damage or not + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + npc.dontTakeDamage = biomeEnraged && !malice; // Heal if (healerAlive) @@ -487,7 +488,7 @@ namespace CalamityMod.NPCs.Providence // Velocity and acceleration float speedIncreaseTimer = enraged ? 60f : nightTime ? 75f : death ? 120f : 150f; - bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer; + bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || biomeEnraged; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; @@ -505,8 +506,10 @@ namespace CalamityMod.NPCs.Providence else if (increaseSpeed) { velocity += (calamityGlobalNPC.newAI[0] - speedIncreaseTimer) * 0.04f; - if (velocity > 30f) + if (velocity > 30f || biomeEnraged) velocity = 30f; + if (biomeEnraged) + acceleration = 2f; } if (!targetDead) From 5200fd128866c3535b56c659ffc3abcb1d480a44 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 8 Nov 2021 00:07:14 -0600 Subject: [PATCH 52/57] 1 - More boss timed biome enrages. --- NPCs/AquaticScourge/AquaticScourgeHead.cs | 2 + NPCs/CalamityAI.cs | 50 ++++++++++++++++++++--- NPCs/Crabulon/CrabulonIdle.cs | 20 +++++++-- NPCs/OldDuke/OldDuke.cs | 2 + 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 938137f84f..9fe62bb7f2 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -67,6 +67,7 @@ namespace CalamityMod.NPCs.AquaticScourge { writer.Write(npc.chaseable); writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } @@ -75,6 +76,7 @@ namespace CalamityMod.NPCs.AquaticScourge { npc.chaseable = reader.ReadBoolean(); npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index fd478601ea..602e36dde0 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -99,8 +99,22 @@ namespace CalamityMod.NPCs player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + // Enrage + if (head) + { + if (notOcean && !player.Calamity().ZoneSulphur && !BossRushEvent.BossRushActive) + { + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + } + else + npc.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; + } + + bool biomeEnraged = npc.localAI[2] <= 0f || malice; + float enrageScale = 0f; - if ((!player.Calamity().ZoneSulphur && notOcean) || malice) + if (biomeEnraged) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 2f; @@ -689,10 +703,24 @@ namespace CalamityMod.NPCs bool phase2 = lifeRatio < 0.5f && revenge; bool phase3 = lifeRatio < 0.33f; + // Enrage + if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !BossRushEvent.BossRushActive) + { + if (calamityGlobalNPC.newAI[3] > 0f) + calamityGlobalNPC.newAI[3] -= 1f; + } + else + calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || malice; + float enrageScale = 0f; - if (!player.ZoneUnderworldHeight || malice) + if (biomeEnraged && (!player.ZoneUnderworldHeight || malice)) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; - if (!modPlayer.ZoneCalamity || malice) + } + if (biomeEnraged && (!modPlayer.ZoneCalamity || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; @@ -5436,14 +5464,26 @@ namespace CalamityMod.NPCs bool enrage = !BossRushEvent.BossRushActive && (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - npc.Calamity().CurrentlyEnraged = enrage || enraged; + + // Enrage + if (enrage) + { + if (npc.localAI[1] > 0f) + npc.localAI[1] -= 1f; + } + else + npc.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = npc.localAI[1] <= 0f || malice; + + npc.Calamity().CurrentlyEnraged = biomeEnraged || enraged; // If the player isn't in the ocean biome or Old Duke is transitioning between phases, become immune if (!phase3AI) npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; // Enrage - if (enrage || enraged) + if (biomeEnraged || enraged) { toothBallBelchPhaseTimer = 30; toothBallBelchPhaseDivisor = 6; diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 6b83da156d..621631fce8 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -23,7 +23,8 @@ namespace CalamityMod.NPCs.Crabulon [AutoloadBossHead] public class CrabulonIdle : ModNPC { - private int shotSpacing = 1000; + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private int shotSpacing = 1000; public override void SetStaticDefaults() { @@ -57,12 +58,14 @@ namespace CalamityMod.NPCs.Crabulon public override void SendExtraAI(BinaryWriter writer) { + writer.Write(biomeEnrageTimer); writer.Write(npc.localAI[0]); writer.Write(shotSpacing); } public override void ReceiveExtraAI(BinaryReader reader) { + biomeEnrageTimer = reader.ReadInt32(); npc.localAI[0] = reader.ReadSingle(); shotSpacing = reader.ReadInt32(); } @@ -138,13 +141,24 @@ namespace CalamityMod.NPCs.Crabulon else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + // Enrage + if ((!player.ZoneGlowshroom || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) + { + if (biomeEnrageTimer > 0) + biomeEnrageTimer--; + } + else + biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = biomeEnrageTimer <= 0 || malice; + float enrageScale = 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || malice) + if (biomeEnraged && ((npc.position.Y / 16f) < Main.worldSurface || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; } - if (!player.ZoneGlowshroom || malice) + if (biomeEnraged && (!player.ZoneGlowshroom || malice)) { npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; enrageScale += 1f; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index c17cb309c9..e7472a5465 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -63,6 +63,7 @@ namespace CalamityMod.NPCs.OldDuke { writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); writer.Write(npc.rotation); writer.Write(npc.spriteDirection); for (int i = 0; i < 4; i++) @@ -73,6 +74,7 @@ namespace CalamityMod.NPCs.OldDuke { npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); npc.rotation = reader.ReadSingle(); npc.spriteDirection = reader.ReadInt32(); for (int i = 0; i < 4; i++) From b1c67817a21fdceccaf8025658a185b1924f99f6 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 8 Nov 2021 01:23:51 -0600 Subject: [PATCH 53/57] 1 - Brimstone Elemental fixes. --- NPCs/CalamityAI.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 602e36dde0..24b27df615 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -787,7 +787,7 @@ namespace CalamityMod.NPCs int phase; int random = phase2 ? 6 : 5; do phase = Main.rand.Next(random); - while (phase == npc.ai[1] || (phase == 0 && phase3) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); + while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); npc.ai[0] = phase; npc.ai[1] = 0f; @@ -1125,6 +1125,8 @@ namespace CalamityMod.NPCs // Laser beam attack else if (npc.ai[0] == 5f) { + npc.chaseable = true; + npc.defense = npc.defDefense * 2; Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); From 28ed4b7d6cc085e363b902b66cc3eeee0c0e3418 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 8 Nov 2021 01:39:05 -0600 Subject: [PATCH 54/57] 1 - Tried to fix rogue clockwork BULLSHIT. --- Items/CalamityGlobalItem.cs | 12 +++--------- Items/Weapons/Rogue/AshenStalactite.cs | 1 - Items/Weapons/Rogue/CosmicKunai.cs | 1 - Items/Weapons/Rogue/Equanimity.cs | 1 - Items/Weapons/Rogue/ExecutionersBlade.cs | 1 - Items/Weapons/Rogue/FeatherKnife.cs | 1 - Items/Weapons/Rogue/GhoulishGouger.cs | 1 - Items/Weapons/Rogue/Hypothermia.cs | 1 - Items/Weapons/Rogue/RogueWeapon.cs | 2 +- Items/Weapons/Rogue/SylvanSlasher.cs | 1 - Items/Weapons/Rogue/UtensilPoker.cs | 1 - 11 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index b49c59f644..d968f71d24 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -82,7 +82,6 @@ namespace CalamityMod.Items public bool challengeDrop = false; public bool canFirePointBlankShots = false; public bool trueMelee = false; - public bool rogueClockworkWeapon = false; public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -842,7 +841,7 @@ namespace CalamityMod.Items { speedX *= modPlayer.throwingVelocity; speedY *= modPlayer.throwingVelocity; - if (modPlayer.gloveOfRecklessness && !rogueClockworkWeapon) + if (modPlayer.gloveOfRecklessness && item.useTime == item.useAnimation) { Vector2 rotated = new Vector2(speedX, speedY); rotated = rotated.RotatedByRandom(MathHelper.ToRadians(6f)); @@ -1100,7 +1099,7 @@ namespace CalamityMod.Items #region Saving And Loading public override bool NeedsSaving(Item item) { - return rogue || canFirePointBlankShots || trueMelee || rogueClockworkWeapon || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; + return rogue || canFirePointBlankShots || trueMelee || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; } public override TagCompound Save(Item item) @@ -1115,8 +1114,7 @@ namespace CalamityMod.Items ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0, ["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion, ["canFirePointBlankShots"] = canFirePointBlankShots, - ["trueMelee"] = trueMelee, - ["rogueClockworkWeapon"] = rogueClockworkWeapon + ["trueMelee"] = trueMelee }; } @@ -1125,7 +1123,6 @@ namespace CalamityMod.Items rogue = tag.GetBool("rogue"); canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); trueMelee = tag.GetBool("trueMelee"); - rogueClockworkWeapon = tag.GetBool("rogueClockworkWeapon"); timesUsed = tag.GetInt("timesUsed"); customRarity = (CalamityRarity)tag.GetInt("rarity"); @@ -1160,7 +1157,6 @@ namespace CalamityMod.Items rogue = flags[0]; canFirePointBlankShots = flags[1]; trueMelee = flags[2]; - rogueClockworkWeapon = flags[3]; } else { @@ -1174,7 +1170,6 @@ namespace CalamityMod.Items flags[0] = rogue; flags[1] = canFirePointBlankShots; flags[2] = trueMelee; - flags[3] = rogueClockworkWeapon; writer.Write(flags); writer.Write((int)customRarity); @@ -1191,7 +1186,6 @@ namespace CalamityMod.Items rogue = flags[0]; canFirePointBlankShots = flags[1]; trueMelee = flags[2]; - rogueClockworkWeapon = flags[3]; customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index bd9bc378c9..e73b043d3d 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index b2de0e331e..23fb6214f9 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = 28f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 4ecea000dd..47f13736a0 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 80fe3f46e2..872722424b 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = 26f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index a4dfbdbe15..1289b67463 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -34,7 +34,6 @@ Stealth strike throws a volley of knives"); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; item.value = Item.sellPrice(copper: 60); item.rare = ItemRarityID.Orange; diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index 312e3b2239..c63c8be709 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index ea1fbd2e4c..f21e1a2e0a 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.DarkBlue; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index b9931bf540..0fbf20d9e0 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Rogue { float baseMultiplier = SafeSetUseTimeMultiplier(player); float rogueAS = baseMultiplier == -1f ? 1f : baseMultiplier; - if (!item.Calamity().rogueClockworkWeapon) + if (item.useTime == item.useAnimation) { if (player.Calamity().gloveOfPrecision) rogueAS -= 0.2f; diff --git a/Items/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs index dbf20587aa..c7e12d69ae 100644 --- a/Items/Weapons/Rogue/SylvanSlasher.cs +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -20,7 +20,6 @@ Does not consume stealth and cannot stealth strike"); item.width = 72; item.damage = 52; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; item.noMelee = true; item.noUseGraphic = true; item.channel = true; diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index a1f70769a5..4500d58c06 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 66; item.damage = 333; item.Calamity().rogue = true; - item.Calamity().rogueClockworkWeapon = true; item.knockBack = 8f; item.noMelee = true; item.noUseGraphic = true; From ae40c0e74098c9d615ac23d79eaf8e6884a2390c Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 8 Nov 2021 02:40:17 -0600 Subject: [PATCH 55/57] 1 - SW AND DOG FIXED!? --- NPCs/DevourerofGods/DevourerofGodsBody.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsTail.cs | 2 +- NPCs/StormWeaver/StormWeaverBody.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 2 +- NPCs/StormWeaver/StormWeaverTail.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 9f2e068018..64df3fafe4 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -258,7 +258,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 443716fe6b..e0ac82132d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -2065,7 +2065,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHeadS") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 2f475dc59a..1544c34ed4 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -277,7 +277,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool useOtherTextures = phase2Started && CalamityWorld.DoGSecondStageCountdown <= 60; Texture2D texture2D15 = useOtherTextures ? ModContent.GetTexture("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0f410ff125..58aaf2db52 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.StormWeaver bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverBodyNaked") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 825f04c1f2..34293092eb 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -620,7 +620,7 @@ namespace CalamityMod.NPCs.StormWeaver bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index caa326e45c..d92eb60774 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.StormWeaver bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; Texture2D texture2D15 = shedArmor ? ModContent.GetTexture("CalamityMod/NPCs/StormWeaver/StormWeaverTailNaked") : Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; From 25dfdd9c0c0ec71b6ee3203cd91a961cec474733 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 8 Nov 2021 12:24:52 -0500 Subject: [PATCH 56/57] Fixed all volume increases to be properly capped so sounds will always play. --- Projectiles/Magic/AetherfluxCannonHoldout.cs | 2 +- Sounds/Custom/LightningStrike.cs | 3 ++- Sounds/Custom/ProvidenceHolyRay.cs | 3 ++- Sounds/Custom/ProvidenceSpawn.cs | 3 ++- Sounds/Custom/SupremeCalamitasSpawn.cs | 3 ++- Sounds/Item/TankCannon.cs | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index aee42ff97c..45efe4bcd1 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic { var sound = Main.PlaySound(SoundID.DD2_DarkMageCastHeal, projectile.Center); if (sound != null) - sound.Volume *= 1.5f; + sound.Volume = MathHelper.Clamp(sound.Volume * 1.5f, 0f, 1f); } // Update damage based on curent magic damage stat (so Mana Sickness affects it) diff --git a/Sounds/Custom/LightningStrike.cs b/Sounds/Custom/LightningStrike.cs index 08d9be310c..9a5e31eb07 100644 --- a/Sounds/Custom/LightningStrike.cs +++ b/Sounds/Custom/LightningStrike.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Sounds.Custom public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.5f; + soundInstance.Volume = MathHelper.Clamp(volume * 1.5f, 0f, 1f); soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/Custom/ProvidenceHolyRay.cs b/Sounds/Custom/ProvidenceHolyRay.cs index 4402fd67ec..101eef5738 100644 --- a/Sounds/Custom/ProvidenceHolyRay.cs +++ b/Sounds/Custom/ProvidenceHolyRay.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Sounds.Custom public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.25f; + soundInstance.Volume = MathHelper.Clamp(volume * 1.25f, 0f, 1f); soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/Custom/ProvidenceSpawn.cs b/Sounds/Custom/ProvidenceSpawn.cs index f47411c3a5..0adcd25dce 100644 --- a/Sounds/Custom/ProvidenceSpawn.cs +++ b/Sounds/Custom/ProvidenceSpawn.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Sounds.Custom public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.2f; + soundInstance.Volume = MathHelper.Clamp(volume * 1.2f, 0f, 1f); soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/Custom/SupremeCalamitasSpawn.cs b/Sounds/Custom/SupremeCalamitasSpawn.cs index 48a6293bae..cf0261791d 100644 --- a/Sounds/Custom/SupremeCalamitasSpawn.cs +++ b/Sounds/Custom/SupremeCalamitasSpawn.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Sounds.Custom public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.2f; + soundInstance.Volume = MathHelper.Clamp(volume * 1.2f, 0f, 1f); soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/Item/TankCannon.cs b/Sounds/Item/TankCannon.cs index 47305976e9..4cb19ff30b 100644 --- a/Sounds/Item/TankCannon.cs +++ b/Sounds/Item/TankCannon.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Sounds.Item public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.1f; + soundInstance.Volume = MathHelper.Clamp(volume * 1.1f, 0f, 1f); soundInstance.Pan = pan; soundInstance.Pitch = (float)Main.rand.Next(-25, 26) * 0.01f; Main.PlaySoundInstance(soundInstance); From bc7527fbb559addcf849e32f854bb2fd3acb310c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 8 Nov 2021 12:25:59 -0500 Subject: [PATCH 57/57] 1 - Voltaic Climax 140 -> 122 2 - Helium Flash 3474 -> 2838 3 - Nano Purge 66 -> 73 4 - Subsuming Vortex 175 -> 242 5 - Sacrifice 215 -> 290 --- Items/Weapons/Magic/Climax.cs | 2 +- Items/Weapons/Magic/HeliumFlash.cs | 2 +- Items/Weapons/Magic/Purge.cs | 2 +- Items/Weapons/Magic/SubsumingVortex.cs | 2 +- Items/Weapons/Rogue/Sacrifice.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 25a16612f4..dd589bc074 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 140; + item.damage = 122; item.magic = true; item.mana = 30; item.width = 78; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 9b7581ff0f..5ad79941d5 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 112; item.height = 112; item.magic = true; - item.damage = 3474; + item.damage = 2838; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index a4af0eade2..d64404bb97 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 66; + item.damage = 73; item.magic = true; item.mana = 6; item.width = 62; diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index ea34617737..a6bca31c7c 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 175; + item.damage = 242; item.magic = true; item.mana = 78; item.width = 38; diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index 18a4994f3d..fee365b546 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 215; + item.damage = 290; item.width = item.height = 68; item.useAnimation = item.useTime = 9; item.noMelee = true;