From 2ff8fae8fc4eeabed225f6b8d6f274047aa4feb4 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 Jan 2022 20:35:09 -0600 Subject: [PATCH] Added Seraphim --- ExtraTextures/Lasers/SeraphimBeamLargeEnd.png | Bin 0 -> 1888 bytes .../Lasers/SeraphimBeamLargeMiddle.png | Bin 0 -> 859 bytes Items/Weapons/Rogue/Seraphim.cs | 74 ++++++++ Items/Weapons/Rogue/Seraphim.png | Bin 0 -> 2195 bytes Projectiles/Rogue/SeraphimAngelicLight.cs | 64 +++++++ Projectiles/Rogue/SeraphimAngelicLight.png | Bin 0 -> 1508 bytes Projectiles/Rogue/SeraphimAngelicLight2.cs | 69 ++++++++ Projectiles/Rogue/SeraphimBeamLarge.cs | 166 ++++++++++++++++++ Projectiles/Rogue/SeraphimBeamLarge.png | Bin 0 -> 1609 bytes Projectiles/Rogue/SeraphimDagger.cs | 112 ++++++++++++ Projectiles/Rogue/SeraphimDagger.png | Bin 0 -> 770 bytes Projectiles/Rogue/SeraphimProjectile.cs | 122 +++++++++++++ 12 files changed, 607 insertions(+) create mode 100644 ExtraTextures/Lasers/SeraphimBeamLargeEnd.png create mode 100644 ExtraTextures/Lasers/SeraphimBeamLargeMiddle.png create mode 100644 Items/Weapons/Rogue/Seraphim.cs create mode 100644 Items/Weapons/Rogue/Seraphim.png create mode 100644 Projectiles/Rogue/SeraphimAngelicLight.cs create mode 100644 Projectiles/Rogue/SeraphimAngelicLight.png create mode 100644 Projectiles/Rogue/SeraphimAngelicLight2.cs create mode 100644 Projectiles/Rogue/SeraphimBeamLarge.cs create mode 100644 Projectiles/Rogue/SeraphimBeamLarge.png create mode 100644 Projectiles/Rogue/SeraphimDagger.cs create mode 100644 Projectiles/Rogue/SeraphimDagger.png create mode 100644 Projectiles/Rogue/SeraphimProjectile.cs diff --git a/ExtraTextures/Lasers/SeraphimBeamLargeEnd.png b/ExtraTextures/Lasers/SeraphimBeamLargeEnd.png new file mode 100644 index 0000000000000000000000000000000000000000..7f532e60328fab62e75c1ebd5268c3b28aa53686 GIT binary patch literal 1888 zcmZvdc{JPk7QlaL5l;zIYmxTNn-&wQRFyQ^Jf5M9+FGF=k>OB9#}ZrcFwJSSQPgNr z6H9I5h$TXXB8{bz28lh2#!iL^WhB-PT*7{aFNmTf4sM-xRLNQM{ zFzV*NY_8ir)NA>|XN5`cq#35*8LXMvUfOHAyu$riyC1bwPEv{5`o#O(X0|ZevvN4k zEa#SmV4~mY=L;L{@G)OOw1*2JTP%*DLuFEW0UnR%bb!1wxvv)S1InjFT{E~x);scV zDz#Dvrnw?c01glL8lU8BC(ze|;e%Ed4%3}SHHarzGMW5fNk>N~s%bOjAKtSiCz^&W z+`m+E%V z7P-KDG}S!Qse4?DNh19hjXwQy>*3N@8*lQ4pkPMIQ4wfOBvSVePfXOYT+h!<&&W^$ zG&D3WrcO*uII?a`cRC65$GnYwT7ZtOu4BN+$Ov$_FFuiqO!){zL_`1``}_LrC(4@#u8gaO4;1 z9+}>_ElBI1DQ@{OX26)BpykIEYT0$$&{3M(IG1{Qt2{fiqT*bM5=4?fw+Xi$?;449 zXK}mW^?nQpW=lZ7INB<;e|Hk>QGZi*?*04sPNb(; zY0?wf5UKao447i|3te4Zr}AMH^4We4C(xcHOQ5YSLJ#B4xw+()C3|_*p1e`dd4c_M zW16l5_cq3XeLpqOlAj?e(E8MeyG!hsjrP`Q!NvIM^>l|N_E%dN%rb1mpj zcbf8pB{m{H>|JVIhJag$c(&#YIr?y5fnV^)!NUcii@POuJeg@V zY8&bj%6myMlc#oRYh16yWI@oFUyrvQm=tO^!4=xtPG9vUA7>00VZ)l7f5@; zWme!GC9}-X@w)W#0AG)$A1j&J$RZ)b&Utcrf%O>%GK#(keaytHOm68_sq}F zdo?1&6xxjRXH~~traOn>(D0d8vV^N)p`j?@*xtrEzfHfcxE)_%s)f>iII2W;M>)t# zr?%H6+m#;?8cKFEf=L!JVxNP?a0>*MHaB!?Y1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-0,0 +1,74 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class Seraphim : RogueWeapon + { + public const int SplitDaggerCount = 6; + public const int StealthStrikeLightCount = 9; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seraphim"); + Tooltip.SetDefault("Throws an extraordinarily fast dagger which slows down exponentially and dissipates into light\n" + + $"Once dissipation has ended, {SplitDaggerCount} fast, splitting blades that aim at and slice nearby targets are released, along\n" + + "with a large laserbeam\n" + + $"Stealth strikes release a volley of {StealthStrikeLightCount} lights which explode into smaller laser beams along with the dagger"); + } + + public override void SafeSetDefaults() + { + item.width = 82; + item.height = 82; + item.damage = 350; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useTime = 12; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = SeraphimProjectile.InitialSpeed; + item.Calamity().rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 velocity = new Vector2(speedX, speedY); + int knife = Projectile.NewProjectile(position + velocity, velocity, type, damage, knockBack, player.whoAmI); + if (Main.projectile.IndexInRange(knife)) + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + + // Have stealth strikes release bursts of light that explode. + if (player.Calamity().StealthStrikeAvailable()) + { + for (int i = 0; i < StealthStrikeLightCount; i++) + { + float offsetAngle = MathHelper.Lerp(-0.97f, 0.97f, i / (float)(StealthStrikeLightCount - 1f)); + Vector2 lightShootVelocity = velocity.SafeNormalize(Vector2.UnitY).RotatedBy(offsetAngle) * 23f; + Projectile.NewProjectile(position, lightShootVelocity, ModContent.ProjectileType(), damage, knife, player.whoAmI, 1f); + } + } + return false; + } + } +} diff --git a/Items/Weapons/Rogue/Seraphim.png b/Items/Weapons/Rogue/Seraphim.png new file mode 100644 index 0000000000000000000000000000000000000000..b4cc0651f595b179fe88156adf6af4e010f97947 GIT binary patch literal 2195 zcmV;E2yFL>P)Px-O-V#SRCt{2oK0+0*BOSNYrwe1*kfZmwiCyOK#-cy&>vFNl%S@Ys1T)UE47iL zD2c+RT|~;FO{J<*n?=+vkW#6uNCmNJtE8%s5{XqM3RFpH11^a~5+iH~8Os>kV-H{q z?R0VO>+5r7?);GBKXRUpb?4r>8fzZC-#OnocOn91+4FEO06puw0qE*%0^q%K9~b6d zSGUNY>y9N_>JPBosAS-dp05J%?2jG-;3xb400bkw5sZwHi5pwn0XRP~R?}xY7uDVs7iG6#&55TXU{-yQ0vaz$xm^eIs z5eP zZ=^eCzIxrfe&TGlq=_!BiG$zyAppl-{wa`NrCoxNo=7$Fp$B%9edE9fC%u1|T5#vg zpH643nacg0Jtg0#Y*ar{xF)u5`;sy7%zuFNY!tyrPgIkU)@oT_e}7eD&xJC!(ww;x zyMJsTrt}|9A}WZ=wiBdScGVN>y6)-M1Bh;d39lCIYbT?t9Gr;^W)R zN*UPMX1_i(W}7GjMVg61S$e>ei6R*3iBcI^(lpWCm5Kj;9e{UEybHj#7heM4%xnAg z{;IN4=80yrn8(HqEdUG*=L(Qyn+%nSGE99%jT7DK>~?eR>x#QMpV34SjPyim)m9dY zLkAB4iFxb(bpn8$j~FwrI`3~>x4zcTQUI7TO&0#!l>^e}%4zG(ukW`_6f&{eZceQP zBRx@MWXD~1MF8DhnF7H5TfPXup>rQv*IoVEBS2!NkjdBblRz>WsJ42$2A;lj4Jcma zlYv@GaSe2liOo$WyGO^X`Z!e+jP%5ukuqja?{|Tu8p}w{Y(9z&?0)5E0Aw8_Rn^}) zVaAy)ts82Z>BvAK6Hg!e7$_bWrd4I(ny3u+m5m}8>4~D5%_kQx0nn1kM3Bs_=c;p@ zjf01e1F$(Z^SymPH#gdAI?jC~CL=3lrN)giMQB_oWa7PT%@M$b@u{+1pT#m!1S36> zI@g#LUU8*;m-nWR$$O%T`k3L{(=Y6WyH> zub;HDv$M^v&I@It2u6BhuAu+xZ#jAX7cDg1eGZ*u}og7?P6Gbr66GcY$_4flXJTzogYoV;v z3}&ty6ldmNANyX(^D2`l~JUYI(*(idMo+z4i$jtgWb87Tb z*6L4Yy1Rhlaivgp9(nVyx!*T;1Bsd9lhfwBYt-*wdLAfVcdoQbs5!UBjb|<_j)@`| z>4_pE)v<2t*Z{!zedt+8CroBO$QbC+P`3Z77M}ef{owml3*5Q_kEiLsCKrS~6EWT;g5{&djxxGJ@txe5lRWLs_U3SK!8HTmzdkE#@~JW^Vv6d2Pn3_NvD3 z4~~`{1qhkw?(~?~Md2>r+vM$P-ZAK3CO0POlMCO0Qw#^S=s-DG3$+A{{l!%tp7rrc{cHS z`OVpGHFYykrn%!xWuKn!NqfCH-k&-5b&kdmznW-nfZ8p|08c6 zuIY)iS_wvaVtz&z0GjJ#BX631U#%vVz%n2|HC^%|cdndOFy zKz2G;@)th!+%wKMe7oOhrH=cWh6Vs`&dikTcdo8CJ1<%`Z35uR*|TYDL5sR8Eg0#E zXwSpF*6(h+nK=JiSom+ahBcz92u7|jqQ16XD`Pfyn(8??nk)H+rCvW?t^^}J@qZK5 V$ov&nQS|@-002ovPDHLkV1kZCIQ{?t literal 0 HcmV?d00001 diff --git a/Projectiles/Rogue/SeraphimAngelicLight.cs b/Projectiles/Rogue/SeraphimAngelicLight.cs new file mode 100644 index 0000000000..78170a73c7 --- /dev/null +++ b/Projectiles/Rogue/SeraphimAngelicLight.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SeraphimAngelicLight : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Orb"); + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 82; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 10; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.scale = CalamityUtils.Convert01To010(projectile.timeLeft / 10f); + projectile.Opacity = (float)Math.Sqrt(projectile.scale); + projectile.velocity *= 0.8f; + projectile.frame = Main.projFrames[projectile.type] - projectile.timeLeft; + } + + public override void Kill(int timeLeft) + { + // Release a puff of golden light dust. + for (int i = 0; i < 24; i++) + { + Dust light = Dust.NewDustPerfect(projectile.Center, 267); + light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); + light.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5f; + light.scale = 1.35f; + light.noGravity = true; + } + + // Release a laser at the nearest target, if one exists. + NPC potentialTarget = projectile.Center.ClosestNPCAt(1300f, true, true); + if (Main.myPlayer != projectile.owner || potentialTarget is null) + return; + + int damage = projectile.damage; + Vector2 laserDirection = projectile.SafeDirectionTo(potentialTarget.Center); + Projectile.NewProjectile(projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, projectile.owner); + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - projectile.alpha); + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Rogue/SeraphimAngelicLight.png b/Projectiles/Rogue/SeraphimAngelicLight.png new file mode 100644 index 0000000000000000000000000000000000000000..87497501564a718b440575cee4c4d5d82e9a001d GIT binary patch literal 1508 zcmaKsc~BB~6vuzscr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A{;)+0!lD%3L_lG%z6Hd;O^sFWNG~p{4?zq#XsSPjQ>sU{B9pY%y$$X z!411Ux#c=?<>(X6m=l)eHu-jb67JI2d61{iyIyk+zmrsjvpr7p9iKT437bZzxGK*_ zj=y&fG(%au^4iyo+Ud%3@7%{Vi*`>j&tJolWRtKj`VFO7{)T?Ta1L)X*K8C+Ipes# z&uiRi`D;_9NTclQ-f5|_LY`_ projectile.ai[0] == 1f; + public ref float Time => ref projectile.ai[1]; + public const int Lifetime = SeraphimProjectile.SlowdownTime + SeraphimDagger.SlowdownTime; + + public override string Texture => "CalamityMod/Projectiles/Rogue/SeraphimAngelicLight"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Orb"); + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 82; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = Lifetime; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.scale = CalamityUtils.Convert01To010(projectile.timeLeft / (float)Lifetime); + projectile.Opacity = (float)Math.Sqrt(projectile.scale); + projectile.velocity *= 0.8f; + projectile.frame = (int)(Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true) * Main.projFrames[projectile.type]); + } + + public override void Kill(int timeLeft) + { + // Release a puff of golden light dust. + for (int i = 0; i < 16; i++) + { + Dust light = Dust.NewDustPerfect(projectile.Center, 267); + light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); + light.velocity = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 5f; + light.scale = 0.9f; + light.noGravity = true; + } + + // Release a laser at the nearest target, if one exists. + NPC potentialTarget = projectile.Center.ClosestNPCAt(1300f, true, true); + if (Main.myPlayer != projectile.owner || potentialTarget is null) + return; + + int damage = projectile.damage; + Vector2 laserDirection = projectile.SafeDirectionTo(potentialTarget.Center); + int laser = Projectile.NewProjectile(projectile.Center, laserDirection, ModContent.ProjectileType(), damage, 0f, projectile.owner); + if (Main.projectile.IndexInRange(laser)) + Main.projectile[laser].scale = 0.5f; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 255 - projectile.alpha); + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs new file mode 100644 index 0000000000..ed312da228 --- /dev/null +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -0,0 +1,166 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SeraphimBeamLarge : BaseLaserbeamProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int OwnerIndex + { + get => (int)projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override float MaxScale => 1f; + public override float MaxLaserLength => 1600f; + public override float Lifetime => 50; + public override Color LaserOverlayColor + { + get + { + Color c1 = Color.Goldenrod; + Color c2 = Color.Orange; + Color color = Color.Lerp(c1, c2, projectile.identity % 5f / 5f) * 1.1f; + color.A = 25; + return color; + } + } + public override Color LightCastColor => Color.White; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SeraphimBeamLarge"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeMiddle"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/SeraphimBeamLargeEnd"); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Beam"); + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 18; + projectile.Calamity().rogue = true; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + writer.Write(projectile.scale); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + projectile.scale = reader.ReadSingle(); + } + + public override void AttachToSomething() { } + + public override void UpdateLaserMotion() + { + // Update the direction and rotation of the laser. + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override float DetermineLaserLength() + { + float[] sampledLengths = new float[10]; + Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, sampledLengths); + float newLaserLength = sampledLengths.Average(); + + if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + return MaxLaserLength; + + return newLaserLength; + } + + public override void PostAI() + { + if (projectile.frameCounter == 0) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + + // Determine frames. + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 4f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // This should never happen, but just in case- + if (projectile.velocity == Vector2.Zero) + return false; + + Color beamColor = LaserOverlayColor; + Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + // Start texture drawing. + Vector2 centerOnLaser = projectile.Center + projectile.velocity * projectile.scale * 116f; + spriteBatch.Draw(LaserBeginTexture, + centerOnLaser - Main.screenPosition, + startFrameArea, + beamColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength + middleFrameArea.Height; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = middleFrameArea.Height * projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + centerOnLaser += projectile.velocity * laserOffset; + incrementalBodyLength += laserOffset; + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + middleFrameArea, + beamColor, + projectile.rotation, + LaserMiddleTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + } + + Vector2 laserEndCenter = centerOnLaser + projectile.velocity * endFrameArea.Height - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + endFrameArea, + beamColor, + projectile.rotation, + LaserEndTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + return false; + } + } +} diff --git a/Projectiles/Rogue/SeraphimBeamLarge.png b/Projectiles/Rogue/SeraphimBeamLarge.png new file mode 100644 index 0000000000000000000000000000000000000000..d115883655007a55de4a6c7a9c28548072898c58 GIT binary patch literal 1609 zcmYk6dpOg39LK*d^=n~zQf;d#9V<#pisaHxREG(naxa$UQbKcYJgP}*tZd~{=8{Bp z{N%Dmvgkrsmb-Oaa#(X&mXoHroX&Wjp6C4a`F_98=lgs<@Av2R{a$x+w9#0(ekA}v zgJ^rmMG^G@P(rU*u2}8-RvDoPO5rXx)&OqBjsdV-g?Py7cue*ecCE|yBWtdr8ofNX z<8JvD7na>5VK&Is2{#44WP3Tf!D+n*(^lCo=oQg>R|TgiVQ)sq9*N;|%IAQt=QTw& zGm=Rq_1DFwCB0f9p`l8kKLiDy*3_thK<;0K!~PW*@M&T~4eZLY2f)n z)xuUh+8Mmp3)GE`1&Lw{+LFZ_oQBw2?17j;p`FJyPt{CJ;G=rJZ83QPX`LP1;L zR6M)5DwIJBE+L3Vr0v88U;XzNoCsp?R^kKJKjwt;=ntxA5e%zmgoagq%_zF1<0-w{ zpZC3UM$EbTY}zptD@n5sV$iUH?{o38LbW<=`fgdwK#V10b!IKCO?Uj-H3-zj5g;Iu zN(~<~as}cN=`a8&6v}z#Tn=qyauRuo8s{F!!GkIu&+++D8FD%IG{Vb7o4NlGNi}B& zviLGBDSgD1A4}0M!z^RQt8bmb1#^a{s>=09oA?(-WHMX?e4sF#N4;w9kpKxj=N1Sc zuRkOs`$#71cEeR(H@lWrA8+JkV1sY39v&WU9~1}#g~Oxd{4VHiLO3>JGn@6Yqv`mP zROdz=KYrH@j&WnXbrf%Rflk_fM5&g!Thl=Or?!-H8||T!Mz+u~ag)#j&F*KGq3wbt zX%g*}99G}ppo)8{-A+S8r7FL$U1;F`-T{W;`;%@7kQs^uixw8N!B@Gw8obJ-QK?is z*k@^}`t-)(!M+DPWV@L>Y5%k~oBqn8#>JH{A}?T5B3n)FZ-t#5idjO79|d}890X5z z@8%`psWbS4GUUz^E#i}y=nnEyN{A(D4E7Imxx*}1tY3TIo;62-AgEd|)dT z(!jTws8O~sLUFB`=?3A?iu{Mh#t?PQh|drG8dLfHMs5z`qmGW-1y4$8DP{ysQJjaG z_+{L`U3*`T$925vZqEG1>F%9*`vMM4Jtjk%hj+r3`8X3B2k%%bW-YB1JuN~UtT@G+ z#SB0UJv$ll?qX9dz;`oBM@ND~U->%@OkVD=&tzr?^bh6O( zjSy?o$uCU&96WMi{$3Bh4^=1l2urk$D|dET$^qTr8>hHQIu?%ufc)B5h+Ck862 zzteaed)%|t>_qr{vjPW6dT4Ie2NQ<}MnZfME#G1~5e~BJuP@>u8z%o`-H;NN?3z!m zcMu19n_*mjhngNzjNxqcrU5Ih;Y5Z z3v_~VXt>Ix&CmW=WZ{1`?oNFwjWm9Vg>)9YJ}RW5lghrhi_+G8?} ref projectile.ai[0]; + public override void SetStaticDefaults() => DisplayName.SetDefault("Seraphim"); + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 150; + projectile.MaxUpdates = 2; + projectile.alpha = 0; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = projectile.MaxUpdates * 15; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + // Initialize rotation. + if (projectile.localAI[0] == 0f) + { + projectile.ai[1] = Main.rand.NextFloat(-0.8f, 0.8f); + projectile.localAI[0] = 1f; + } + + // Handle fade effects. + projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 8f, projectile.timeLeft, true); + + // Very rapidly slow down and spin. + if (Time <= SlowdownTime) + { + float angularVelocityInterpolant = (float)Math.Pow(1f - Utils.InverseLerp(0f, SlowdownTime, Time, true), 2D); + float angularVelocity = angularVelocityInterpolant * MathHelper.Pi / 6f; + projectile.rotation += angularVelocity; + projectile.velocity *= 0.95f; + } + + // Aim at nearby targets. + else if (Time <= SlowdownTime + AimTime) + { + if (Time == SlowdownTime + 25f) + { + Main.PlaySound(SoundID.DD2_WyvernDiveDown, projectile.Center); + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); + } + + NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + float idealRotation = projectile.AngleTo(potentialTarget?.Center ?? projectile.Center - Vector2.UnitY) + MathHelper.PiOver4; + projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.08f).AngleTowards(idealRotation, 0.1f); + projectile.velocity *= 0.9f; + + // And fire. + if (Time == SlowdownTime + AimTime) + { + projectile.rotation = idealRotation; + projectile.velocity = (idealRotation - MathHelper.PiOver4).ToRotationVector2() * 14f; + } + } + + // Accelerate. + else if (projectile.velocity.Length() < 28f) + projectile.velocity *= 1.045f; + + Time++; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + Vector2 origin = texture.Size() * 0.5f; + Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + + float endFade = Utils.InverseLerp(0f, 12f, projectile.timeLeft, true); + Color mainColor = Color.Goldenrod * projectile.Opacity * endFade * 1.5f; + mainColor.A = 74; + Color afterimageLightColor = Color.White * endFade; + afterimageLightColor.A = 74; + + // Distribute many knives as they dissipate into light. + for (int i = 0; i < 12; i++) + { + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (1f - projectile.Opacity) * 6f; + spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + // Draw specialized afterimages. + for (int i = 0; i < 10; i++) + { + Vector2 drawPosition = baseDrawPosition - projectile.velocity * i * 0.45f; + Color afterimageColor = mainColor * (1f - i / 10f); + spriteBatch.Draw(texture, drawPosition, null, afterimageColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Rogue/SeraphimDagger.png b/Projectiles/Rogue/SeraphimDagger.png new file mode 100644 index 0000000000000000000000000000000000000000..5c2784d29aac0a7657365d16da642feb730bbfa8 GIT binary patch literal 770 zcmV+d1O5DoP)Px%yh%hsRA_COx)k!12COVSL?^^S`exUu~;k&cx2?_H6jzKR0;@kK?cNk zCR7{BnX8d~ahWKUN@wfq)OeVn9$nKolgk2lWW)rv?aU%oCWDE)e9zu_lB!M)vMn z>QP*01O6$t>#>-*?sZf$Qr9{2kkr%GGXu0+B<}HZ5+y3K*j|N~o9s}_3@Bkb?^DewG@})*zUS5FU z{|Y-l^y~}!{lk8*czu06?T8(CW8{C0s9R|js@)Kwu4Q*4yK9M4<-@M{V?-ugd$e{E zi}84D0HV<-5UiOlZ9@2CgwMQ~&*wl;3o?;TrwzbxI1F8=-SBhe!oK)pMBS!Ztpf1; z{0u-MkqDXiEi>=J8zZJ%F1y~z4g7u+!W$$10BS;EC}I|!F#rGn07*qoM6N<$g7Kqg AUH||9 literal 0 HcmV?d00001 diff --git a/Projectiles/Rogue/SeraphimProjectile.cs b/Projectiles/Rogue/SeraphimProjectile.cs new file mode 100644 index 0000000000..5c9269940c --- /dev/null +++ b/Projectiles/Rogue/SeraphimProjectile.cs @@ -0,0 +1,122 @@ +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SeraphimProjectile : ModProjectile + { + public const float InitialSpeed = 64f; + public const float SlowdownSpeed = 7f; + public const int SlowdownTime = 50; + public static readonly float SlowdownFactor = (float)Math.Pow(SlowdownSpeed / InitialSpeed, 1f / SlowdownTime); + + public ref float Time => ref projectile.ai[0]; + + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Seraphim"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Seraphim"); + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 82; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = SlowdownTime; + projectile.alpha = 0; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 14; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + // Very rapidly slow down and fade out, transforming into light. + if (Time <= SlowdownTime) + { + projectile.Opacity = (float)Math.Pow(1f - Time / SlowdownTime, 2D); + projectile.velocity *= SlowdownFactor; + + int lightDustCount = (int)MathHelper.Lerp(10f, 1f, projectile.Opacity); + for (int i = 0; i < lightDustCount; i++) + { + Vector2 dustSpawnPosition = projectile.Center + Main.rand.NextVector2Unit() * (1f - projectile.Opacity) * 45f; + Dust light = Dust.NewDustPerfect(dustSpawnPosition, 267); + light.color = Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat(0.5f, 1f)); + light.velocity = Main.rand.NextVector2Circular(10f, 10f); + light.scale = MathHelper.Lerp(1.3f, 0.8f, projectile.Opacity) * Main.rand.NextFloat(0.8f, 1.2f); + light.noGravity = true; + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + if (Main.myPlayer != projectile.owner) + return; + + // Create a light projectile that explodes into a laserbeam. + int damage = projectile.damage; + float kb = projectile.knockBack; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), damage, kb, projectile.owner); + + // As well as a fan of light daggers. + NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + for (int i = 0; i < Seraphim.SplitDaggerCount; i++) + { + float offsetAngle = MathHelper.Lerp(-0.9f, 0.9f, i / (float)(Seraphim.SplitDaggerCount - 1f)); + + // Make the fan point away from nearby targets. + if (potentialTarget != null) + offsetAngle -= projectile.AngleTo(potentialTarget.Center); + + Vector2 fanVelocity = offsetAngle.ToRotationVector2() * 10f; + Projectile.NewProjectile(projectile.Center, fanVelocity, ModContent.ProjectileType(), damage / 2, kb, projectile.owner, i); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.4f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + Vector2 origin = texture.Size() * 0.5f; + Vector2 baseDrawPosition = projectile.Center - Main.screenPosition; + + float endFade = Utils.InverseLerp(0f, 12f, projectile.timeLeft, true); + Color mainColor = Color.White * projectile.Opacity * endFade * 1.5f; + mainColor.A = (byte)(255 - projectile.alpha); + Color afterimageLightColor = Color.White * endFade; + afterimageLightColor.A = (byte)(255 - projectile.alpha); + + // Distribute many knives as they dissipate into light. + for (int i = 0; i < 18; i++) + { + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 18f).ToRotationVector2() * (1f - projectile.Opacity) * 16f; + spriteBatch.Draw(texture, drawPosition, null, afterimageLightColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + // Draw specialized afterimages. + for (int i = 0; i < 8; i++) + { + Vector2 drawPosition = baseDrawPosition - projectile.velocity * i * 0.3f; + Color afterimageColor = mainColor * (1f - i / 8f); + spriteBatch.Draw(texture, drawPosition, null, afterimageColor, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + return false; + } + } +}