diff --git a/Items/Accessories/Wings/BaseWings.cs b/Items/Accessories/Wings/BaseWings.cs index 0526175386..eba6d5ecf0 100644 --- a/Items/Accessories/Wings/BaseWings.cs +++ b/Items/Accessories/Wings/BaseWings.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { + if (Item.wingSlot == -1) return; ascentWhenFalling = BonusAscentWhileFalling; ascentWhenRising = BonusAscentWhileRising; maxCanAscendMultiplier = RisingSpeedThreshold; @@ -60,7 +61,15 @@ namespace CalamityMod.Items.Accessories.Wings public override void ModifyTooltips(List list) { - WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; + if (Item.wingSlot == -1) return; + WingStats stats = new(); + if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersCelestial.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersElysian.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersSeraph.wingSlot]; + else stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; int time = stats.FlyTime; float run = stats.AccRunSpeedOverride; float rAcc = stats.AccRunAccelerationMult * 0.08f; diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 904c7565bc..23afcb2c1c 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -1,10 +1,13 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -17,7 +20,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -28,9 +36,37 @@ namespace CalamityMod.Items.Accessories.Wings Item.rare = ItemRarityID.LightPurple; } + public override void SaveData(TagCompound tag) + { + tag.Add("wingsDisabled", Item.wingSlot == -1); + } + + public override void LoadData(TagCompound tag) + { + if (tag.TryGet("wingsDisabled", out bool wingsDisabled)) + { + if (wingsDisabled) Item.wingSlot = -1; + } + } + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + if (Item.wingSlot == wingSlot) + Item.wingSlot = -1; + else + Item.wingSlot = wingSlot; + } + + public override bool ConsumeItem(Player player) => false; + public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (Item.wingSlot != -1 && player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { player.rocketDelay2--; if (player.rocketDelay2 <= 0) @@ -97,6 +133,23 @@ namespace CalamityMod.Items.Accessories.Wings player.Calamity().calamityBonusLuck += 0.05f; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings. + position -= -new Vector2(0, frame.Height/2-2); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale + ); + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/MOAB.png b/Items/Accessories/Wings/MOAB.png index ecafba2594..4efaf59d28 100644 Binary files a/Items/Accessories/Wings/MOAB.png and b/Items/Accessories/Wings/MOAB.png differ diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index 2c6198dd03..534557250b 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Linq; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,6 +8,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -20,7 +22,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + public static int wingSlot = 0; + + public override void SetStaticDefaults() { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -30,7 +37,33 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; } + public override void SaveData(TagCompound tag) + { + tag.Add("wingsDisabled", Item.wingSlot == -1); + } + public override void LoadData(TagCompound tag) + { + if (tag.TryGet("wingsDisabled", out bool wingsDisabled)) + { + if (wingsDisabled) Item.wingSlot = -1; + } + } + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + if (Item.wingSlot == wingSlot) + Item.wingSlot = -1; + else + Item.wingSlot = wingSlot; + } + + public override bool ConsumeItem(Player player) => false; public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) @@ -57,7 +90,11 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - player.noFallDmg = true; + player.noFallDmg = true; if (Item.wingSlot == -1) //Only applies if tracers are plucked + { + player.rocketBoots = player.vanityRocketBoots = 4; + modPlayer.angelTreads = true; + } modPlayer.tracersDust = !hideVisual; modPlayer.tracersCelestial = true; } @@ -74,6 +111,8 @@ namespace CalamityMod.Items.Accessories.Wings public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { + frame = new Rectangle(0,(Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings. + position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 2 : 0)); CalamityUtils.DrawInventoryCustomScale( spriteBatch, texture: TextureAssets.Item[Type].Value, diff --git a/Items/Accessories/Wings/TracersCelestial.png b/Items/Accessories/Wings/TracersCelestial.png index ceb770eb52..54ea38e092 100644 Binary files a/Items/Accessories/Wings/TracersCelestial.png and b/Items/Accessories/Wings/TracersCelestial.png differ diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index 403641dcdf..b72b274191 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -10,6 +11,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,7 +25,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.7f; public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -33,7 +40,45 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); } + public override void SaveData(TagCompound tag) + { + tag.Add("wingsDisabled", Item.wingSlot == -1); + } + public override void LoadData(TagCompound tag) + { + if (tag.TryGet("wingsDisabled", out bool wingsDisabled)) + { + if (wingsDisabled) Item.wingSlot = -1; + } + } + + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + if (Main.LocalPlayer.armor.Contains(Item)) foreach (var item in Main.LocalPlayer.armor) + { + if (item.wingSlot > 0 && item.wingSlot != wingSlot) + return false; + } + return true; + } + public override void RightClick(Player player) + { + if (Item.wingSlot == wingSlot) + { + Item.wingSlot = -1; + Item.color = Color.Gray; + } + else + { + Item.wingSlot = wingSlot; + Item.color = Color.White; + } + } + + public override bool ConsumeItem(Player player) => false; public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) @@ -61,6 +106,12 @@ namespace CalamityMod.Items.Accessories.Wings player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; player.noFallDmg = true; + player.socialShadowRocketBoots = true; + if (Item.wingSlot == -1) //Only applies if tracers are plucked + { + player.rocketBoots = player.vanityRocketBoots = 1; + modPlayer.angelTreads = true; + } modPlayer.tracersDust = !hideVisual; modPlayer.elysianWingsDust = !hideVisual; modPlayer.tracersElysian = true; @@ -79,6 +130,8 @@ namespace CalamityMod.Items.Accessories.Wings public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { + frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings. + position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 2 : 0)); CalamityUtils.DrawInventoryCustomScale( spriteBatch, texture: TextureAssets.Item[Type].Value, diff --git a/Items/Accessories/Wings/TracersElysian.png b/Items/Accessories/Wings/TracersElysian.png index 4bb21bbcbf..55736dc3bd 100644 Binary files a/Items/Accessories/Wings/TracersElysian.png and b/Items/Accessories/Wings/TracersElysian.png differ diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index b157d040ac..72597045dc 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -1,5 +1,7 @@ -using CalamityMod.CalPlayer; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -10,6 +12,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,8 +26,51 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.9f; public override float BaseAscent => 0.145f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + wingSlot = Item.wingSlot; + } + public override void SaveData(TagCompound tag) + { + tag.Add("wingsDisabled", Item.wingSlot == -1); + } + + public override void LoadData(TagCompound tag) + { + if (tag.TryGet("wingsDisabled", out bool wingsDisabled)) + { + if (wingsDisabled) Item.wingSlot = -1; + } + } + + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + if (Main.LocalPlayer.armor.Contains(Item)) foreach (var item in Main.LocalPlayer.armor) + { + if (item.wingSlot > 0 && item.wingSlot != wingSlot) + return false; + } + return true; + } + public override void RightClick(Player player) + { + if (Item.wingSlot == wingSlot){ + Item.wingSlot = -1; + Item.color = Color.Gray; + } + else + { + Item.wingSlot = wingSlot; + Item.color = Color.White; + } + } + + public override bool ConsumeItem(Player player) => false; public override void SetDefaults() { base.SetDefaults(); @@ -61,6 +107,11 @@ namespace CalamityMod.Items.Accessories.Wings player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; player.noFallDmg = true; + if (Item.wingSlot == -1) //Only applies if tracers are plucked + { + player.rocketBoots = player.vanityRocketBoots = 2; + modPlayer.angelTreads = true; + } modPlayer.tracersDust = !hideVisual; modPlayer.elysianWingsDust = !hideVisual; modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects @@ -78,6 +129,8 @@ namespace CalamityMod.Items.Accessories.Wings public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { + frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings. + position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 6 : 4)); CalamityUtils.DrawInventoryCustomScale( spriteBatch, texture: TextureAssets.Item[Type].Value, diff --git a/Items/Accessories/Wings/TracersSeraph.png b/Items/Accessories/Wings/TracersSeraph.png index 1608a8dc7c..827f15b22d 100644 Binary files a/Items/Accessories/Wings/TracersSeraph.png and b/Items/Accessories/Wings/TracersSeraph.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 9fbc0e3b60..a310c47818 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -59,7 +59,8 @@ MOAB: { DisplayName: MOAB Tooltip: ''' - {$CommonItemTooltip.FlightAndSlowfall} + {$CommonItemTooltip.FlightAndSlowfall} when jetpack is enabled + Shift- this item while in your inventory to toggle the jetpack 32% increased jump speed and allows auto-jump Grants the player cloud, blizzard, and sandstorm mid-air jumps 'The Mother Of All Balloons' @@ -114,10 +115,10 @@ TracersCelestial: { DisplayName: Celestial Tracers Tooltip: ''' - {$CommonItemTooltip.FlightAndSlowfall} - 24% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + {$CommonItemTooltip.FlightAndSlowfall} when it has wings + Shift- this item while in your inventory to toggle the wings + 24% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads 'Ludicrous speed!' ''' } @@ -126,10 +127,10 @@ TracersElysian: { DisplayName: Elysian Tracers Tooltip: ''' - {$CommonItemTooltip.FlightAndSlowfall} - 36% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + {$CommonItemTooltip.FlightAndSlowfall} when it has wings + Shift- this item while in your inventory to toggle the wings + 36% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads 'Ludicrous speed!' ''' } @@ -138,10 +139,11 @@ TracersSeraph: { DisplayName: Seraph Tracers Tooltip: ''' - {$CommonItemTooltip.FlightAndSlowfall} - 50% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire, lava, and harmful block effects + {$CommonItemTooltip.FlightAndSlowfall} when it has wings + Shift- this item while in your inventory to toggle the wings + 50% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to [i:CalamityMod/AuricOre] Auric Ore's rejection 'Taking speed EVEN FURTHER BEYOND!' ''' }