From b1af4fc818bd655c8e8a230ff1ee8595d543cb34 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 20 May 2020 13:33:50 -0400 Subject: [PATCH] added parasitic sceptor and izuna the dryad --- Items/Weapons/Magic/ParasiticSceptor.cs | 95 ++++++++++++++++++++ Items/Weapons/Magic/ParasiticSceptor.png | Bin 0 -> 1045 bytes NPCs/AcidRain/WaterLeech.cs | 7 ++ NPCs/CalamityGlobalNPC.cs | 29 +++++- Projectiles/Boss/MushBomb.cs | 4 +- Projectiles/Boss/MushBombFall.cs | 4 +- Projectiles/Magic/WaterLeechProj.cs | 109 +++++++++++++++++++++++ Projectiles/Magic/WaterLeechProj.png | Bin 0 -> 610 bytes Projectiles/Magic/WaterLeechProjGlow.png | Bin 0 -> 366 bytes 9 files changed, 242 insertions(+), 6 deletions(-) create mode 100644 Items/Weapons/Magic/ParasiticSceptor.cs create mode 100644 Items/Weapons/Magic/ParasiticSceptor.png create mode 100644 Projectiles/Magic/WaterLeechProj.cs create mode 100644 Projectiles/Magic/WaterLeechProj.png create mode 100644 Projectiles/Magic/WaterLeechProjGlow.png diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs new file mode 100644 index 0000000000..9b48e1101c --- /dev/null +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -0,0 +1,95 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class ParasiticSceptor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Parasitic Sceptor"); + Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 12; + item.knockBack = 3f; + item.mana = 10; + item.useTime = item.useAnimation = 25; + item.autoReuse = true; + item.magic = true; + item.shootSpeed = 10f; + item.shoot = ModContent.ProjectileType(); + + item.width = item.height = 52; + item.UseSound = SoundID.Item46; + item.noMelee = true; + item.useStyle = 5; + item.rare = 2; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + } + + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); + + 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 speed = item.shootSpeed; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; + float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } + Vector2 vector = new Vector2(xDist, yDist); + float speedMult = vector.Length(); + if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) + { + xDist = player.direction; + yDist = 0f; + speedMult = speed; + } + else + { + speedMult = speed / speedMult; + } + xDist *= speedMult; + yDist *= speedMult; + int leechAmt = 2; + if (Main.rand.NextBool(3)) + { + leechAmt++; + } + if (Main.rand.NextBool(4)) + { + leechAmt++; + } + if (Main.rand.NextBool(5)) + { + leechAmt ++; + } + for (int i = 0; i < leechAmt; i++) + { + float xVec = xDist; + float yVec = yDist; + float spreadMult = 0.05f * i; + xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + Vector2 directionToShoot = new Vector2(xVec, yVec); + speedMult = directionToShoot.Length(); + speedMult = speed / speedMult; + xVec *= speedMult; + yVec *= speedMult; + directionToShoot = new Vector2(xVec, yVec); + Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Magic/ParasiticSceptor.png b/Items/Weapons/Magic/ParasiticSceptor.png new file mode 100644 index 0000000000000000000000000000000000000000..9aca524358de23e62a439279981bd5c76638a04d GIT binary patch literal 1045 zcmV+w1nT>VP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00U!5L_t(&-tC!7NK{c6$A8yE^EEzl zMn^OsIQRfDa#31Rf+#`ZqS}PuCJ2%i;VNj;Dq2K~YSCjEZNf#g5<&|%wg?gld}Tg! zbh1%1Z7P};*W=|}@A#NUqeuUnnKSp?bI+aM{r>0s&ehoAD#|MWASuBKfU77KfDa%0 z{Z{>BqCMeoD>m8_Fl#d+)9xGqUOc@fop_O1u)3my!9A>f`Tj!ptJj(07fQ8Eyq=kP{=OlU6>bNB{D*@)1RgG z;H>@+UwwZJfcAzz0Cc@|15kG=L+UR`i0gP4=h;Zg5ehkm(rsw~co*j_SN`fF=K(lg zz68MXw9j&!Dc^6vAoTEA9{@4+Aj<7unoZEGIN z5enJm%w(=#Y6J{7OLXe>OKyG~0ByHlnXfGosw{PC0KNTNb2YP+BNTKD71{NACJ-63 zn+X@Qko1%UOGZdJLZQTvAK*&eX~2jT;Zn}DGz}opb^w4+<8x;Bi^zV4a)h=WLrDpV z0Q^{41`INyZmDn;Y5;vht6BE^+NlxWVS;@^kY%&!Uost*$7jARMfHaEE+LWij?B0v zcM}RWI}W$@FrkEl`e$kZu-@H@^PJnNEF-18M@ZysJ3V%Ulp_>y^td# zWu&AeAt?*4D9+V$vEj)L$rRb`8o-Fh6YYDDq%I**af*5-PzAbE$p|S&Xx%z=w&sM? z-YsN=lp~}S=jm^o{}S&9XsRs%j2vydyZ_Oaa)e^%7FGc8E(!uVA(5krJ%rsN(), 120); } + + public override void NPCLoot() + { + float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bae811d798..355ecb328f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -585,6 +585,28 @@ namespace CalamityMod.NPCs } } + if (irradiated > 0) + { + int projectileCount = 0; + for (int j = 0; j < Main.maxProjectiles; j++) + { + if (Main.projectile[j].active && Main.projectile[j].type == ProjectileType() && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) + { + projectileCount++; + } + } + + if (projectileCount > 0) + { + ApplyDPSDebuff(irradiated, projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage); + } + else + { + ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage); + } + } + // Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies. if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type)) { @@ -623,7 +645,6 @@ namespace CalamityMod.NPCs } ApplyDPSDebuff(vaporfied, 30, 6, ref npc.lifeRegen, ref damage); - ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bFlames, 40, 8, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(hFlames, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(pFlames, 100, 20, ref npc.lifeRegen, ref damage); @@ -2523,12 +2544,16 @@ namespace CalamityMod.NPCs break; case NPCID.Dryad: - switch (Main.rand.Next(22)) // 21 Dryad names + switch (Main.rand.Next(23)) // 21 Dryad names { case 0: npc.GivenName = "Rythmi"; break; + case 1: + npc.GivenName = "Izuna"; + break; + default: break; } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index d7da2db6a3..d14f549908 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; int drawStart = height * projectile.frame; Vector2 origin = projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; int drawStart = height * projectile.frame; Vector2 origin = projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 863d528f99..fc8492233b 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; int drawStart = height * projectile.frame; Vector2 origin = projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; int drawStart = height * projectile.frame; Vector2 origin = projectile.Size / 2; SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs new file mode 100644 index 0000000000..c092e1101d --- /dev/null +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -0,0 +1,109 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +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 WaterLeechProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leech"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 540; + projectile.magic = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + if (projectile.ai[0] == 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi; + } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile, 5); + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Magic/WaterLeechProjGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1, 0.5f, 0f); + for (int i = 0; i < 5; i++) + { + int dust = Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/WaterLeechProj.png b/Projectiles/Magic/WaterLeechProj.png new file mode 100644 index 0000000000000000000000000000000000000000..17bc7c88b03f2d927a63ed7d9e499726c4fe5548 GIT binary patch literal 610 zcmV-o0-gPdP)Px%97#k$R9J=Wn88a_K^(_FiWDqL*n*qHf+cMjd9p(o5 z@Ne*#$8I5rhZRx~6N8mhkSHUKNIFEY9$r6}`R$t>--0ufyw7F#&HU!Q_hshI_xBsf ziJgvi2VO4^)U(8Qw)>#0G%3<=S}KmD4y^R`w!Cre+YbQt4^{z>in?qakH&8P`*#Gu z;rDWCT;+N4#?@B^05fWR=ale3lyUeqqtL-r7Afu3bt5|B775Dt!HB*=Tnu z5yI^ZO#v4!8H!JeCLZi6;xP1}Hyr5j+dZiJ#1VG5PiCpE09 w^iEsD`afqls~R@^$%!?f%^Eh?>DKw<7{{Rcg)RaMX#fBK07*qoM6N<$f{b?~Hvj+t literal 0 HcmV?d00001 diff --git a/Projectiles/Magic/WaterLeechProjGlow.png b/Projectiles/Magic/WaterLeechProjGlow.png new file mode 100644 index 0000000000000000000000000000000000000000..48aaa585d2cdb2cb81d5737dc50ca1cc7be22518 GIT binary patch literal 366 zcmV-!0g?WRP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0Ru@yK~z{r?U%s~ z!Y~X)8+Kq3)?fkl;Kl&l*nCWFhpjrU+PXglZSbV3HCp>$MA-MbR$bh^*DYROYsT%cXy#|cv33o~tUn_}YiMpX z7}&$+NXm({{~&R?Hz66?8%ZYP9~OyYq{S~sNUbsD3Fny^ZH;Mq15!M6G5%>{ZvX%Q M07*qoM6N<$f)QquQvd(} literal 0 HcmV?d00001