From c2954fc69994408dcedabbad7fbe1a9be99272d2 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 12 Jun 2021 18:12:32 -0500 Subject: [PATCH] Withered Enchant and Shattered Community change --- Buffs/Cooldowns/Withered.cs | 21 +++++++++++++++ Buffs/Cooldowns/Withered.png | Bin 0 -> 517 bytes CalPlayer/CalamityPlayerLifeRegen.cs | 19 ++++++++++++- Items/Accessories/ShatteredCommunity.cs | 25 ------------------ Items/CalamityGlobalItem.cs | 2 +- .../CalamitasEnchantUI.cs | 3 --- .../EnchantmentManager.cs | 12 +++++++-- 7 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 Buffs/Cooldowns/Withered.cs create mode 100644 Buffs/Cooldowns/Withered.png diff --git a/Buffs/Cooldowns/Withered.cs b/Buffs/Cooldowns/Withered.cs new file mode 100644 index 0000000000..5a68168394 --- /dev/null +++ b/Buffs/Cooldowns/Withered.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class Withered : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Withered"); + Description.SetDefault("Holding withered weapons causes you to suffer but makes your weapons strong"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().witheredDebuff = true; + } +} diff --git a/Buffs/Cooldowns/Withered.png b/Buffs/Cooldowns/Withered.png new file mode 100644 index 0000000000000000000000000000000000000000..8565069431ae04a073a6edffbea36c09cd24b8bb GIT binary patch literal 517 zcmV+g0{Z=lP)s zX2sZ82*JW47CU#s%~RGuk8f-&l_)-faLLC{WOEin*Y;FlqLz?U-%FME9>-BR8+o zXSC+YT>%{f@5-Q=pB%+cYsEJ6QsXjp;BIxDkDLPkt+YN(%e>?sKv>c-V+Utsc00000NkvXX Hu0mjfX6NGx literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 3623f87f65..5befef5ace 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -408,7 +409,23 @@ namespace CalamityMod.CalPlayer if (player.lifeRegen > 0) player.lifeRegen = 0; lifeRegenLost += 42; //the meaning of death - } + } + if (modPlayer.witheredDebuff) + { + modPlayer.witheredWeaponHoldTime += modPlayer.witheringWeaponEnchant.ToDirectionInt(); + if (modPlayer.witheredWeaponHoldTime < 0) + { + modPlayer.witheredWeaponHoldTime = 0; + } + else + { + lifeRegenLost += (int)(4D * Math.Pow(1.5D, modPlayer.witheredWeaponHoldTime / 87D)); + if (player.lifeRegen > 0) + player.lifeRegen = 0; + } + } + else + modPlayer.witheredWeaponHoldTime = 0; player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index f26df095ed..731ab8fe33 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -238,30 +238,5 @@ namespace CalamityMod.Items.Accessories level = reader.ReadInt32(); totalRageDamage = reader.ReadInt64(); } - - public override void AddRecipes() - { - ModRecipe r = new ShatteredCommunityRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 120); - r.AddRecipe(); - } - - // The Shattered Community can only be crafted with a full-power Community. - // That is, in a world where all relevant bosses have been defeated. - private class ShatteredCommunityRecipe : ModRecipe - { - public ShatteredCommunityRecipe(Mod mod) : base(mod) { } - - public override bool RecipeAvailable() - { - bool vanillaBosses = NPC.downedSlimeKing && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedQueenBee && NPC.downedBoss3 && Main.hardMode; - vanillaBosses &= NPC.downedMechBossAny && NPC.downedPlantBoss && NPC.downedGolemBoss && NPC.downedFishron && NPC.downedAncientCultist && NPC.downedMoonlord; - bool calamityBosses = CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedYharon; - return vanillaBosses && calamityBosses; - } - } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 0847369958..34dec2710e 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1721,7 +1721,7 @@ namespace CalamityMod.Items if (calamitasNPCIndex != -1) currentPower = Utils.InverseLerp(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); - position += Vector2.One * 14f; + position += frame.Size() * 0.25f; EnchantmentEnergyParticles.InterpolationSpeed = MathHelper.Lerp(0.035f, 0.1f, currentPower); EnchantmentEnergyParticles.DrawSet(position + Main.screenPosition); diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index b3570e3ad6..5abf79f364 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -239,9 +239,6 @@ namespace CalamityMod.UI.CalamitasEnchants itemScale *= inventoryScale * baseScale; drawPosition += Vector2.One * 23f * baseScale; - if (EnchantmentManager.ItemUpgradeRelationship.ContainsKey(CurrentlyHeldItem.type)) - drawPosition -= Vector2.One * 12f; - // Draw the item. if (hasMultipleFrames || ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 377204cc07..aa03ce8d81 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -180,7 +181,7 @@ namespace CalamityMod.UI.CalamitasEnchants player => player.Calamity().dischargingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), - new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. The explosion can hurt both you and enemies. Minions do more damage the longer they live and idly explode.", + new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, null, player => player.Calamity().explosiveMinionsEnchant = true, @@ -223,6 +224,12 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().manaMonsterEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + + new Enchantment("Withering", "You heal when hurt based on damage dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.", + 1000, + null, + player => player.Calamity().witheringWeaponEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. @@ -232,7 +239,8 @@ namespace CalamityMod.UI.CalamitasEnchants ItemUpgradeRelationship = new Dictionary() { - [ModContent.ItemType()] = ModContent.ItemType() + [ModContent.ItemType()] = ModContent.ItemType(), + [ModContent.ItemType()] = ModContent.ItemType(), }; }