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 0000000000..d602928d2f Binary files /dev/null and b/Items/Weapons/Rogue/AuroradicalThrow.png differ 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 0000000000..cd94acd17f Binary files /dev/null and b/Projectiles/Rogue/AuroradicalStar.png differ