From cba2e35f89d376939fc02c8dd27655bce4c33461 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:42:34 -0800 Subject: [PATCH] added Kelpie Seadragon --- .../en-US/Mods.CalamityMod.NPCs.hjson | 1 + .../Mods.CalamityMod.Projectiles.Enemy.hjson | 3 + NPCs/SunkenSea/KelpieSeadragon.cs | 208 ++++++++++++++++++ NPCs/SunkenSea/KelpieSeadragon.png | Bin 0 -> 7638 bytes Projectiles/Enemy/KelpDonut.cs | 77 +++++++ 5 files changed, 289 insertions(+) create mode 100644 NPCs/SunkenSea/KelpieSeadragon.cs create mode 100644 NPCs/SunkenSea/KelpieSeadragon.png create mode 100644 Projectiles/Enemy/KelpDonut.cs diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 3165950e61..9d1cb45f9a 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -271,6 +271,7 @@ GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas HauntedChum.DisplayName: Haunted Chum +KelpieSeadragon.DisplayName: Kelpie Seadragon LostShoal.DisplayName: Lost Shoal PearlpodBlack.DisplayName: Pearlpod PearlpodPink.DisplayName: Pearlpod diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 1972f5913e..86ac289629 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -19,6 +19,7 @@ HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard InkBombHostile.DisplayName: Ink Bomb InkPoisonCloud.DisplayName: Ink Cloud +KelpDonut.DisplayName: Water Blast LightningCloud.DisplayName: Cloud MantisRing.DisplayName: Mantis Ring MaulerAcidBubble.DisplayName: Acid Bubble @@ -36,3 +37,5 @@ SulphuricAcidMist.DisplayName: Acid Mist TornadoHostile.DisplayName: Tornado ToxicMinnowCloud.DisplayName: Toxic Cloud TrilobiteSpike.DisplayName: Spike +IceClasperEnemyProjectile.DisplayName: Ice Shard + diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs new file mode 100644 index 0000000000..452438427d --- /dev/null +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -0,0 +1,208 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.World; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class KelpieSeadragon : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 13; + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 20; + NPC.width = 20; + NPC.height = 58; + NPC.defense = 5; + NPC.lifeMax = 350; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.15f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.KelpieSeadragon") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + switch (NPC.ai[0]) + { + // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. + case 0: + NPC.chaseable = false; + if (target != null && target.active && target.Distance(NPC.Center) < 400 && Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + NPC.TargetClosest(); + } + if (NPC.velocity.Length() < 0.1f) + { + NPC.ai[1]++; + // Randomly switch direction + if (Main.rand.NextBool(120)) + { + NPC.direction *= -1; + } + // Move in a random direction towards the direction the horse is facing + if (NPC.ai[1] > 120 || Main.rand.NextBool(90)) + { + Vector2 direction = new Vector2(NPC.direction * 30, Main.rand.Next(-30, 30)); + direction = direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 2; + NPC.ai[1] = 0; + } + } + // Reset any rotation from aggressive AI + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + NPC.velocity *= 0.99f; + break; + case 1: + if (target == null || !target.active || target.Distance(NPC.Center) > 600) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + } + NPC.chaseable = true; + // If the target is too far from its shooting range, move closer + if (target.Distance(NPC.Center) > 300) + { + NPC.ai[1] = 0; + NPC.velocity = NPC.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 3f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.direction * MathHelper.PiOver4 / 2, 0.05f); + } + else + { + // Otherwise sit at a distance and fire projectiles + NPC.velocity *= 0.9f; + NPC.ai[1]++; + if (NPC.ai[1] % 30 == 0) + { + SoundEngine.PlaySound(Sounds.CommonCalamitySounds.ExoPlasmaShootSound with { Volume = 0.2f, Pitch = 1.8f }, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 projSpeed = NPC.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 6; + Projectile.NewProjectile(NPC.GetSource_FromThis(), new Vector2(NPC.Center.X, NPC.position.Y + 20), projSpeed, ModContent.ProjectileType(), NPC.damage, 0f); + } + } + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + } + if (Math.Abs(NPC.velocity.X) > 0) + { + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + } + else + { + NPC.direction = NPC.Center.X > target.Center.X ? -1 : 1; + } + break; + } + NPC.spriteDirection = NPC.direction; + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + // Anger + if (NPC.ai[0] == 1 && NPC.ai[1] > 0) + { + if (NPC.frame.Y > 12 * frameHeight || NPC.frame.Y < frameHeight * 9) + { + NPC.frame.Y = frameHeight * 9; + } + } + // Idle + else + { + if (NPC.frame.Y > 8 * frameHeight) + { + NPC.frame.Y = 0; + } + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/KelpieSeadragon.png b/NPCs/SunkenSea/KelpieSeadragon.png new file mode 100644 index 0000000000000000000000000000000000000000..c42bfe00831676d2fc371972363b97e6dcf5dd1f GIT binary patch literal 7638 zcmYj$dpwi<|G!cc#a&rD8q1&mPW0+HR=ge$!*i1yFhRG>84b7ZQZpm4R znH)v}w{>v6qaujk?QdSPyAaFS1$kBf`zq>O65gl;Qb(YbQj!anhhxOHx% zjr9>eFZ<+VEo)(^PjQzn8TVh-u#fzxZ{m4LrKauD)xkDosBd{(_D)UKlKPrhFD|sV zCynNWb#KakxVu>TU7dEY%~5sl*=7c0WT07(YqP+;jW{h@^+Bjr$_L2N?D_p}ZrsZh zyx0XoKc0D${qR7xFnXKF9$N`PnLwR z2uXeYZe~90X&pY;cM*}vpHI^iGYX9~$R+&^*T3Gh*aaJy?#QV6s{5h0gWZBwRuYZM z!0y)?pGyojV&x2Q;nXv|0qf%dsq(Zkd}px&*|l%A{n(6WX&)D!xySG$#JJsM2lx$! zMZ{a9mdSS0rjQ#xLOe5OH=}2Qf&!9D!_nk}l!=C3M%&7);~rR3eC7#jm2c!@@836R zcJ@-ELkRTN^qf3ld;p;b&RypY#zjli98~lMjQTHbfc2JZtFz8cNAauY2P|k;XrrI% zE%&N6u<|d*9!hrF_<7;#YPN}qs_D&OTIh#RS=z?#jPx`4+E?s1M^ghzafqX|jd0gT zExEa;2#%ltXWL+p>#}z<7ZwKjEmCEdB4{XA2Hyd?(? zX6|SbN}L%VPwh^z!#gTAyxo!q6~bh)*S;`X5**r=)I;fq2_J@61ZY(fp-`-l1n`2& zUn@qlccKO9_e4vvbF$!Y|IJ{iu_)s|+Ci~O

<|D3o!6@II4=$Qqr|orch$R^1{d zGVxe~+J28HNk>XjV!Z0m)9b~r>*6x?K^UKyB9+yhn$uKk@L+PP;g#mbY-QLF-s`)9 z2C;U2#KtEQLPx!My00B7?ud_1ldUfeIK80SS>+CW)1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nVeO^?G#*@^A78j=js*$R&Hvs$=60gBt&WlVxJ0}&d?!gd+TZ8*M z5hK6(a|Mg>QKlU#?hFY9bnJ2ZKeRt5Wbtn%@64&~e{`rc0RM3G7zM#q{bsNtk-eyc z=|fuWF)SujPvBD9^g_eZN;&#TuRky-q5*@VB8R1yD#9>SQQpaI%=Rrc^$9rUVJfD$ zw{u9^(}C)n9fOqUL3-?T4S~!wdcTq;@h#pDb{ue%96Wsg8RF$Pg&tEWLBYj0=fBy` zo~##KRuB^G{z-U|3HQNKC;Xzm^SKZ&c(2)>=b6uTm<@m60pEub`l?x{J}-_By>l%V zU^qH)?>}ZqarSz*!)3;N6P2}rYVa(mWZdGE|K1R{|y`}*5KyzZm6 zLXx!ayI2u}(t!x~v+0fFZxNR{nah2V9j=va*T3U@E>^Q2^>m`F9^r&xE1-bs<-fNy za794hz>4$rI4d)2^_(G1k{-)NCjd;%aS6yzN7deA1cuv7JzZ)k7iaQ58IA7aqPStG zK29TT)}!&wgE}%u?pift&jZEQ3DtLTy%XmSqec2JwD>cZJ$b3;OSTlaI_}uJr^|lT z`Vf8P`B?SYR*2@~hq%KT)t%Bw#kl-TPzkf2wseD>pIj*rgMAO(^(L^1%>I{!N; zAy=Q}sK$CuhTXDB_zTGHKa-zvdRYF)UzBN!9r~{gFk%Z*&~zKbtCIyo`l_9l70?Z~ z{q50!KA)2LNSZMm;1OuMxjCh%IClMXdTO zXBX_{d;SyOJS0M3RI-M3?-0&hV76p2hSa- zD0^_-!|RuJ "Projectiles.Enemy"; + public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 6; + } + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 15; + Projectile.timeLeft = 60; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size(), scale: Projectile.scale); + + public override void AI() + { + //The ring expanding slowing while increasing opacity until it disappears at max size + if (Projectile.ai[0] == 0f) + { + Projectile.scale = 0.5f; + Projectile.ai[0]++; + } + + if (Projectile.velocity.Length() < 0.08f) + Projectile.alpha += 15; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 ringScale = Projectile.Size / tex.Size() * Projectile.scale; + Color ringColor = Color.Blue; + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + for (int i = 0; i < 5; i++) + { + if (i <= Projectile.oldPos.Length) + Main.EntitySpriteDraw(tex, Projectile.oldPos[i] + new Vector2(Projectile.width / 2, Projectile.height / 2) - Main.screenPosition, null, ringColor, Projectile.rotation, tex.Size() / 2f, ringScale, SpriteEffects.None); + } + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + public override void OnKill(int timeLeft) + { + float totalDusts = 18f; + for (float i = 0f; i < totalDusts; i++) + { + Vector2 ringSpeed = new Vector2((float)Math.Cos(i / totalDusts * MathHelper.TwoPi), (float)Math.Sin(i / totalDusts * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.rotation) * 4f * Projectile.scale; + Dust droplets = Dust.NewDustPerfect(Projectile.Center, 211, ringSpeed, 100); + droplets.noGravity = true; + } + } + } +}