From 18758d8a2b5ee48fda459eb6fdb5c3b5ef89131c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 13 Feb 2020 23:50:37 -0500 Subject: [PATCH 1/2] Dance of Light rework started --- Items/CalamityGlobalItem.cs | 2 + Items/Weapons/Magic/Judgement.cs | 101 ---------------------- Items/Weapons/Magic/Judgement.png | Bin 570 -> 0 bytes Items/Weapons/Magic/TheDanceofLight.cs | 83 ++++++++++++++++++ Items/Weapons/Magic/TheDanceofLight.png | Bin 0 -> 876 bytes ModSupport/WeakReferenceSupport.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- Projectiles/Magic/WhiteFlame.cs | 65 -------------- Projectiles/Magic/WhiteFlame.png | Bin 139 -> 0 bytes Projectiles/Magic/WhiteFlame2.cs | 51 ----------- Projectiles/Magic/WhiteFlame2.png | Bin 136 -> 0 bytes 11 files changed, 87 insertions(+), 219 deletions(-) delete mode 100644 Items/Weapons/Magic/Judgement.cs delete mode 100644 Items/Weapons/Magic/Judgement.png create mode 100644 Items/Weapons/Magic/TheDanceofLight.cs create mode 100644 Items/Weapons/Magic/TheDanceofLight.png delete mode 100644 Projectiles/Magic/WhiteFlame.cs delete mode 100644 Projectiles/Magic/WhiteFlame.png delete mode 100644 Projectiles/Magic/WhiteFlame2.cs delete mode 100644 Projectiles/Magic/WhiteFlame2.png diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8aef4084d0..466d115280 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -846,6 +846,8 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(Main.DiscoR, 100, 255); if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0, 0, 255); + if (item.type == ModContent.ItemType()) + tt2.overrideColor = new Color(1f, 0.5f + 0.35f * Main.DiscoG / 255f, 1f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); if (item.type == ModContent.ItemType()) diff --git a/Items/Weapons/Magic/Judgement.cs b/Items/Weapons/Magic/Judgement.cs deleted file mode 100644 index 98db41677a..0000000000 --- a/Items/Weapons/Magic/Judgement.cs +++ /dev/null @@ -1,101 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class Judgement : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Dance of Light"); - Tooltip.SetDefault("Casts a swarm of white flames from the sky"); - } - - public override void SetDefaults() - { - item.damage = 700; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; - item.Calamity().customRarity = CalamityRarity.Developer; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarFlareBook); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-20, 21) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-20, 21) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } -} diff --git a/Items/Weapons/Magic/Judgement.png b/Items/Weapons/Magic/Judgement.png deleted file mode 100644 index e0678d8cc033d64b3560c358dc995365e635c1b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 570 zcmV-A0>%A_P)itL7!Y?Qf=AJpXnUNTyh*E@X5Zx?)WKewg z^3i=TUxtGfOv6F~mrrr}kZu;jEYeaE1-tm#z1Lv+$&cS)+9x^^OxG7dXrI7*Fpcih z?rGs*@yMhlD5)32hjgW0;b_U zq??5>i=uNXz%E!ir2|ZBOR9irSgOoz$OiLI>^%#nVLpZNPai%37H56+1Wd0#x)w}V z$7X=(UDuvLd^lhhs_8p`U2yB-0Wb|KGhwL`EQrNturd^u57B+rx_AaypQ*7Qst@UI zA*QwHmm?ZxA^1xhhQbJ zk_bJOw#@4x%4hI6954%swHTJTU_Q$Y3tz-kFn zeTET-C~2O7fdSp8G`A4lr|1qMHqOxX5sYZ`z68twaxDY^S?QWu^$n=300000NkvXX Iu0mjf0LzW~<^TWy diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs new file mode 100644 index 0000000000..16dac68191 --- /dev/null +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -0,0 +1,83 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class TheDanceofLight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Dance of Light"); + Tooltip.SetDefault("'Show them the wrath of a Lightbearer'"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 42; + item.damage = 500; + item.knockBack = 4f; + item.magic = true; + item.mana = 4; + + item.useStyle = ItemUseStyleID.HoldingOut; + item.useTime = 4; + item.useAnimation = 4; + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.value = Item.buyPrice(platinum: 5); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + } + + public override Vector2? HoldoutOffset() + { + return Vector2.Zero; + } + + 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 intendedSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY); + Vector2 target = Main.MouseWorld; + float minOffsetX = -40f; + float maxOffsetX = 40f; + if (target.X > player.Center.X) + minOffsetX = -120f; + else + maxOffsetX = 120f; + + int numProjectiles = 3; + for (int i = 0; i < numProjectiles; ++i) + { + float speed = Main.rand.NextFloat(0.94f, 1.02f) * intendedSpeed; + Vector2 deviation = new Vector2(Main.rand.NextFloat(minOffsetX, maxOffsetX), Main.rand.NextFloat(-1400f, -1200f)); + Vector2 startPos = target + deviation; + Vector2 vel = Vector2.Normalize(-deviation) * speed; + Projectile.NewProjectileDirect(startPos, vel, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarFlareBook); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Magic/TheDanceofLight.png b/Items/Weapons/Magic/TheDanceofLight.png new file mode 100644 index 0000000000000000000000000000000000000000..d7fc87853d56fe0fcab58c5a7a2884dd8ccff6a4 GIT binary patch literal 876 zcmV-y1C#uTP)=7J*em}|AF&4*SS~CId?YSe8+R|{eQptpYI&6(=kb( zDtGmte~$`8DxFpyX=$>R8_T)c3p`g50>NXo#VMh%fb3QIsEzX`jbO$E*7+kK!%r;n zOZjz!cZ&ca*cHV*Z$X{{g~Gj_TwGUovJH`59XCO31xjH@YuqSy{qiD(sAr=OL~^z- zLL@;F-STw`#)FS~74Pw97&AfJ2n@BKQatBttVZ6jw-WLG`HP5cvwkCz*qn7k$eUly zR>&$hb2uF1Ca9f2Z^>hLED;Z&SV>Ig;qKFz_o*Wrk>r@?xLu<{vP>{z0=LbrP*&fa z{@Rq{4=ioQyq;;-6@m{N+L0Hma3OYe_aHX5Y*1`Pa`dG1+~BQu7#e#18ZjwCTY)4p zI1qzkNlx}P*Z19+M}nn0_8~7h>_L3?CaORoStF80{f{?s+D72zw`D0kM}j2P+HzGP zbi4C`l853Skkd;`w$4LNlCc*NX*=YdiEzs2CkbjV@Mr!4RKn8-%OpYeH@RBry{wmg zxP*PK-amkx1pC786>?nVB$}3>wgOoe8!&UZQ*fLFH~ThWs6T5aV%f^ii0pGurhie0 zac}0}k8i_m*N9wl728Ijk>@12K+_QnvERk-eN;%%a~vG2_eK!3jleaF3t^63<@=$T ztBvGXNL6_~zS4`5lT5~6&n%MR-p9C)EUEDC3h4_&d7^5nyz3f2?k3KnIdPnis?b^1+rr95NmT!K(qhm zSwy*`u%Mcq$7O9wo^I!m7mqmNkf62#-!$o|NATtp-nx^@YF;{P00J(rfC zZ3If8B*XqCDq5Ctw2dq?g%_Va~{2Fb+sCiH2r2lu5S4fDB}W+ zJV}BRP0ny9NoQK=N$mtmlFTQ{bEf;CS(5)-;9t&;sK++v+A#nC002ovPDHLkV1fWs Cb(N3+ literal 0 HcmV?d00001 diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 5ea4671edb..9e64f16e48 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -534,7 +534,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 069587dbf2..8470366d9b 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2165,7 +2165,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), // Staff of Blushie ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // The Dance of Light + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), // Voidragon ModContent.ItemType(), ModContent.ItemType(), diff --git a/Projectiles/Magic/WhiteFlame.cs b/Projectiles/Magic/WhiteFlame.cs deleted file mode 100644 index a47b226707..0000000000 --- a/Projectiles/Magic/WhiteFlame.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class WhiteFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.magic = true; - projectile.extraUpdates = 3; - } - - public override void AI() - { - if (projectile.timeLeft % 6f == 0f) - { - for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - int num251 = 4; - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 360); - } - } -} diff --git a/Projectiles/Magic/WhiteFlame.png b/Projectiles/Magic/WhiteFlame.png deleted file mode 100644 index 04c5646fded8c39b9fa4fb2cb4826b55a2aacdbb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI z1_r((Aj~*bn@<`j$X?><>&pIsosmIag3oHse4vnor;B5V#`)ww|Nq-FYc_N?x)`iV cT#~`S@HK*2wD-*0YM>ehPgg&ebxsLQ0I1_7Bme*a diff --git a/Projectiles/Magic/WhiteFlame2.cs b/Projectiles/Magic/WhiteFlame2.cs deleted file mode 100644 index 7e58c62ae1..0000000000 --- a/Projectiles/Magic/WhiteFlame2.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class WhiteFlame2 : ModProjectile - { - float homeTimer = 100; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.timeLeft % 2f == 0f) - { - for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f); - Main.dust[num458].noGravity = true; - } - } - - homeTimer += 5f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, homeTimer, 25f, 20f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 360); - } - } -} diff --git a/Projectiles/Magic/WhiteFlame2.png b/Projectiles/Magic/WhiteFlame2.png deleted file mode 100644 index a3192f94614dc2f6790aa57e1c0aa31cc0d6ee18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_`5A|IT2?*ZZ@dAqwX{0G4WdzViJif|TqL>4nJ z@ErkR#;MwT(m+A>5>H=O_6KY%{Dx*XIN1&Zg+x7F978y+C;$2X-=5j*z>x;#3(iao Y`*N8%pC){&2P$CjboFyt=akR{0HAOs6#xJL From 5dd068ee16bf9f008bad508958ef7a7f1c84c6cb Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 4 Apr 2020 02:43:44 -0400 Subject: [PATCH 2/2] The Dance of Light rework (almost) complete. --- Items/CalamityGlobalItem.cs | 2 +- Items/Weapons/Magic/TheDanceofLight.cs | 56 ++++++---- Projectiles/Magic/LightBlade.cs | 148 +++++++++++++++++++++++++ Projectiles/Magic/LightBlade.png | Bin 0 -> 1435 bytes 4 files changed, 182 insertions(+), 24 deletions(-) create mode 100644 Projectiles/Magic/LightBlade.cs create mode 100644 Projectiles/Magic/LightBlade.png diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 466d115280..3b28398042 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -847,7 +847,7 @@ namespace CalamityMod.Items if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0, 0, 255); if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(1f, 0.5f + 0.35f * Main.DiscoG / 255f, 1f); + tt2.overrideColor = TheDanceofLight.GetSyncedLightColor(); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); if (item.type == ModContent.ItemType()) diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 16dac68191..71b03c9e01 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -11,29 +11,41 @@ namespace CalamityMod.Items.Weapons.Magic { public class TheDanceofLight : ModItem { + private static float SpawnAngleSpread = 0.4f * MathHelper.Pi; + private static float SpeedRandomness = 0.08f; + private static float Inaccuracy = 0.04f; + private static float MinSpawnDist = 40; + private static float MaxSpawnDist = 140; + + public static Color GetLightColor(float deviation) => new Color(1f, 0.5f + 0.35f * MathHelper.Clamp(deviation, 0f, 1f), 1f); + public static Color GetSyncedLightColor() => GetLightColor(Main.DiscoG / 255f); + public static Color GetRandomLightColor() => GetLightColor(Main.rand.NextFloat()); + public override void SetStaticDefaults() { DisplayName.SetDefault("The Dance of Light"); - Tooltip.SetDefault("'Show them the wrath of a Lightbearer'"); + Tooltip.SetDefault("Barrages enemies with a hailstorm of Light Blades\nShow them the wrath of a Lightbearer"); } public override void SetDefaults() { item.width = 40; item.height = 42; - item.damage = 500; + item.damage = 1800; + item.crit += 20; item.knockBack = 4f; item.magic = true; - item.mana = 4; + item.mana = 6; item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 4; - item.useAnimation = 4; + item.useTime = 2; + item.useAnimation = 8; + item.reuseDelay = 5; item.UseSound = SoundID.Item105; item.autoReuse = true; item.noMelee = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.value = Item.buyPrice(platinum: 5); @@ -48,23 +60,20 @@ namespace CalamityMod.Items.Weapons.Magic 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 intendedSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY); - Vector2 target = Main.MouseWorld; - float minOffsetX = -40f; - float maxOffsetX = 40f; - if (target.X > player.Center.X) - minOffsetX = -120f; - else - maxOffsetX = 120f; - - int numProjectiles = 3; - for (int i = 0; i < numProjectiles; ++i) + int numProjs = 2; + for(int i = 0; i < numProjs; ++i) { - float speed = Main.rand.NextFloat(0.94f, 1.02f) * intendedSpeed; - Vector2 deviation = new Vector2(Main.rand.NextFloat(minOffsetX, maxOffsetX), Main.rand.NextFloat(-1400f, -1200f)); - Vector2 startPos = target + deviation; - Vector2 vel = Vector2.Normalize(-deviation) * speed; - Projectile.NewProjectileDirect(startPos, vel, type, damage, knockBack, player.whoAmI); + // Pick a random direction somewhere behind the player + float shootAngle = (float)Math.Atan2(speedY, speedX); + Vector2 offset = Main.rand.NextVector2Unit(MathHelper.Pi - SpawnAngleSpread, 2f * SpawnAngleSpread).RotatedBy(shootAngle); + // Set how far away this sword is spawning + offset *= Main.rand.NextFloat(MinSpawnDist, MaxSpawnDist); + + Vector2 spawnPos = position + offset; + float randSpeed = Main.rand.NextFloat(1f - SpeedRandomness, 1f + SpeedRandomness); + float randAngle = Main.rand.NextFloat(-Inaccuracy, Inaccuracy); + Vector2 velocity = randSpeed * new Vector2(speedX, speedY).RotatedBy(randAngle); + Projectile.NewProjectileDirect(spawnPos, velocity, type, damage, knockBack, player.whoAmI); } return false; } @@ -72,6 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SkyFracture); recipe.AddIngredient(ItemID.LunarFlareBook); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs new file mode 100644 index 0000000000..13c78bf28d --- /dev/null +++ b/Projectiles/Magic/LightBlade.cs @@ -0,0 +1,148 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class LightBlade : ModProjectile + { + private const int Lifetime = 180; + private const int NumAfterimages = 8; + private const float LightBrightness = 0.7f; + private const int DustID = 175; + private Color lightColor = Color.White; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = NumAfterimages; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.scale = 1.5f; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 3; + projectile.extraUpdates = 2; + projectile.timeLeft = Lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + // The sprite is diagonal, so rotate by pi/4 + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + // These effects only occur on the first frame. Alpha is set to 0 immediately on frame 1. + if (projectile.alpha > 0) + { + projectile.alpha = 0; + FirstFrameEffects(); + + // Store original velocity for homing calculations + projectile.ai[0] = projectile.velocity.Length(); + } + + // Every other frame, add less light. + else + Lighting.AddLight(projectile.Center, lightColor.ToVector3() * LightBrightness); + + // The projectile never slows down, even as it tries to curve towards enemies + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1000f, projectile.ai[0], 80f); + float currentSpeed = projectile.velocity.Length(); + projectile.velocity *= projectile.ai[0] / currentSpeed; + } + + private void FirstFrameEffects() + { + // Pick a random sword sprite and a random color to use. + projectile.frame = Main.rand.Next(14); + lightColor = TheDanceofLight.GetRandomLightColor(); + + // Spawn starting dust. + Vector2 baseOffsetVec = new Vector2(1f, 4f); + int numDust = 16; + for(int i = 0; i < numDust; ++i) + { + Vector2 dustOffset = Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / numDust) * baseOffsetVec; + dustOffset = dustOffset.RotatedBy(projectile.velocity.ToRotation()); + Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f); + d.position = projectile.Center + dustOffset; + d.velocity = dustOffset.SafeNormalize(Vector2.Zero); + d.velocity *= 1.4f; + d.scale = 1.5f; + d.noGravity = true; + } + + // Each blade appears in a huge flash of light. + float startingBrightness = LightBrightness * 3f; + Lighting.AddLight(projectile.Center, lightColor.ToVector3() * startingBrightness); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 3); + + int numDust = Main.rand.Next(4, 10); + for (int i = 0; i < numDust; i++) + { + Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f, 100); + d.velocity *= 1.6f; + d.velocity += projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f); + d.velocity.Y += -1f; + d.noGravity = true; + d.scale = 2f; + d.fadeIn = 0.5f; + } + } + + public override Color? GetAlpha(Color lightColor) => lightColor; + + // Uses bizarre drawcode because it has a horizontal sprite sheet + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Point projTile = projectile.Center.ToTileCoordinates(); + Color localLight = Lighting.GetColor(projTile.X, projTile.Y); + + Texture2D tex = Main.projectileTexture[projectile.type]; + Rectangle rect = new Rectangle(38 * projectile.frame, 0, 38, 38); + Vector2 halfSpriteSize = rect.Size() / 2f; + + // Draw the projectile itself + Color mainSwordColor = projectile.GetAlpha(localLight); + mainSwordColor.A = 160; + SpriteEffects sfx = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + spriteBatch.Draw(tex, drawPos, new Rectangle?(rect), mainSwordColor, projectile.rotation, halfSpriteSize, projectile.scale, sfx, 0f); + + // Draw the projectile's afterimages + for (int i = 0; i < NumAfterimages; ++i) + { + Color afterimageLight = projectile.GetAlpha(localLight); + afterimageLight.A = 40; + + float posLerp = 1f; + Vector2 afterimagePos = (1f - posLerp) * projectile.position + posLerp * projectile.oldPos[i]; + float rotation = projectile.oldRot[i]; + SpriteEffects afterimageSfx = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float afterimageScale = MathHelper.Lerp(1.2f * projectile.scale, 0.4f * projectile.scale, i / (NumAfterimages - 1f)); + + Vector2 imageDrawPos = afterimagePos + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + spriteBatch.Draw(tex, imageDrawPos, new Rectangle?(rect), afterimageLight, rotation, halfSpriteSize, afterimageScale, afterimageSfx, 0f); + } + + return false; + } + } +} diff --git a/Projectiles/Magic/LightBlade.png b/Projectiles/Magic/LightBlade.png new file mode 100644 index 0000000000000000000000000000000000000000..c216615a26821944a53cef418fb926f4932d1bf0 GIT binary patch literal 1435 zcmYjRdsNbQ6#wNZmzrBAT@SRJr&DGs_QbS_k1S;73+&)>xXeHknJ<*oP)nRER+MS1 znL{~=_`*z4fy7PM)1jgwiYTkZ#0TaR#RvO2S7+ZpzW3hqJ@NTj z0RS*XdV8S&z`z{z_ir`??}r$JD9~(3Kp{KK$ z4O$E)t)cdvPPcO61WKuxT3yvcAp6zBb9ZmQwlsGc)@+OifK5A*ULHYLLMIgdKb^zv zd@)se&crE;2Emc6Z+7EZkpcMayF9lVdpcjQIm98-46<1E+qUF(;5?vbBE7cd9M~Ea zm;K`nR-ZYJ7He2=u6DC_Q+olEq~yOJoKYmSEr}3KOmUY-kz>N-%Y?zDh%F#40QicZ z4Z|Np&_zp=&(r4{;#HX=4thoiCXn7Cr9rI(S4SYefmYZRRga32=KA#T1^_s-oj4|8 zCtTDV7pATL-5}=kwM6#d@9}EmR4R9MWV)y|n=7GGNT&BgWSn+KzXJf^j=L4(ibf-% zyVNAEe6D~egvG3`(#1YAO!?1^*CeV_j4!Zo(qaebv~#cz0{|f7HKaeK_Km#*B}`VH zp5&BIGz*Dlrw}=nSmi)){jSvT;@0dnfO7e>CT*i!etdlKnGslYPR0C$jUx7ktCW8B z;BJ?rGf%`S6#?l~RhKx?JC!RAB3qJ7&#e7NoP4WX;?|K(Q`6!+L1G8Xi6#&$CDEd- zGNh@G7fQInOI9b;JQ3(*)Gxvm!I^#-exCy|IKJiKx-Ys86w@cRmcUxS~Me ztS!AAzSx5wS* zZ?B6Lg64Y}!A*4je?{o8y%m`$d5EM{ouOal?yN&3FG_+EWbyW=aKojE*>l&GFsTAtn~geNUi#URB%%)%1K zEQ8**yWUoty2Az(Vd0bJN-qnsw!msar<==%X~)x=*&>AXyy3(|XNm3X?je*6nGrNm zCPc`mPiUCQJ@|z|YOpKIx2cOCC3EpWN{jbUAS04WdhcJ2cG6Vmn*x#nNA?Sv2~ew& zO|aP0WW|e6XB;|S-T4Z6#bE2$RBJKK4BQ0)eH{+PBcD6X8*XQ{mN;NtO1-6f`6PAQ z-mk+>rVjh&^U25xQ5g13$;OL%1<9Z=rme9iNroR)zW7c!du8;`#~eaRN)H}w(^$mf ze$WQGVJ-_C6F~WK%e%3sRjWoutd~A6h)uL^-n+A)~^Dd=hsvLGu=Ylep!dgED1RZ2basVkr1Wz4iQk_W70`^Eo=Jy|8d8KhwC>O%PLCUMH#fU O7vyO_FRtf>>;C}q+|ug+ literal 0 HcmV?d00001