From 3b9e609d8fa4b981dfb010e2efda6db124099c85 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 26 Mar 2020 16:14:48 -0400 Subject: [PATCH] added sulphurous grabber slime staff can now use any wood fixed calamari ink ignoring minion targetting --- Items/Weapons/Melee/SulphurousGrabber.cs | 43 +++++++ Items/Weapons/Melee/SulphurousGrabber.png | Bin 0 -> 854 bytes NPCs/AcidRain/SulfurousSkater.cs | 9 +- Projectiles/Melee/SulphurousGrabberBubble.cs | 47 ++++++++ Projectiles/Melee/SulphurousGrabberBubble.png | Bin 0 -> 396 bytes Projectiles/Melee/SulphurousGrabberBubble2.cs | 48 ++++++++ .../Melee/SulphurousGrabberBubble2.png | Bin 0 -> 402 bytes .../Melee/Yoyos/SulphurousGrabberYoyo.cs | 113 ++++++++++++++++++ .../Melee/Yoyos/SulphurousGrabberYoyo.png | Bin 0 -> 413 bytes .../Yoyos/SulphurousGrabberYoyoBubble.png | Bin 0 -> 388 bytes Projectiles/Summon/CalamariInk.cs | 65 ++++++---- Projectiles/Summon/CalamariMinion.cs | 4 +- Utilities/CalamityRecipes.cs | 1 + 13 files changed, 302 insertions(+), 28 deletions(-) create mode 100644 Items/Weapons/Melee/SulphurousGrabber.cs create mode 100644 Items/Weapons/Melee/SulphurousGrabber.png create mode 100644 Projectiles/Melee/SulphurousGrabberBubble.cs create mode 100644 Projectiles/Melee/SulphurousGrabberBubble.png create mode 100644 Projectiles/Melee/SulphurousGrabberBubble2.cs create mode 100644 Projectiles/Melee/SulphurousGrabberBubble2.png create mode 100644 Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs create mode 100644 Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.png create mode 100644 Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble.png diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs new file mode 100644 index 0000000000..b360f3d046 --- /dev/null +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -0,0 +1,43 @@ +using CalamityMod.Projectiles.Melee.Yoyos; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SulphurousGrabber : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphurous Grabber"); + Tooltip.SetDefault("Occasionally releases a ring of colored bubbles\n" + + "The yoyo receives powers up after touching a green bubble"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; + } + + public override void SetDefaults() + { + item.width = 50; + item.height = 36; + item.melee = true; + item.damage = 36; + item.knockBack = 3.5f; + item.useTime = 25; + item.useAnimation = 25; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.rare = 5; + item.value = Item.buyPrice(gold: 36); + } + } +} diff --git a/Items/Weapons/Melee/SulphurousGrabber.png b/Items/Weapons/Melee/SulphurousGrabber.png new file mode 100644 index 0000000000000000000000000000000000000000..e9171e70eb9edbea84d2a6b223dbaed31d4a4668 GIT binary patch literal 854 zcmV-c1F8IpP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00N{*L_t(o!_AjXNK{c2fWKSj=;TzB zGCGZxBd8=;Q4tAA^g|E?E^OIOT12&sAX-M7*3qKcwJR4v&>|^9sEBk?Fp|m4kWPaS zC#e~KMuXSl&Qb5{jn9IZcQ$k1+;h+4yXW^QJfy9qRhG8fek>AK02wORRFQi@- ztn!u1NxCLF0SGrG6hPJHAOK$zv!2F%NvuxwwF8hEUEXL#T35E!)+&IX3%U;YE{~P; z+gKzHK*mZLhpV%tqmZlLnDTF6_Y%>bmcQ#L?fZ>MqK zU82r-mdbVe+F<~0-1z`NuzITkm|vRH{W=s;05f^3vc!K(AWqUR=>o9oyMcSUQc0c* zsZ)fsckgKchR23%Se?=QL+q5?d{b$aF-RXjxT<=(JmbmPlqwct!&sh=bt>@UKar1N1NOPy zfPLW{0KsU$(0lS+6Cc~JyBlNrM@W6wk3I8PeEVXeG(S(c>pAn(OZ-DDeN(!L_V=-F@#v`?*IS*07*qoM6N<$f&(), 20); + } + public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/SulphurousGrabberBubble.cs b/Projectiles/Melee/SulphurousGrabberBubble.cs new file mode 100644 index 0000000000..87eebe0957 --- /dev/null +++ b/Projectiles/Melee/SulphurousGrabberBubble.cs @@ -0,0 +1,47 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SulphurousGrabberBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54); + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } + } +} diff --git a/Projectiles/Melee/SulphurousGrabberBubble.png b/Projectiles/Melee/SulphurousGrabberBubble.png new file mode 100644 index 0000000000000000000000000000000000000000..fb1f1d97abba4c5a14701e624eb57868b69d0ff0 GIT binary patch literal 396 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4)e-Q39n(0;NN2}7}=)Du&pp;^^3oTYhr!gd*<%# zRes=Js$$H%KK_2#!$~gtRP?#`%5hp|zGhk#BJ}p}3&z*x{^~BX*){@wDOBPb0Ysi| iR{lkqsd*)dC7Jno42CTcZ{7oC89ZJ6T-G@yGywpn(UBbh literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.cs b/Projectiles/Melee/SulphurousGrabberBubble2.cs new file mode 100644 index 0000000000..61c653fa3f --- /dev/null +++ b/Projectiles/Melee/SulphurousGrabberBubble2.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SulphurousGrabberBubble2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + projectile.ai[0]++; + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54); + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } + } +} diff --git a/Projectiles/Melee/SulphurousGrabberBubble2.png b/Projectiles/Melee/SulphurousGrabberBubble2.png new file mode 100644 index 0000000000000000000000000000000000000000..c5d6d298663301465b5c8347e678bab11246b287 GIT binary patch literal 402 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4^0U{XDOuZX7_!zeJlHU0lFZc@ z#Z5L0t9=<9IGu&Mj+6;8JUTIn;ohP-(E=rxVvLeqQs*wQzL&nzEw53D*J@>rnz8#A zzfW^ZjEY@;9V)$7&GPxU!7N$E8FA<2`G3hyT$i|?%OUlXzS3<^7KaztjotGZEqG_? zOXt77d)ns9>jV5XDqVH86W5D$?(&q0OuO%~V!;aT7neMHzAv^8ND35+jygTe~DWM4f29=M_ literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs new file mode 100644 index 0000000000..303bb3164f --- /dev/null +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -0,0 +1,113 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.Yoyos +{ + public class SulphurousGrabberYoyo : ModProjectile + { + private int bubbleCounter = 0; + private bool bubbleStronk = false; + private int bubbleStronkCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphurous Grabber Yoyo"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.aiStyle = 99; + projectile.width = 18; + projectile.height = 18; + projectile.scale = 1f; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.localNPCHitCooldown = 10 * projectile.extraUpdates; + } + + public override void AI() + { + if (projectile.owner == Main.myPlayer) + { + if (bubbleStronk) + { + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + bubbleStronkCounter++; + } + else + { + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + projectile.extraUpdates = 0; + projectile.usesLocalNPCImmunity = false; + bubbleStronkCounter = 0; + } + + if (bubbleStronkCounter >= 240) + bubbleStronk = false; + + Rectangle rectangle = new Rectangle((int)((double)projectile.position.X + (double)projectile.velocity.X * 0.5 - 4.0), (int)((double)projectile.position.Y + (double)projectile.velocity.Y * 0.5 - 4.0), projectile.width + 8, projectile.height + 8); + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.active && proj.type == ModContent.ProjectileType() && proj.ai[0] >= 40f && proj.owner == projectile.owner) + { + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + proj.Kill(); + bubbleStronk = true; + bubbleStronkCounter = 0; + break; + } + } + } + + bubbleCounter++; + if (bubbleCounter >= 60) + { + for (float i = 0; i < 9; i++) + { + int projType = ModContent.ProjectileType(); + if (Main.rand.NextBool(10)) + projType = ModContent.ProjectileType(); + float angle = MathHelper.TwoPi / 9 * i; + Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 8f, projType, projectile.damage / 10, projectile.knockBack / 10, projectile.owner, 0f, 0f); + } + bubbleCounter = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + if (bubbleStronk) + { + tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.png b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.png new file mode 100644 index 0000000000000000000000000000000000000000..95d3f74673a61ed7670440814907aeb99a6cf81f GIT binary patch literal 413 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4j90O&J)rY$s4&APDcb8^oQs60tiRK?Tj3RX8 z9OfNT=uZe1i{w%3ZcLe^QaX8R>p|O{&&xK-JdHm0v;1Ft?epLB-)9tF-u1X?p}Q%= z@1i68ZE{B~r&lnFC~BB(^Y<7y z%m&f^D*jh1pUm|$D`#48IhJ|DEqMly*@g_Kmabmx@y+M&l|2Gpul5=+G(X$y_r_`8 z-~Hh#HiBL*fB9aC?A*kBph&Q?D)H_dQ%%8h+g`pgJD^?tDsG#{esk;lA9k<#d$;}z zgVXK+1w$vJXFzWYmAFO#k*AxLe^F*?UP)p}W_})nVN1lD_dr<&Pgg&ebxsLQ0D$bD AlK=n! literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble.png b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble.png new file mode 100644 index 0000000000000000000000000000000000000000..c2f02674656ea495cb8038602a73a59c1a871617 GIT binary patch literal 388 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4>)hF~s6@a>%66ALkobmbi*aN=isb%-gr`d;_mXx0aE^)4(r= zh5?)#4oFlk%;f=r$zkDtk1uC@7Nqj^N~z%DwG)-Q<|mr{U3sHp(TC?NqrqzK{Pqfr zVd4&cwbR2hjPcmN^9K$bm{596X0_9d?u3NAXVp6-LrMj?cQKqvD>F7_1A;c0KtnKn z>uMF)2&RSE8>C#U#TV}8c_!r4P^IT|${HxqQS#~PO6lww2cAeuJb2l$OE0PAY2BAS z&Kwu?*7NTA#KEwE*Ne-vu>1(ncS0qu5kTbWX60X$nVMIUSdy8a$6(kJ@#Z~Hmci52 K&t;ucLK6U#@P?-V literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index 99b4330a01..371b9bffd1 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -41,38 +41,53 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + + Player player = Main.player[projectile.owner]; + int targetIdx = -1; + float maxHomingRange = 400f; + bool hasHomingTarget = false; + if (player.HasMinionAttackTargetNPC) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; + targetIdx = player.MinionAttackTargetNPC; + maxHomingRange = dist; + hasHomingTarget = true; } } } - if (flag17) + else { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + for (int i = 0; i < Main.npc.Length; ++i) + { + NPC npc = Main.npc[i]; + if (npc == null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = i; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + } + + // Home in on said closest NPC. + if (hasHomingTarget) + { + NPC target = Main.npc[targetIdx]; + Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * 10f; + float homingRatio = 20f; + projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); } } diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index 27bc57d4ad..c5e05a9744 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -293,8 +293,8 @@ namespace CalamityMod.Projectiles.Summon } if (num23 > 3000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); } if (num23 > 70f) { diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 1bc8d2569b..89fe4e131c 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -469,6 +469,7 @@ namespace CalamityMod //Slime Staff r = GetNewRecipe(); r.AddIngredient(ItemID.Wood, 6); + r.anyWood = true; r.AddIngredient(ItemID.Gel, 40); r.AddIngredient(ItemID.PinkGel, 10); r.AddTile(TileID.Anvils);