diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 42dcd2be86..788004a24e 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AstrumAureus; @@ -50,6 +51,7 @@ namespace CalamityMod.Items.TreasureBags // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs new file mode 100644 index 0000000000..fe5f528c33 --- /dev/null +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -0,0 +1,44 @@ +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 AlulaAustralis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alula Australis"); + Tooltip.SetDefault("Fires a beautiful aurora trailed by a star shower"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 12; + item.width = 52; + item.height = 52; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 13f; + } + + public override Vector2? HoldoutOrigin() + { + return new Vector2(15, 15); + } + } +} diff --git a/Items/Weapons/Magic/AlulaAustralis.png b/Items/Weapons/Magic/AlulaAustralis.png new file mode 100644 index 0000000000..4cb6687719 Binary files /dev/null and b/Items/Weapons/Magic/AlulaAustralis.png differ diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index fb50d77a69..2b0321cca4 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(), 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(), 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 a3a491e60a..e47c132305 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; @@ -360,6 +361,7 @@ namespace CalamityMod.NPCs.AstrumAureus // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs new file mode 100644 index 0000000000..efe31ad461 --- /dev/null +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -0,0 +1,124 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AuroraAustralis : ModProjectile + { + private static float CosFrequency = 0.05f; + private static float CosAmplitude = 0.008f; + private static float RotationIncrement = 0.26f; + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Australis"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.magic = true; + projectile.alpha = 255; + + CosFrequency = 0.15f; + CosAmplitude = 0.06f; + RotationIncrement = 0.26f; + } + + public override void AI() + { + // On-spawn effects + if (projectile.ai[0] == 0) + { + // Store the X and Y of the spawn velocity so it can be used for trig calculations + projectile.localAI[0] = projectile.velocity.X; + projectile.localAI[1] = projectile.velocity.Y; + } + + // Doesn't collide with tiles for the first 2 frames + projectile.tileCollide = projectile.ai[0] > 2f; + + // Apply fancy cosine movement, then slight gravity, then cap velocity. + // Original velocity is reconstructed so that it can be used in the calculation + Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); + ApplyCosVelocity(originalVelocity); + float currentSpeed = projectile.velocity.Length(); + float maxSpeed = 1.4f * originalVelocity.Length(); + if (currentSpeed > maxSpeed) + projectile.velocity *= maxSpeed / currentSpeed; + + // spawn dust + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int rainbow = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbow]; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.2f; + dust.position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); + dust.position.Y = projectile.Center.Y + Main.rand.Next(-2, 3); + dust.noGravity = true; + + if (projectile.timeLeft % 10 == 0 && Main.myPlayer == projectile.owner) //spawn stars every 10 ticks + { + if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) + { + float dmgKBMult = Main.rand.NextFloat(0.25f, 0.75f); + float xStart = projectile.Center.X + projectile.velocity.X; + float yStart = projectile.Center.Y - Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float starSpeed = Main.rand.NextFloat(10f, 20f); + travelDist = starSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + int star = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); + Main.projectile[star].timeLeft = 120; + } + } + + projectile.ai[0]++; + } + + private void ApplyCosVelocity(Vector2 baseVelocity) + { + float radians = -(-MathHelper.PiOver2 + CosFrequency * projectile.ai[0]); + projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + 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); + } + } +} diff --git a/Projectiles/Magic/AuroraAustralis.png b/Projectiles/Magic/AuroraAustralis.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Magic/AuroraAustralis.png differ diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index a38a2fe9fb..7ee1c48c78 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -11,6 +11,12 @@ namespace CalamityMod.Projectiles.Rogue { public class AuroradicalSplitter : ModProjectile { + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + public override string Texture => "CalamityMod/Projectiles/Rogue/AuroradicalStar"; public override void SetStaticDefaults() @@ -62,12 +68,7 @@ namespace CalamityMod.Projectiles.Rogue 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); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; } @@ -106,18 +107,13 @@ namespace CalamityMod.Projectiles.Rogue 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); + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 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); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 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); diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index b277eda622..f7468a41c1 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -11,6 +11,12 @@ namespace CalamityMod.Projectiles.Rogue { public class AuroradicalStar : ModProjectile { + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Auroradical Star"); @@ -58,12 +64,7 @@ namespace CalamityMod.Projectiles.Rogue 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); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; } @@ -160,18 +161,13 @@ namespace CalamityMod.Projectiles.Rogue 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); + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 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); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 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); diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 4cfa10ab98..53dc9af121 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -36,24 +36,24 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks { - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) { + float dmgKBMult = Main.rand.NextFloat(0.32f, 0.56f); int spearAmt = Main.rand.Next(1, 4); //1 to 3 spears for (int n = 0; n < spearAmt; n++) { - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.32f, 0.56f)), projectile.knockBack * Main.rand.NextFloat(0.32f, 0.56f), projectile.owner, 0f, 0f); - } //very complicated and painful + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y - Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float starSpeed = 29f; + travelDist = starSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); + } } } if (projectile.ai[0] == 0f)