From f580e205d898fccb5617933cdacdcd866479748f Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Sat, 27 Jun 2026 22:25:35 -0700 Subject: [PATCH] Oblivion Rework --- CalPlayer/CalamityPlayer.cs | 1 + CalPlayer/CalamityPlayerMiscEffects.cs | 2 + Cooldowns/OblivionCooldown.cs | 17 + Cooldowns/OblivionCooldownOutline.png | Bin 0 -> 2880 bytes Items/Weapons/Melee/Oblivion.cs | 17 +- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 9 +- .../Mods.CalamityMod.Projectiles.Melee.hjson | 2 + Localization/en-US/Mods.CalamityMod.UI.hjson | 1 + Projectiles/Melee/OblivionBolt.cs | 97 +++++ Projectiles/Melee/OblivionFire.cs | 43 +++ Projectiles/Melee/Yoyos/OblivionYoyo.cs | 342 +++++++++++++++++- 11 files changed, 520 insertions(+), 11 deletions(-) create mode 100644 Cooldowns/OblivionCooldown.cs create mode 100644 Cooldowns/OblivionCooldownOutline.png create mode 100644 Projectiles/Melee/OblivionBolt.cs create mode 100644 Projectiles/Melee/OblivionFire.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index da94a934fc..ebff8b8943 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -327,6 +327,7 @@ namespace CalamityMod.CalPlayer public int arsenalCooldown = 0; public int killModeCooldown = 0; public bool demonSwordKillMode = false; + public int oblivionCooldown = 0; public bool exaltedKillMode => (demonSwordKillMode && Player.HeldItem.type == ItemType()); public bool devilsDevastationKillMode => (demonSwordKillMode && Player.HeldItem.type == ItemType()); /// diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index cb171220f8..74c79f631b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2333,6 +2333,8 @@ namespace CalamityMod.CalPlayer arsenalCooldown--; if (killModeCooldown > 0) killModeCooldown--; + if (oblivionCooldown > 0) + oblivionCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; if (transformerCooldown > 0) diff --git a/Cooldowns/OblivionCooldown.cs b/Cooldowns/OblivionCooldown.cs new file mode 100644 index 0000000000..2e87ddcbb4 --- /dev/null +++ b/Cooldowns/OblivionCooldown.cs @@ -0,0 +1,17 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class OblivionCooldown : CooldownHandler + { + public static new string ID => "OblivionCooldown"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Projectiles/Melee/Yoyos/OblivionYoyo"; + public override string OutlineTexture => "CalamityMod/Cooldowns/OblivionCooldownOutline"; + public override Color OutlineColor => Color.MediumVioletRed; + public override Color CooldownStartColor => Color.DarkRed; + public override Color CooldownEndColor => Color.Red; + } +} diff --git a/Cooldowns/OblivionCooldownOutline.png b/Cooldowns/OblivionCooldownOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..edc4369894eed21829240b9e2a4fe4f24cd40851 GIT binary patch literal 2880 zcmV-G3%~Sf6 zXi@@54ZTQ_E-Enz5K6$103tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUF zWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|> z%+C|c55>;RS}qbKr-&IQTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bfe_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l9 z0Z_aBhs|Iw0E)7{bq;-T9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL z1(`yIK=_}U_z%PWq}jQaiQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{w zo%_#%{(V=tO#a9gB!7-$M?^BX5>d|Vn*3S!?g~$*UQipUPL&zMmg;!4Do9IA%up=Rh? z=qPj=x&RGBx1dpI68aT-2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3Oju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvD zRIYI4MQ`g1<+DyrL=EogS06Xii({| zv`U^zjmmKqDIK93(F5q|^fLNk`gQs{RV`IdRle#b)i%{Ds;|}NsClUI)k@Ub)kf6b zsWa4l)YH_rsduU0(?DsMX@qO!YV6TCtMPOWZH~(v?wpc2hv(eZgf-1HBQ#fN?$aF5 zoYvCT^3%%Fs?s{6^;Da#?V+8jy+iwi_M{F~$4y6|vqR^k&SQoO!;_KDsATjprgSxR z{dFa}^}2()GkV5)QF?`X?Rxk03HmJkB>f%wz4}uIItC#I1qQ7Kw+-=zEW;GTU55RJ zuZ@h2VvIHzbs0S}Rx=JT&Npr~zH34@aW`3J(qMAU6l2OVO*7qXdf5y%vo}jIt1%lg zhs_<#1?IcWhb_<+P8LFo28$a^64R5J!)#@aTGB0pEekEXET35!SjAgyv+B3{Xl-wu zZrx~o$A)4PXj5p@WAm%6nJw40#`fA=@?77!tLJvleQsxN$G6*KchjC~A7a13zSsVP zgQJ7Uq0M2^(ZDg$vDWbhi^d9LZDyT!LOXdmt#&%*^w!zIS?qk+`4<X~g?%56 z2@eae34a)26HyS+zks@6$%2*zuOhu7%OdYYnM6sVdZQJi6QY}=U&naIl*dS8tzuWk zUW(I*6U24LW8oFzvR(TOpM zEs5_rp_~TJ^wNN(wM(bCZ0;`Z6P^ce2XB(^$}i_nB)KM)Cp}7bP2Qe7nc|*Ok@8f) z7E}wKr~0SXrM^xJP1~RLDLp2=Jp-4Km~m7{5vB?IGPN`FGKaIwvx>8%%bb_(Ts9>N z5;bK**^9Ef#WdN^)PTf9vR*Qp{o-l7 zTcBI8wqSIn=gRt3(5j`YdRObOE?Pal#&6AmwS={4Ykw%TE-Wv6xh`g1Pmxy9nxe7w ze(PI{6^cd0H#WFzsN0CzDA+i-Y3`<~O&?2mB^OJrODjs>Z{}{k_?699m0x|@lC)*8 z%%N=0R?Jr6*6Z8cw;d=~F3&F?+a9vLa|dHb$&Qyhm+ZVyVOLSNi?B>BD~Ee(8aT1AWbo&CM;EEoH56tE6@EV8X%6-*|u1-NtOIZ>P7H z9s-9XhaP{M`0e$>L5F*fu#U8SXZT%h2eqT56Y5;vIn|ZYCGC#u9zGg)w718lr{jCe z@An_mJyvsE<#^c%!il02pHAkVoIaIx>gnm^(__6$dheWxJ#(!uyl?Pq(Ao3ne9xWf z_v}A;-u3*k3(gmgUSwVDy5w-FbHIL};|Kd6ItCpEJBJ*Hx-UCj?irppeBz4xmD5+f zub#UWaP88_{E^}7QP*$YNVp-r$-DXJR{E{yw{vdK+*xxMeYfPE(!GlNn)e%iH2tw% z>L5Kn>ODH}V8MesW8ASPKV|>)e!S=*`C-L`&P4Mg+egPHeJ3wJUif(YN!F8@r^P=j z|6Kdbc>FRj6+1QlT=e|YubW?}zu5oM?q%0Dy!50Qvv` z0D$NK0Cg|`0P0`>06Lfe02gqax=}m;000SaNLh0L01FZT01FZU(%pXi0000RbVXQn zQ*UN;cVTj607GSLb9r+hQ*?D?X>TA@Z*OeDr{R16002x$L_t(Ijbr@(|33o`fKvhr z7_kb{!$6n-Rt<#I(bPa<4Z>?MO$;R0Agl(D8aQeonFgW=kYOt4nH literal 0 HcmV?d00001 diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 178a6e626d..ca79b991de 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,7 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Systems.Collections; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,9 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static float Lifetime => 15; //Technically has infinite lifetime, but manually sets 15 seconds. See projectile file for details public static float Reach = 512f; public static float Speed = 36f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Lifetime); public override void SetStaticDefaults() { @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 28; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 50; + Item.damage = 40; Item.knockBack = 4f; Item.useTime = 22; Item.useAnimation = 22; @@ -48,5 +50,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Lime; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.oblivionCooldown == 0) + return true; + else + return false; + } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 43d0904593..a62c6f5a10 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -918,8 +918,13 @@ Oblivion: { DisplayName: Oblivion Tooltip: ''' - {$Common.YoyoStatsInfinite} - Fires brimstone darts when enemies are near + {$Common.YoyoStats} + An unstable yoyo that slowly releases homing brimstone hellblasts + Striking an enemy with the yoyo charges power, increasing the fire rate of the hellblasts + At maximum power, the yoyo bursts into brimstone darts and resets its duration + Striking an enemy at max power will overload the yoyo, causing it to release all stored up power and shatter + Shattering the yoyo deals immense damage but leaves it unable to be used for several seconds + [c/C61B40:'I have memories from eyes that are not my own'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 1dd7bb9076..ba72470e9f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -312,3 +312,5 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard EvilSmasherProjectile.DisplayName: Evil Smasher +OblivionFire.DisplayName: Oblivion Fire +OblivionBolt.DisplayName: Oblivion Bolt diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index bd0c8302a5..213982f7b2 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -129,6 +129,7 @@ Cooldowns: { MasterChefShieldDurability: MJOLNIR Shield Level MasterChefShieldRecharge: MJOLNIR Shield Recharge NebulousCore: Nebulous Core Cooldown + OblivionCooldown: Oblivion Cooldown OldDukeScalesFatigue: Stamina OmegaBlueActive: Abyssal Madness OmegaBlueCooldown: Abyssal Madness Cooldown diff --git a/Projectiles/Melee/OblivionBolt.cs b/Projectiles/Melee/OblivionBolt.cs new file mode 100644 index 0000000000..2b26a74f0b --- /dev/null +++ b/Projectiles/Melee/OblivionBolt.cs @@ -0,0 +1,97 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OblivionBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Boss/BurningBolt"; + public int time = 0; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 2; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 18; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.penetrate = 3; + Projectile.timeLeft = 690; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.velocity.Length() < Projectile.ai[2]) + { + Projectile.velocity *= 1.01f; + if (Projectile.velocity.Length() > Projectile.ai[2]) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.ai[2]; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); + + if (Projectile.ai[0] == 2f) + { + if (Projectile.timeLeft > 570) + { + int player = Player.FindClosest(Projectile.Center, 1, 1); + Vector2 vector = Main.player[player].Center - Projectile.Center; + float scaleFactor = Projectile.velocity.Length(); + vector.Normalize(); + vector *= scaleFactor; + Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor; + } + } + + Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); + time++; + + var p = SeekersMetaball.SpawnParticle(Projectile.Center + Projectile.velocity * Projectile.MaxUpdates, Vector2.Zero, Terraria.GameContent.TextureAssets.Projectile[Type].Width() * Projectile.scale); + p.rotation = Projectile.rotation; + p.CurrentFrame = Projectile.frame; + p.MaxFrames = Main.projFrames[Type]; + p.TextureToUse = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + p.SizeScaling = 0f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Melee/OblivionFire.cs b/Projectiles/Melee/OblivionFire.cs new file mode 100644 index 0000000000..dd2eb863b6 --- /dev/null +++ b/Projectiles/Melee/OblivionFire.cs @@ -0,0 +1,43 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Metaballs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OblivionFire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float Time => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.MaxUpdates = 4; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + } + + public override void AI() + { + Time++; + if (Time >= 100f) + CalamityUtils.HomeInOnNPC(Projectile, false, 300, 2.5f, 10f, true); + CalamitasMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(2, 2), 16f); + } + + public override bool? CanDamage() => Time >= 45f; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + } +} diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index 257a5f2c41..5856f74925 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -1,8 +1,15 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,6 +20,19 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 2; + //How many hits the yoyo has gotten. Starts at 1 to avoid a dividing by zero error + public int hitCounter = 1; + //20 hits to maximum + public int hitCountMax = 21; + public int time = 0; + //Used for visual intensity rising as the yoyo gets more hits + public float power = 0; + public float powerMax = 1; + //The grace period after the yoyo reaches max power to avoid insta-shattering + public int graceTimer = 0; + public bool shatter = false; + //Yoyo bag behavior + public bool cloneYoyo = false; public override void SetStaticDefaults() { @@ -33,21 +53,331 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.penetrate = -1; Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * MaxUpdates; + Projectile.localNPCHitCooldown = 15 * MaxUpdates; } public override void AI() { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 9f, 48f, 5, ModContent.ProjectileType(), 0.5, damageType: Projectile.DamageType); - if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + var player = Main.player[Projectile.owner]; + //Yoyo glove is stupid and dumb and smells bad + //Using yoyo glove or yoyo bag makes yoyos run out of air time 2-4x faster (randomized) when the second yoyo is out + //Therefore, we set the flight to infinite, but manually set it to recall after 15 seconds and update it across both yoyos + if (time >= 1800) + { + if (!cloneYoyo) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.Projectile.ai[0] = -1f; + } + } + } + } + } + // Determine if the yoyo is a yoyo bag/yoyo glove clone + if (!cloneYoyo) + { + int MainYoyo = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type && proj.owner == Projectile.owner) + { + MainYoyo = x; + break; + } + } + if (Projectile.whoAmI != MainYoyo) + cloneYoyo = true; + //Yoyo behavior. Nothing will trigger on yoyos from yoyo bag + + //Fireball spawning. Fire rate increases with how many hits the yoyo has gotten + if (time % (120 / hitCounter) == 0 && !shatter && Projectile.owner == Main.myPlayer) + { + float randRot = Main.rand.NextFloat(0, MathHelper.TwoPi); + Vector2 spawnVel = randRot.ToRotationVector2() * 2f; + Projectile flames = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, spawnVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.85f), Projectile.knockBack, Projectile.owner); + } + if (graceTimer > 0) + graceTimer--; + if (shatter) + { + //Constantly keep the yoyo out, even if the player lets go of the mouse + Projectile.ai[0] = 0f; + //TODO: Make this follow yoyo range limits & tilecollide + Projectile.Center = player.Calamity().mouseWorld; + //Charge up visuals + power += 0.01f; + float fade = Utils.GetLerpValue(powerMax + 2, 0, power); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Main.rand.NextBool() ? Color.Red : Color.MediumVioletRed); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, DustID.FireworksRGB, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = true; + dust.color = Color.DarkRed; + } + if (time == 240) + { + #region Visuals and Sounds + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i < 2; i++) + { + Particle centerVoid = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), (2.2f + i * 0.5f), 0f, 80, false); + GeneralParticleHandler.SpawnParticle(centerVoid); + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + Particle backBlast1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f, 18); + GeneralParticleHandler.SpawnParticle(backBlast1, false, GeneralDrawLayer.AfterEverything); + + Particle backBlast2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f, 30); + GeneralParticleHandler.SpawnParticle(backBlast2, false, GeneralDrawLayer.AfterEverything); + + Particle backBlast3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f, 30); + GeneralParticleHandler.SpawnParticle(backBlast3, false, GeneralDrawLayer.AfterEverything); + + Particle ring1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion2", new Vector2(0.01f, 0.085f), MathHelper.PiOver2, -4f, 4f, 30); + GeneralParticleHandler.SpawnParticle(ring1); + + Particle ring2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), 0f, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring2); + + Particle ring3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), MathHelper.PiOver4, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring3); + + Particle ring4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/FlameExplosion", new Vector2(0.02f, 0.07f), -MathHelper.PiOver4, -4f, 4f, 25); + GeneralParticleHandler.SpawnParticle(ring4); + + for (int i = 0; i < 19; i++) + { + int dustStyle = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 2.2f); + dust.velocity = new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f); + dust.noGravity = true; + dust.color = Color.MediumVioletRed; + } + for (int i = 0; i < (25); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); + dust.noGravity = false; + dust.velocity = new Vector2(18, 18).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.color = Color.DarkRed; + } + Owner.SetScreenshake(6f); + SoundStyle boom = new("CalamityMod/Sounds/Custom/CalamitasClone/BulletHellEnd"); + SoundEngine.PlaySound(boom with { Volume = 1.5f }, Projectile.Center); + #endregion + if (Projectile.owner == Main.myPlayer) + { + float blastSize = 240; + float minMultiplier = 0.25f; + int hitsToMinMult = 3; + int debuff1 = ModContent.BuffType(); + int debufftime = 180; + //I promise this is balanced + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 50f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debufftime; + blast.timeLeft = 2; + blast.DamageType = Projectile.DamageType; + blast.CritChance = 100; + } + + //Set cooldown + player.Calamity().oblivionCooldown = 300; + int duration = CalamityUtils.SecondsToFrames(5); + player.AddCooldown(OblivionCooldown.ID, duration, true); + + //We manually kill the projectile to skip the retracting, to make it look like the yoyo is destroyed + //This needs to happen for both the main and secondary yoyo + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + p.Kill(); + } + } + } + } + } + //If the player gets more than 200 blocks away, kill the yoyo + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) Projectile.Kill(); + time++; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + //Only applies to the main yoyo + if (!cloneYoyo) + { + hitCounter++; + if (!shatter) + { + power += 0.05f; + SoundStyle onHit = new("CalamityMod/Sounds/Item/TearsOfHeavenUse"); + SoundEngine.PlaySound(onHit, Projectile.Center); + if (power > powerMax) + { + power = powerMax; + } + } + if (hitCounter == hitCountMax) + { + //Refresh duration on both yoyos + if(!cloneYoyo) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.time = 0; + } + } + } + } + //Start a 1.5 second grace period where the yoyo cannot damage enemies. This is to avoid instant shattering after reaching max power + graceTimer = 90; + //Small burst and a ring of darts + if (Projectile.owner == Main.myPlayer) + { + int totalProjectiles = 18; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 8f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); + } + float blastSize = 120; + float minMultiplier = 0.25f; + int hitsToMinMult = -1; + int debuff1 = ModContent.BuffType(); + int debufftime = 180; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debufftime; + blast.timeLeft = 2; + blast.DamageType = Projectile.DamageType; + } + #region Visuals and Sounds + SoundStyle boom = new("CalamityMod/Sounds/Custom/CalamitasClone/CalClone_BigFireballBit", 4); + SoundEngine.PlaySound(boom with { Volume = 1.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.MediumVioletRed, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.12f + 0.005f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.DarkOrchid, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.12f + 0.01f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.2f, 2f, 24); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 1f, 24); + GeneralParticleHandler.SpawnParticle(innerGlow); + #endregion + } + //If the yoyo hits while at maximum, reset the duration of both yoyos and trigger shattering + if (hitCounter > hitCountMax && !shatter) + { + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch with { Volume = 4f }, Projectile.Center); + shatter = true; + if (!cloneYoyo) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == Type && p.owner == Projectile.owner) + { + if (p.ModProjectile is OblivionYoyo oblivion) + { + oblivion.time = 0; + } + } + } + } + } + } + } + + //During the grace period after reaching max power, the yoyo cannot hit enemies for 1.5s to avoid unfair shattering + public override bool? CanDamage() => graceTimer == 0; + + //Avoids instantly spawning a fireball + public override void OnSpawn(IEntitySource source) + { + time = 1; + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D shineTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + + float randSize = Main.rand.NextFloat(0.9f, 1.1f); + float rotationAngle = MathHelper.PiOver4; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + //Only applies to the main yoyo + if (!cloneYoyo) + { + //Red backglow, scales in size with power + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Red with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.3f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.MediumVioletRed with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.2f * randSize * power, SpriteEffects.None, 0); + + //X, scales in size with power + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Red with { A = 0 }, rotationAngle, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.75f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, rotationAngle, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.25f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Red with { A = 0 }, rotationAngle + MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.75f * randSize * power, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, rotationAngle + MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 2.25f * randSize * power, SpriteEffects.None, 0); + + //Yoyo drawing + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + + //Red cross, doesn't scale in size unless shattering + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.DarkRed with { A = 0 }, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, 0, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.DarkRed with { A = 0 }, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTexture, drawPos, null, Color.Purple with { A = 0 } * 0.65f, MathHelper.PiOver2, shineTexture.Size() * 0.5f, new Vector2(0.4f, 1f) * 1.35f * randSize * (shatter ? power : 1f), SpriteEffects.None, 0); + + //Black backglow, scales in size with power + for (int i = 0; i < 2; i++) + { + Particle backglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.25f * (power * 2), 0f, 10, false); + GeneralParticleHandler.SpawnParticle(backglow); + backglow.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; + backglow.DrawLayer = Enums.GeneralDrawLayer.BeforeNPCs; + } + } + else + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } }