diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index a362b57861..c2693cb4c4 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; @@ -2546,7 +2546,8 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); } // TODO -- Make Deific Amulet and Rampart of Deities' retaliation effects way cooler - // In the meantime, gave them homing astral bombers instead of the lame falling stars + // In the meantime, gave them homing astral stars instead of the lame falling stars. + // This also serves to make the Honeycomb in Sweetheart Necklace make sense if (dAmulet) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 623491d97d..8ac8d4bb91 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,9 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -23,20 +28,61 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.longInvince = true; modPlayer.dAmulet = true; + player.panic = panicNecklaceEnabled; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.StarVeil). + AddIngredient(ItemID.SweetheartNecklace). AddIngredient(10). - AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.TinkerersWorkbench). Register(); } } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 0e565a1163..5199378c81 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,10 +1,15 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -19,14 +24,53 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.rare = ModContent.RarityType(); } + #region Toggleable Mana Flower + bool manaFlowerEnabled = true; + public override void ModifyTooltips(List tooltips) + { + if (!manaFlowerEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip3"); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + manaFlowerEnabled = !manaFlowerEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("manaFlower", manaFlowerEnabled); + } + + public override void LoadData(TagCompound tag) + { + manaFlowerEnabled = tag.GetBool("manaFlower"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(manaFlowerEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + manaFlowerEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, manaFlowerEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; player.manaMagnet = true; - if (!hideVisual) + if (manaFlowerEnabled) player.manaFlower = true; player.statManaMax2 += 150; diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 091ecaaa0c..68bc76f46d 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,11 +1,17 @@ using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -13,6 +19,7 @@ namespace CalamityMod.Items.Accessories public class RampartofDeities : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() { Item.width = 64; @@ -23,6 +30,45 @@ namespace CalamityMod.Items.Accessories Item.rare = ModContent.RarityType(); } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -31,6 +77,9 @@ namespace CalamityMod.Items.Accessories player.longInvince = true; modPlayer.dAmulet = true; + //Panic Necklace effect if enabled + player.panic = panicNecklaceEnabled; + // Large hit iframe effect taken from Seraph Tracers modPlayer.rampartOfDeities = true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 0d606a5fae..94808287a5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -573,10 +573,13 @@ DeificAmulet: { DisplayName: Deific Amulet Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when hurt, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] ''' + ToggleEffect: "and increases movement speed " } DepthCharm: { @@ -751,7 +754,8 @@ EtherealTalisman: { 15% increased magic damage, 5% increased magic critical strike chance +150 max mana and 10% decreased mana usage Increases pickup range for mana stars - You automatically use mana potions when needed if visibility is on + You automatically use mana potions when needed + [c/aaaaaa:Shift- to toggle] [i:ManaFlower] [c/aaaaaa:Mana Flower's effect] ''' } @@ -1433,14 +1437,17 @@ RampartofDeities: { DisplayName: Rampart of Deities Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when struck, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP Being struck for over 200 damage grants 30 additional invincibility frames Grants immunity to knockback Puts a shell around the owner when below 50% life that reduces damage by 25% Absorbs 25% of damage done to players on your team when above 25% life + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] ''' + ToggleEffect: "and increases movement speed " } RareElementalinaBottle: { diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 3a298b34a5..758323e8d2 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -293,6 +293,20 @@ namespace CalamityMod spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, wantedScale, SpriteEffects.None, 0); } + static Asset ItemDotTexture; + /// + /// Draws an enabled/disabled dot at the bottom right of the item's sprite + /// Used for effects that are enabled/disabled + /// + /// + /// + public static void DrawInventoryDot(SpriteBatch spriteBatch, Vector2 itemPosition, Vector2 dotOffset, bool enabled) + { + var tex = CalamityUtils.GetTextureEfficient(ref ItemDotTexture, "Terraria/Images/Extra_20").Value; + var dotFrame = tex.Frame(1,4, frameY: enabled ? 1 : 2); + spriteBatch.Draw(tex, itemPosition + dotOffset, dotFrame, Color.White, 0, dotFrame.Size() * 0.5f, Main.inventoryScale, SpriteEffects.None, 0); + } + /// /// Draws a treasure bag in the world in the exact same way as how Terraria 1.4's bags are drawn. ///