From 1ebb586bf59ee2b22553e4f46e2f995df9b7dbd2 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 15 May 2020 21:52:16 -0400 Subject: [PATCH] added auroradical throw --- Items/TreasureBags/AstrageldonBag.cs | 2 + Items/Weapons/Rogue/AuroradicalThrow.cs | 54 +++++++ Items/Weapons/Rogue/AuroradicalThrow.png | Bin 0 -> 839 bytes ModSupport/WeakReferenceSupport.cs | 2 +- NPCs/AstrumAureus/AstrumAureus.cs | 2 + Projectiles/Rogue/AuroradicalSplitter.cs | 133 ++++++++++++++++ Projectiles/Rogue/AuroradicalStar.cs | 187 +++++++++++++++++++++++ Projectiles/Rogue/AuroradicalStar.png | Bin 0 -> 669 bytes 8 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 Items/Weapons/Rogue/AuroradicalThrow.cs create mode 100644 Items/Weapons/Rogue/AuroradicalThrow.png create mode 100644 Projectiles/Rogue/AuroradicalSplitter.cs create mode 100644 Projectiles/Rogue/AuroradicalStar.cs create mode 100644 Projectiles/Rogue/AuroradicalStar.png diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 5a76c89f86..42dcd2be86 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.World; using Terraria; @@ -50,6 +51,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && NPC.downedMoonlord); diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs new file mode 100644 index 0000000000..93098fceea --- /dev/null +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -0,0 +1,54 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class AuroradicalThrow : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Throw"); + Tooltip.SetDefault("Launches a star that splits after a short period of time\n" + + "Split stars home in on nearby enemies after a few seconds\n" + + "Stealth strikes summon a meteor upon enemy impact"); + } + + public override void SafeSetDefaults() + { + item.width = 34; + item.height = 58; + item.damage = 32; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.knockBack = 6f; + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int star = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[star].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D glowmask = Main.itemTexture[item.type]; + Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); + spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/Weapons/Rogue/AuroradicalThrow.png b/Items/Weapons/Rogue/AuroradicalThrow.png new file mode 100644 index 0000000000000000000000000000000000000000..d602928d2f9ea5ab7c231200685d9b96967b2673 GIT binary patch literal 839 zcmV-N1GxN&P)$L@O^*dA@|Rv1b0vkn1=TJC3hQR1J}apS$DC@>N7c1gZS;wuZ>) zC*nNJxaLRX;{6CaEgiM=HGlfZcm+d*TBCpfB6)dVaa|leN3!JCzfmdV^L^<@qlF{;P*(Hdp=< zh=lB?npO>wNYI*;bRvEVK)n~{?v`0Qs8>j8h}1mt_UrnkNn+3>=ezVl06>13lb9{N zVCPRhGpp#>-_NZ7tQdFfT23huIdd;nGPeK#qqbdJRrdEl=@0;*E8Am;jF}3qXD_#+ zd;a`=thml#^!611z|Hh;(_w2>${P}qkmE`c;m!# zi9Ax<&)A$u-YA;mm)jX>NkU(;$_|;dM27S!{+<)E9+_O)&-y7pUT@t809cw%vEy=o zqlQS}dPI^Kzt?I1b+Ue$q(P;h$jQYH06=tc0RRx2H??QS$T@SuRr5ouLy{nGJRUIb zrnZ#Ho!+PJ`yhQpyy}w5;VuBHc|!HXkMSn}fRUU@+SnAYLH}41)sNo{SuyT#^`!%7 z-un^}@&=J0Mdue-`;8?*qGWxQ;$M)w#v!k$BjUMg{0NZfd&zKh$XPp6k|g9MHALz> zQb$JYYlwiKXjS-0ok#uws4@8oE#DWU0000IbVXQnMOaBjI!|(GWo~p~bZKvH05ODE R?C$^o002ovPDHLkV1jWCix>a^ literal 0 HcmV?d00001 diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 4749e0d6ca..fb50d77a69 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -357,7 +357,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(),ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 20b3e3f30b..a3a491e60a 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -360,6 +361,7 @@ namespace CalamityMod.NPCs.AstrumAureus DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs new file mode 100644 index 0000000000..a38a2fe9fb --- /dev/null +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -0,0 +1,133 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +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.Rogue +{ + public class AuroradicalSplitter : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/AuroradicalStar"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 100; + projectile.penetrate = -1; + projectile.timeLeft = 50; + projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + //Rotation + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + + //Lighting + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + + //sound effects + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + + //Change the scale size a little bit to make it pulse in and out + float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; + scaleAmt *= 0.2f; + projectile.scale = scaleAmt + 0.95f; + + //Spawn dust + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 0f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + 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 void Kill(int timeLeft) + { + if (Main.myPlayer != projectile.owner) + return; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + for (float i = 0; i < 5; i++) + { + float angle = MathHelper.TwoPi / 5f * i; + int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + } + projectile.position = projectile.Center; + projectile.width = projectile.height = 96; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1f); + } + for (int d = 0; d < 20; d++) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1.5f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 3f; + astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[astral].velocity *= 2f; + Main.dust[astral].noGravity = true; + } + for (int g = 0; g < 3; g++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs new file mode 100644 index 0000000000..b277eda622 --- /dev/null +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -0,0 +1,187 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +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.Rogue +{ + public class AuroradicalStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 100; + projectile.penetrate = 1; + projectile.timeLeft = 485; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + //Rotation + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + + //Lighting + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + + //sound effects + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + + //Change the scale size a little bit to make it pulse in and out + float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; + scaleAmt *= 0.2f; + projectile.scale = scaleAmt + 0.95f; + + //Spawn dust + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 0f; + } + + //Home in + float maxDistance = 1600f; + int targetIndex = -1; + int i; + for (i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + { + targetIndex = i; + break; + } + } + } + if (targetIndex != -1) + { + Vector2 targetVec = Main.npc[i].Center - projectile.Center; + if (targetVec.Length() < 60f) + { + projectile.Kill(); + return; + } + if (projectile.ai[0] >= 120f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f) + { + float speedMult = 25f; + targetVec.Normalize(); + targetVec *= speedMult; + projectile.velocity = (projectile.velocity * 15f + targetVec) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= speedMult; + } + else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - pos) / 40f; + int dmg = projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[comet].Calamity().forceRogue = true; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - pos) / 40f; + int dmg = projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[comet].Calamity().forceRogue = true; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = projectile.height = 96; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.Damage(); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1f); + } + for (int d = 0; d < 20; d++) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1.5f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 3f; + astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[astral].velocity *= 2f; + Main.dust[astral].noGravity = true; + } + for (int g = 0; g < 3; g++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/AuroradicalStar.png b/Projectiles/Rogue/AuroradicalStar.png new file mode 100644 index 0000000000000000000000000000000000000000..cd94acd17f9a1f1c4ea33b2c0f728d006ef2b477 GIT binary patch literal 669 zcmV;O0%HA%P)zbwfkAc^oB^z6NyC+h(!X_zz#kq{AO>J@K@oa~zQALlRSgQvv+Y;;uvF!;+Ru@YUh#!t+D1>o-Aopa;P z%?)`MpE>jm+MNIWvw(Qi6} zvq{V7vU&cb#3HRpNagj0$f@F?E3J?beQ(^d2?ZXRh~KvQrGBgxQ~(g4={%E!$QvSQ zpGP!_k&orUUAfgCR!Lp*pGfO&DFBh(Z2%fJivTEn`N#}-VJ@;eGzsy>bi4UB6?U4s zbMI5%B_ZNEmn7~~0jYW-zhU-AW&wx?89om(7X1lGB){z$vMR1V?R!JyWG@R5@rIBP zMK-ss_R@`gAoUFreNkjwal|X$5pnJs7XdBFNY-5M3Qfo*Z-|`oNSNen9j0{uSM$yz z{{R89#3^jOf!hE801|XXSad~LNk%$Pa%p95bYXO9Z*BlFgjnqF00000NkvXXu0mjf Dfx{{| literal 0 HcmV?d00001