diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c8bca67e6f..9da02a26bb 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4610,12 +4610,12 @@ namespace CalamityMod.CalPlayer } //Multiply vertical speed - if (redWine) + if (redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) { if (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f) { redWineStoredY = Player.velocity.Y; - Player.velocity.Y *= 1 + RedWine.VerticalSpeedBoost; + Player.velocity.Y *= 1 + (redWine ? RedWine.VerticalSpeedBoost : 0) + (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine) ? RedWine.VerticalSpeedBoost : 0); } else { @@ -4922,7 +4922,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateEquips public override void PostUpdateEquips() { - + var dripPlayer = Player.GetModPlayer(); var item = Player.HeldItem; if (!(item.IsAir || item.damage <= 0)) { @@ -4931,11 +4931,13 @@ namespace CalamityMod.CalPlayer TimeHoldingMelee++; if (TimeHoldingMelee > Whiskey.TimeToDischarge) TimeHoldingMelee = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMelee / Whiskey.TimeToDischarge); - } - } else + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + } + else { TimeHoldingMelee -= 2; if (TimeHoldingMelee < 0) @@ -4945,11 +4947,12 @@ namespace CalamityMod.CalPlayer { TimeHoldingRanged++; if (TimeHoldingRanged > Whiskey.TimeToDischarge) - TimeHoldingRanged = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRanged / Whiskey.TimeToDischarge); - } + TimeHoldingRanged = (int)Whiskey.TimeToDischarge; + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); } else { @@ -4962,10 +4965,11 @@ namespace CalamityMod.CalPlayer TimeHoldingMagic++; if (TimeHoldingMagic > Whiskey.TimeToDischarge) TimeHoldingMagic = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMagic / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); } else { @@ -4978,10 +4982,11 @@ namespace CalamityMod.CalPlayer TimeHoldingSummon++; if (TimeHoldingSummon > Whiskey.TimeToDischarge) TimeHoldingSummon = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingSummon / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); } else { @@ -4994,10 +4999,12 @@ namespace CalamityMod.CalPlayer TimeHoldingRogue++; if (TimeHoldingRogue > Whiskey.TimeToDischarge) TimeHoldingRogue = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRogue / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + } else { @@ -5018,6 +5025,10 @@ namespace CalamityMod.CalPlayer if (TimeHoldingRogue-- < 0) TimeHoldingRogue = 0; } + if (dripPlayer.HasAlcohol(AlcoholType.Moonshine)) + { + Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost)); + } // PostUpdateMiscEffects runs after the cap has been applied. Do NOT put mining speed stuff there. @@ -5154,7 +5165,7 @@ namespace CalamityMod.CalPlayer } //reset the stored Y value for red wine's increased vertical speed - if (redWine && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) + if ((redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) { Player.velocity.Y = redWineStoredY; } @@ -5434,6 +5445,8 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.MoscowMule)) + knockback += MoscowMule.KnockbackBoost; if (titanHeartMantle && rogue) knockback += TitanHeartMantle.RogueKnockbackBoost; @@ -5612,7 +5625,7 @@ namespace CalamityMod.CalPlayer { if (bladeArmEnchant) return false; - if (purpleHaze) + if (purpleHaze || Player.GetModPlayer().HasAlcohol(AlcoholType.PurpleHaze)) { if (item.CountsAsClass() && StealthStrikeAvailable()) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0c6d477f4b..94a559ecea 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2888,8 +2888,9 @@ namespace CalamityMod.CalPlayer defenseDamageRecoveryFrames = 0; // Directly add the base defense damage recovery time to whatever recovery time the player already has. - int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1); + int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1) * (Player.GetModPlayer().HasAlcohol(AlcoholType.Moonshine) ? 3 : 1); totalDefenseDamageRecoveryFrames = defenseDamageRecoveryFrames + baseTime; + if (totalDefenseDamageRecoveryFrames > DefenseDamageMaxRecoveryTime) totalDefenseDamageRecoveryFrames = DefenseDamageMaxRecoveryTime; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index fcbf9daa02..ec21812c99 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -194,13 +194,14 @@ namespace CalamityMod.CalPlayer { int buff = Player.buffType[l]; if (BuffDatasets.DebuffDataset[buff] is not null && BuffDatasets.DebuffDataset[buff].AlcoholLevel > 0) - alcoholPoisonLevel += BuffDatasets.DebuffDataset[buff].AlcoholLevel; + alcoholPoisonLevel += BuffDatasets.DebuffDataset[buff].AlcoholLevel + (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear) ? 1 : 0); } if (Player.Calamity().ivDrip) // +1 stack of poisoning while IV Drip is equipped alcoholPoisonLevel++; if (everclear) totalNegativeLifeRegen += Everclear.RegenLoss; - + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + totalNegativeLifeRegen += Everclear.RegenLoss; // Blanket effect for all alcohols if (alcoholPoisonLevel > 0) { @@ -267,8 +268,11 @@ namespace CalamityMod.CalPlayer // At the last second, Reaver defense helm reduces DoT debuffs by 20% if (reaverDefense) totalNegativeLifeRegen -= (int)(totalNegativeLifeRegen * ReaverHeadTank.SetBonusDebuffDamageReduction); + if (tequilaSunrise) totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.TequilaSunrise)) + totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); Player.lifeRegen -= (int)totalNegativeLifeRegen; @@ -340,8 +344,19 @@ namespace CalamityMod.CalPlayer if (tequilaSunrise) Player.lifeRegenTime += 1800; + } + var dripPlayer = Player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.TequilaSunrise)) + { + if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff) + { + Player.lifeRegenTime += 1800; + } + } + + #endregion // During Silva revive or God Slayer dash, all negative life regen is canceled diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 1a9b1fdc38..8da5444ed7 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -566,6 +566,13 @@ namespace CalamityMod.CalPlayer else if (Player.dashDelay == -1) Player.velocity.X *= 0.825f; } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.CinnamonRoll) && !(Main.getGoodWorld && Main.npc.Any(x => x.active && x.type == ModContent.NPCType()))) + { + if (dashStart) + Player.velocity.X *= 2f; + else if (Player.dashDelay == -1) + Player.velocity.X *= 0.825f; + } if (Player.dashDelay == -1) IsFirstDashFrame = false; @@ -1277,6 +1284,18 @@ namespace CalamityMod.CalPlayer } } } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Margarita)) + { + if (Main.myPlayer == Player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int buffID = Player.buffType[l]; + if (Player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) + Player.buffTime[l]--; + } + } + } // Update the Providence Burn effect drawer if applicable. float providenceBurnIntensity = 0f; @@ -3357,6 +3376,7 @@ namespace CalamityMod.CalPlayer #region Other Buff Effects private void OtherBuffEffects() { + var dripPlayer = Player.GetModPlayer(); if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; @@ -3544,30 +3564,50 @@ namespace CalamityMod.CalPlayer { //this is so janky looking but it's the only way I could get it to work properly if (!(StealthStrikeAvailable() && Player.HeldItem.DamageType == RogueDamageClass.Instance)) - Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost; + Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.DamageBoost : 0); else - stealthDamage -= PurpleHaze.StealthDamageLoss; + stealthDamage -= PurpleHaze.StealthDamageLoss + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.StealthDamageLoss : 0); } if (everclear) Player.GetDamage() += Everclear.DamageBoost; - + if (dripPlayer.HasAlcohol(AlcoholType.Everclear)) + Player.GetDamage() += Everclear.DamageBoost; if (caribbeanRum) { Player.gravity *= CaribbeanRum.GravityMultiplier; Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; } + if (dripPlayer.HasAlcohol(AlcoholType.CaribbeanRum)) + { + Player.gravity *= CaribbeanRum.GravityMultiplier; + Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; + } if (starBeamRye) { Player.manaRegenCount += StarBeamRye.ManaRegenBoost; Player.GetDamage() *= StarBeamRye.MagicDmgMult; } - - if (whiteWine) + if (dripPlayer.HasAlcohol(AlcoholType.StarBeamRye)) { - Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + Player.manaRegenCount += StarBeamRye.ManaRegenBoost; + Player.GetDamage() *= StarBeamRye.MagicDmgMult; + } + + if (dripPlayer.HasAlcohol(AlcoholType.Ale) || dripPlayer.HasAlcohol(AlcoholType.Sake)) + { + Player.GetAttackSpeed() -= 0.1f; + // See CalamityGlobalItem and PlayerUtils for Ale's melee size increase + } + + if (whiteWine || dripPlayer.HasAlcohol(AlcoholType.WhiteWine)) + { + if (whiteWine) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); float bonus = 0f; float MaxDistance = 640f; @@ -3579,7 +3619,12 @@ namespace CalamityMod.CalPlayer } else bonus = 0; - whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + + if (whiteWine) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + while (whiteWineTimer > 1) { if (Player.wingTime < Player.wingTimeMax) @@ -3589,9 +3634,9 @@ namespace CalamityMod.CalPlayer } if (redWine) - { Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); - } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); if (giantPearl) { @@ -4733,6 +4778,12 @@ namespace CalamityMod.CalPlayer if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + { + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); + } + if (DesertProwlerHat.ShroudedInSmoke(Player, out _)) Player.statDefense -= (int)(Player.statDefense * DesertProwlerHat.SmokeDefenseMult); } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 8f757d6660..f33bdf1c43 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -239,7 +239,10 @@ namespace CalamityMod.CalPlayer if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); - if (moscowMule) + var ivDripPlayer = Player.GetModPlayer(); + + // "Heavy" Knockback effect + if (moscowMule || ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule)) { var center = Player.Center; if (proj.IsMinionOrSentryRelated) @@ -254,10 +257,16 @@ namespace CalamityMod.CalPlayer { proj.damage = (int)(proj.damage * (moscowMule ? 0.8f : 1f) * (bloodyMary ? 0.75f : 1f)); } - + } + if (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) || ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary)) + { + if (!(PierceResistNPC.exemptProjectiles.Contains(proj.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(proj.type) && PierceResistNPC.singleHitboxExemptProjectiles[proj.type]))) + { + proj.damage = (int)(proj.damage * (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? 0.8f : 1f) * (ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? 0.75f : 1f)); + } } - if (witheringWeaponEnchant) + if (witheringWeaponEnchant) witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.TypelessDebuffMultiplier = TypelessDebuffMultiplier; cgn.HeatDebuffMultiplier = HeatDebuffMultiplier; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 38e435b56e..775374dc21 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -563,6 +563,8 @@ namespace CalamityMod.ILEditing { if (self.Calamity().oldFashioned) damage = (int)(damage * OldFashioned.DamageBoostMultiplier); + if (self.GetModPlayer().HasAlcohol(AlcoholType.OldFashioned)) + damage = (int)(damage * OldFashioned.DamageBoostMultiplier); orig(self, npc, damage, knockback, direction, crit, damageType, damageVariation); } #endregion diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index aebb7705d0..97aafbb425 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -1,42 +1,271 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Rarities; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.UI; namespace CalamityMod.Items.Accessories { + public enum AlcoholType + { + None, + BloodyMary, + CaribbeanRum, + CinnamonRoll, + Everclear, + EvergreenGin, + Fireball, + GrapeBeer, + Manhattan, + Margarita, + Moonshine, + MoscowMule, + OldFashioned, + PurpleHaze, + RedWine, + Rum, + Screwdriver, + StarBeamRye, + Tequila, + TequilaSunrise, + Vodka, + Whiskey, + WhiteWine, + Ale, + Sake + } + + public interface IAlcoholItem + { + Action IVDripAlcoholEffect { get; } + AlcoholType AlcoholVariant { get; } + LocalizedText DripEffectText { get; } + } + public class IVDripOnTheRocks : ModItem, ILocalizedModType { + public int containedAlcoholID = -1; + public AlcoholType currentAlcoholType = AlcoholType.None; public new string LocalizationCategory => "Items.Accessories"; - public static readonly float DamageBoostMultiplier = 1.25f; // Same as Old Fashioned but can be changed at any time - public static readonly float DamageReductionMultiplier = 0.75f; // Same as Old Fashioned but can be changed at any time - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); public override void SetDefaults() + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new Terraria.DataStructures.DrawAnimationVertical(1, 25)); + ItemID.Sets.AnimatesAsSoul[Item.type] = true; + } + + public override void SetDefaults() { Item.width = 58; - Item.height = 60; + Item.height = 62; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void Load() { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ivDrip = true; + On_ItemSlot.OverrideLeftClick += IvDripAlcoholEquip; } - public override void AddRecipes() + public override void Unload() { - CreateRecipe(). - AddIngredient(). - AddIngredient(6). - AddTile(TileID.MythrilAnvil). - Register(); + On_ItemSlot.OverrideLeftClick -= IvDripAlcoholEquip; + } + + private bool IvDripAlcoholEquip(On_ItemSlot.orig_OverrideLeftClick orig, Item[] inv, int context, int slot) + { + if (context == ItemSlot.Context.InventoryItem || context == ItemSlot.Context.ChestItem) + { + Item mouseItem = Main.mouseItem; + Item targetItem = inv[slot]; + + // Vanilla alcohols have to be applied manually + bool isMouseAle = mouseItem.type == ItemID.Ale; + bool isTargetAle = targetItem.type == ItemID.Ale; + bool isMouseSake = mouseItem.type == ItemID.Sake; + bool isTargetSake = targetItem.type == ItemID.Sake; + + // Alcohol into this acc + if (targetItem.ModItem is IVDripOnTheRocks drip && (mouseItem.ModItem is IAlcoholItem || isMouseAle || isMouseSake)) + { + if (drip.containedAlcoholID == -1) + { + drip.containedAlcoholID = mouseItem.type; + drip.currentAlcoholType = isMouseAle ? AlcoholType.Ale : (isMouseSake ? AlcoholType.Sake : (mouseItem.ModItem as IAlcoholItem).AlcoholVariant); + + mouseItem.stack--; + if (mouseItem.stack <= 0) + mouseItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + + if (mouseItem.ModItem is IVDripOnTheRocks dripHeld && (targetItem.ModItem is IAlcoholItem || isTargetAle || isTargetSake)) + { + if (dripHeld.containedAlcoholID == -1) + { + dripHeld.containedAlcoholID = targetItem.type; + dripHeld.currentAlcoholType = isTargetAle ? AlcoholType.Ale : (isTargetSake ? AlcoholType.Sake : (targetItem.ModItem as IAlcoholItem).AlcoholVariant); + + targetItem.stack--; + if (targetItem.stack <= 0) + targetItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + } + return orig(inv, context, slot); + } + + #region Shift-Right Click to Empty IV Drip + + // Allow shift-right clicking only if the IV drip actually contains alcohol + public override bool CanRightClick() => containedAlcoholID != -1 && Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); + + public override void RightClick(Player player) + { + if (containedAlcoholID != -1) + { + // Give the alcohol back to the player + player.QuickSpawnItem(player.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + + Item.stack++; + + SoundEngine.PlaySound(SoundID.Grab); + } + } + #endregion + public override void PreReforge() + { + if (containedAlcoholID != -1) + { + // Refund the alcohol to the player. + Main.LocalPlayer.QuickSpawnItem(Main.LocalPlayer.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + IVDripPlayer dripPlayer = player.GetModPlayer(); + dripPlayer.ivDripEquipped = true; + + if (containedAlcoholID != -1) + { + dripPlayer.currentAlcohol = currentAlcoholType; + + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + dripPlayer.ApplyIVDripAlcoholEffect(alcohol.IVDripAlcoholEffect); + } + } + + public override void ModifyTooltips(List tooltips) + { + if (tooltips == null) return; + + var effectLine = tooltips.FirstOrDefault(x => x.Text.Contains("[EFFECT]")); + var nameLine = tooltips.FirstOrDefault(x => x.Text.Contains("[NAME]")); + + if (containedAlcoholID == -1) + { + if (effectLine != null) + { + effectLine.Text = this.GetLocalizedValue("Empty"); + effectLine.OverrideColor = Color.Gray; + } + nameLine?.Hide(); + return; + } + + if (effectLine != null) + { + if (containedAlcoholID == ItemID.Ale || containedAlcoholID == ItemID.Sake) + effectLine.Text = this.GetLocalizedValue("SakeAndAleText"); + + else + { + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + effectLine.Text = alcohol.DripEffectText.Value; + } + } + + if (nameLine != null) + { + string alcoholName = Lang.GetItemNameValue(containedAlcoholID); + nameLine.Text = this.GetLocalizedValue("CurrentAlcoholText") + $" [c/FF81E4:{alcoholName}]"; + } + } + + // Draw the correct alcohol variant frame + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = TextureAssets.Item[Item.type].Value; + + int frameHeight = texture.Height / 25; + int frameIndex = (int)currentAlcoholType; + + Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight); + + spriteBatch.Draw(texture, position, targetFrame, drawColor, 0f, origin, scale, SpriteEffects.None, 0f); + return false; + } + } + + public class IVDripPlayer : ModPlayer + { + public Dictionary, float> IVDripAlcoholEffects = new(); + public bool ivDripEquipped; + public AlcoholType currentAlcohol = AlcoholType.None; + + // would otherwise be spamming these checks manually any time another class wants to check for if IV drip has a certain alcohol filled + public bool HasAlcohol(AlcoholType type) + { + return ivDripEquipped && currentAlcohol == type; + } + + public override void ResetEffects() + { + IVDripAlcoholEffects.Clear(); + ivDripEquipped = false; + currentAlcohol = AlcoholType.None; + } + + public void ApplyIVDripAlcoholEffect(Action effect) + { + if (effect == null) + return; + + if (IVDripAlcoholEffects.ContainsKey(effect)) + IVDripAlcoholEffects[effect] += 1f; + else + IVDripAlcoholEffects[effect] = 1f; + } + + public override void PostUpdateEquips() + { + foreach (var effect in IVDripAlcoholEffects) + { + effect.Key.Invoke(Player, effect.Value); + } } } } diff --git a/Items/Accessories/IVDripOnTheRocks.png b/Items/Accessories/IVDripOnTheRocks.png index b2736f4dac..452d80ed70 100644 Binary files a/Items/Accessories/IVDripOnTheRocks.png and b/Items/Accessories/IVDripOnTheRocks.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index c4ba2b06f9..d5dfbd4fd0 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -884,8 +884,10 @@ namespace CalamityMod.Items // This assume all items with a damage hit is a weapon. There appears to be no edge cases for this thus far if (player.Calamity().oldFashioned) modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; - if (player.Calamity().ivDrip) - modifiers.SourceDamage *= IVDripOnTheRocks.DamageReductionMultiplier; + + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned)) + modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; } public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -937,6 +939,8 @@ namespace CalamityMod.Items // Xyk 3MARCH2026: Doesn't work on any non use style 1 items currently, Doze will fix it if (item.CountsAsClass() && player.HasBuff(BuffID.Tipsy)) scale += 0.15f; + if (item.CountsAsClass() && (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake))) + scale += 0.15f; } public override void UpdateArmorSet(Player player, string set) { diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 6dd7d3f933..84c40f44c0 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,10 +10,26 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class BloodyMary : ModItem, ILocalizedModType + public class BloodyMary : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float PierceDamageMultiplier = 0.66f; + public static float SpawnRateGateMultiplier = 0.142f; + public static float IVDripAdditionalSpawnRateGateMultiplier = 0.7f; + public static float SpawnLimitMultiplier = 5f; + public static float IVDripAdditionalSpawnLimitMultiplier = 1.5f; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BloodyMary.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BloodyMary; + + public Action IVDripAlcoholEffect => ApplyBloodyMaryEffect; + + private static void ApplyBloodyMaryEffect(Player player, float intensity) + { + // See CalamityPlayerOnHit + } + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index ea3de081cf..91ab6bf46d 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CaribbeanRum : ModItem, ILocalizedModType + public class CaribbeanRum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MoveSpeedBoost = 0.25f; public static float GravityMultiplier = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), (1-GravityMultiplier).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CaribbeanRum.DripEffect").WithFormatArgs(MoveSpeedBoost.ToPercent(), (1 - GravityMultiplier).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.CaribbeanRum; + + public Action IVDripAlcoholEffect => ApplyCaribbeanRumEffect; + + private static void ApplyCaribbeanRumEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 990fcb4353..b9a062f753 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,10 +11,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CinnamonRoll : ModItem, ILocalizedModType + public class CinnamonRoll : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public AlcoholType AlcoholVariant => AlcoholType.CinnamonRoll; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CinnamonRoll.DripEffect"); + public Action IVDripAlcoholEffect => ApplyCinnamonRollEffect; + + private static void ApplyCinnamonRollEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 3089c42d4d..a34636e51d 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Everclear : ModItem, ILocalizedModType + public class Everclear : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,7 +18,15 @@ namespace CalamityMod.Items.Potions.Alcohol public static int RegenLoss = 10; public static float DefenseLossPercent = 0.30f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Everclear.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Everclear; + public Action IVDripAlcoholEffect => ApplyEverclearEffect; + + private static void ApplyEverclearEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e1b4a1fa07..45ee686743 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,13 +10,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class EvergreenGin : ModItem, ILocalizedModType + public class EvergreenGin : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.EvergreenGin.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.EvergreenGin; + + public Action IVDripAlcoholEffect => ApplyEvergreenGinEffect; + private static void ApplyEvergreenGinEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.SicknessDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.WaterDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.ElectricDebuffMultiplier -= EvergreenGin.DebuffLoss; + cplayer.HeatDebuffMultiplier -= EvergreenGin.DebuffLoss; + } public override void SetStaticDefaults() { diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 8fcea00497..c80f132c63 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Fireball : ModItem, ILocalizedModType + public class Fireball : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Fireball.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Fireball; + + public Action IVDripAlcoholEffect => ApplyFireballEffect; + + private static void ApplyFireballEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier += Fireball.DebuffBoost; + cplayer.SicknessDebuffMultiplier -= Fireball.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 231f2c2d19..d7aa12f70d 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.Alcohol; using System; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,15 +9,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class GrapeBeer : ModItem, ILocalizedModType + public class GrapeBeer : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float CloseRangeDistance = 80; public static float LongRangeDistance = 1200; public static float CloseRangeDamage = 0.75f; public static float LongRangeDamage = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage,LongRangeDistance/16f); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.GrapeBeer.DripEffect").WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public AlcoholType AlcoholVariant => AlcoholType.GrapeBeer; + public Action IVDripAlcoholEffect => ApplyGrapeBeerEffect; + + private static void ApplyGrapeBeerEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Manhattan.cs b/Items/Potions/Alcohol/Manhattan.cs index b2b338a0b3..f3612f9e03 100644 --- a/Items/Potions/Alcohol/Manhattan.cs +++ b/Items/Potions/Alcohol/Manhattan.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,14 +11,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Manhattan : ModItem, ILocalizedModType + public class Manhattan : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Manhattan.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Manhattan; + public Action IVDripAlcoholEffect => ApplyManhattanEffect; + + private static void ApplyManhattanEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ColdDebuffMultiplier += Manhattan.DebuffBoost; + cplayer.WaterDebuffMultiplier -= Manhattan.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 4df44ae8fb..36d2e06d81 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Margarita : ModItem, ILocalizedModType + public class Margarita : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,7 +18,22 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffLoss = 0.5f; public static int MinuteDuration = 3; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Margarita.DripEffect").WithFormatArgs(DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Margarita; + public Action IVDripAlcoholEffect => ApplyMargaritaEffect; + + private static void ApplyMargaritaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.TypelessDebuffMultiplier -= Margarita.DebuffLoss; + // Also see CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index fd89995259..1cb08c989b 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,13 +10,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Moonshine : ModItem, ILocalizedModType + public class Moonshine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxLifePercentBoost = 0.33f; + public static float MaxLifePercentBoost = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Moonshine.DripEffect").WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Moonshine; + public Action IVDripAlcoholEffect => ApplyMoonshineEffect; + + private static void ApplyMoonshineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerHitHurt + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 69406883aa..e841647987 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,13 +11,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class MoscowMule : ModItem, ILocalizedModType + public class MoscowMule : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float KnockbackBoost = 0.5f; + public static float PierceDamageMultiplier = 0.7f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.MoscowMule.DripEffect").WithFormatArgs(KnockbackBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.MoscowMule; + public Action IVDripAlcoholEffect => ApplyMoscowMuleEffect; + + private static void ApplyMoscowMuleEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 802234bc9d..9c77435041 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class OldFashioned : ModItem, ILocalizedModType + public class OldFashioned : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static readonly float DamageBoostMultiplier = 1.25f; public static readonly float DamageReductionMultiplier = 0.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.OldFashioned.DripEffect").WithFormatArgs(DamageBoostMultiplier.ToString("N2"), DamageReductionMultiplier.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.OldFashioned; + public Action IVDripAlcoholEffect => ApplyOldFashionedEffect; + + private static void ApplyOldFashionedEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/PurpleHaze.cs b/Items/Potions/Alcohol/PurpleHaze.cs index 4c7792e387..a1849e3e89 100644 --- a/Items/Potions/Alcohol/PurpleHaze.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -9,15 +11,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class PurpleHaze : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DamageBoost = 0.25f; public static float StealthDamageLoss = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(),StealthDamageLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.PurpleHaze.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), StealthDamageLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.PurpleHaze; + + public Action IVDripAlcoholEffect => ApplyPurpleHazeEffect; + + private static void ApplyPurpleHazeEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index f0314cc7f1..d516456873 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; @@ -9,14 +11,23 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class RedWine : ModItem, ILocalizedModType + public class RedWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float VerticalSpeedBoost = 0.1f; public static float FlightTimeLoss = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.RedWine.DripEffect").WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.RedWine; + + public Action IVDripAlcoholEffect => ApplyRedWineEffect; + + private static void ApplyRedWineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index e1b83237a8..b06697e83f 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Rum : ModItem, ILocalizedModType + public class Rum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float NonMinionBoost = 1.15f; public static float MinionBoost = 0.85f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NonMinionBoost-1).ToPercent(), (1- MinionBoost).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Rum.DripEffect").WithFormatArgs((NonMinionBoost - 1).ToPercent(), (1 - MinionBoost).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Rum; + public Action IVDripAlcoholEffect => ApplyRumEffect; + + private static void ApplyRumEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 65c071fa43..08f48048e5 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,14 +11,25 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Screwdriver : ModItem, ILocalizedModType + public class Screwdriver : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Screwdriver.DripEffect").WithFormatArgs(DebuffBoost.ToString("N2"), DebuffLoss.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.Screwdriver; + public Action IVDripAlcoholEffect => ApplyScrewdriverEffect; + + private static void ApplyScrewdriverEffect(Player player, float intensity) + { + player.blockRange += 5; + player.tileSpeed += 1; + player.wallSpeed += 1; + player.GetDamage(DamageClass.Generic) *= 0.75f; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index bbc2dc0f21..b0f4a4318f 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class StarBeamRye : ModItem, ILocalizedModType + public class StarBeamRye : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MagicDmgMult = 0.9f; public static int ManaRegenBoost = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDmgMult); + public AlcoholType AlcoholVariant => AlcoholType.StarBeamRye; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.StarBeamRye.DripEffect").WithFormatArgs(MagicDmgMult); + public Action IVDripAlcoholEffect => ApplyStarBeamRyeEffect; + + private static void ApplyStarBeamRyeEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index b9d4df742e..b60410fe92 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Tequila : ModItem, ILocalizedModType + public class Tequila : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,7 +18,17 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Tequila.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Tequila; + public Action IVDripAlcoholEffect => ApplyTequilaEffect; + + private static void ApplyTequilaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ElectricDebuffMultiplier += Tequila.DebuffBoost; + cplayer.ColdDebuffMultiplier -= Tequila.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 2e04f06f82..072e2739b0 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,13 +11,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class TequilaSunrise : ModItem, ILocalizedModType + public class TequilaSunrise : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DoTMultiplier = 1.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DoTMultiplier-1).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.TequilaSunrise.DripEffect").WithFormatArgs((DoTMultiplier-1).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.TequilaSunrise; + public Action IVDripAlcoholEffect => ApplyTequilaSunriseEffect; + + private static void ApplyTequilaSunriseEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ca404e6e3c..d1be7fd4f0 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -9,14 +11,28 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Vodka : ModItem, ILocalizedModType + public class Vodka : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.25f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Vodka.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Vodka; + public Action IVDripAlcoholEffect => ApplyVodkaEffect; + + private static void ApplyVodkaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.TypelessDebuffMultiplier += Vodka.DebuffBoost; + cplayer.HeatDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Vodka.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 8affbb3282..04ec8d970e 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,16 +10,27 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Whiskey : ModItem, ILocalizedModType + public class Whiskey : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxDamageBoost = 0.15f; - public static float MinDamageBoost = -0.15f; + public static float StandardDamageCeiling = 0.15f; + public static float StandardDamageFloor = -0.15f; public static float TimeToDischarge = 600; public static float TimeToRecharge = 300; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinDamageBoost.ToPercent(), MaxDamageBoost.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public static float CombinedDamageCeiling = 0.3f; + public static float CombinedDamageFloor = -0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Whiskey.DripEffect").WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge / 60).ToString("0.##"), (TimeToRecharge / 60).ToString("0.##"), CombinedDamageFloor.ToPercent(), CombinedDamageCeiling.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Whiskey; + + public Action IVDripAlcoholEffect => ApplyWhiskeyEffect; + + private static void ApplyWhiskeyEffect(Player player, float intensity) + { + // See CalamityPlayer + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 32890d06ad..ff03363812 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; @@ -10,14 +12,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class WhiteWine : ModItem, ILocalizedModType + public class WhiteWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float FlightTimeRecoveryAmount = 0.66f; public static float FlightTimeLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.WhiteWine.DripEffect").WithFormatArgs(FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.WhiteWine; + public Action IVDripAlcoholEffect => ApplyWhiteWineEffect; + + private static void ApplyWhiteWineEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 492d117468..180ccaa750 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1032,12 +1032,18 @@ IVDripOnTheRocks: { DisplayName: IV Drip on the Rocks Tooltip: ''' - Multiplies most non-weapon, non-debuff damage by {0}x - Multiplies all weapon damage by {1}x + [EFFECT] + [NAME] Counts as an alcohol stack toward Alcohol Poisoning + Drinking the same type of alcohol as in the IV drip does not contribute to Alcohol Poisoning {$Common.AlcoholWarning} + [c/aaaaaa:Shift- this item in your inventory to empty its contents] [ceffect/drunk:'(drunken mumbling)'] + ''' + Empty: The IV drip is currently empty. + CurrentAlcoholText: Filled with + SakeAndAleText: Increases melee weapon scale by 15%, but decreases melee speed by 10% } JellyChargedBattery: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 92307cae67..dfc50640f6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -191,6 +191,12 @@ BloodyMary: { Greatly reduces piercing weapon effectiveness {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases enemy spawn rates by 7x + Greatly reduces piercing weapon effectiveness + When combined with drinking Bloody Mary straight, enemy spawn rates are increased by 10x total + ''' } CaribbeanRum: { @@ -201,6 +207,11 @@ CaribbeanRum: { Reduces your gravity by {1}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases move speed by {0}% + Reduces your gravity by {1}% + ''' } CinnamonRoll: { @@ -211,14 +222,10 @@ CinnamonRoll: { Greatly reduces dash distance {$Common.AlcoholWarning} ''' -} - -PurpleHaze: { - DisplayName: Purple Haze - Tooltip: + DripEffect: ''' - For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% - {$Common.AlcoholWarning} + Greatly increases dash speed + Greatly reduces dash distance ''' } @@ -231,6 +238,12 @@ Everclear: { Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased damage + Reduces life regen by {1} HP/s and defense by {2}% + Counts as giving an additional stack of alcohol for {$Buffs.AlcoholPoisoning.DisplayName} + ''' } EvergreenGin: { @@ -241,6 +254,11 @@ EvergreenGin: { {1}% decreased Electric and Heat debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Water and Sickness debuff damage + {1}% decreased Electric and Heat debuff damage + ''' } Fireball: { @@ -251,6 +269,11 @@ Fireball: { {1}% decreased Sickness debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Heat debuff damage + {1}% decreased Sickness debuff damage + ''' } GrapeBeer: { @@ -262,6 +285,13 @@ GrapeBeer: { This reaches a minimum of {0}x damage at {1} tiles away {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Bullets, Arrows, Darts, and Rockets gain homing + Projectiles deal less damage the further the enemy is + This reaches a minimum of {0}x damage at {1} tiles away + When combined with drinking Grape Beer straight, homing range is increased + ''' } Manhattan: { @@ -272,6 +302,11 @@ Manhattan: { {1}% decreased Water debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Cold debuff damage + {1}% decreased Water debuff damage + ''' } Margarita: { @@ -282,6 +317,11 @@ Margarita: { Reduces damage of debuffs you inflict by {0}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Halves duration of harmful debuffs you receive + Reduces damage of debuffs you inflict by {0}% + ''' } Moonshine: { @@ -293,6 +333,12 @@ Moonshine: { Defense damage takes three times as long to recover {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases maximum health by {0}% + Attacks always take at least half your defense worth of defense damage + Defense damage takes three times as long to recover + ''' } MoscowMule: { @@ -303,6 +349,11 @@ MoscowMule: { Reduces the effectiveness of piercing weapons {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased knockback, all attacks inflict heavy knockback + Reduces the effectiveness of piercing weapons + ''' } OddMushroom: { @@ -323,6 +374,21 @@ OldFashioned: { Multiplies all weapon damage by {1}x {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Multiplies most non-weapon, non-debuff damage by {0}x + Multiplies all weapon damage by {1}x + ''' +} + +PurpleHaze: { + DisplayName: Purple Haze + Tooltip: + ''' + For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% + {$Common.AlcoholWarning} + ''' + DripEffect: For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% } RedWine: { @@ -333,6 +399,11 @@ RedWine: { {1}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased vertical speed + {1}% reduced flight time + ''' } Rum: { @@ -343,6 +414,11 @@ Rum: { {1}% decreased minion damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased non-minion summon damage + {1}% decreased minion damage + ''' } Screwdriver: { @@ -353,6 +429,11 @@ Screwdriver: { Greatly reduces damage dealt {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases tile and wall placement range and speed + Greatly reduces damage dealt + ''' } StarBeamRye: { @@ -363,6 +444,11 @@ StarBeamRye: { Magic weapons deal {0}x damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases Mana regeneration, even while using an item + Magic weapons deal {0}x damage + ''' } Tequila: { @@ -373,6 +459,11 @@ Tequila: { {1}% decreased Cold debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Electric debuff damage + {1}% decreased Cold debuff damage + ''' } TequilaSunrise: { @@ -383,6 +474,11 @@ TequilaSunrise: { {0}% increased damage taken from debuffs {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases natural life regeneration after suffering a damaging debuff + {0}% increased damage taken from debuffs + ''' } Vodka: { @@ -393,6 +489,11 @@ Vodka: { {1}% decreased elemental debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Typeless debuff damage + {1}% decreased elemental debuff damage + ''' } Whiskey: { @@ -405,6 +506,14 @@ Whiskey: { This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Provides between {0}% and {1}% damage to the held weapon's class + Each class tracks this boost individually + This boost lowers the longer you hold weapons of the same class, taking {2} seconds to fully decay + This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge + When combined with drinking Whiskey straight, damage varies between {4}% and {5}% + ''' } WhiteWine: { @@ -415,6 +524,11 @@ WhiteWine: { {0}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + You regain flight time the closer you are to an enemy + {0}% reduced flight time + ''' } // Food diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1a2455e35b..4f844c31c3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -15,6 +15,7 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.PlagueReaper; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.Abyss; @@ -4242,10 +4243,16 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 0.25); // 4x spawn rate maxSpawns = (int)(maxSpawns * 4f); } - if (player.Calamity().bloodyMary) + if (player.Calamity().bloodyMary || player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) { - spawnRate = (int)(spawnRate * 0.142); // ~7x spawn rate - maxSpawns = (int)(maxSpawns * 5f); // Only 5x the cap, however + spawnRate = (int)(spawnRate * BloodyMary.SpawnRateGateMultiplier); // ~7x spawn rate + maxSpawns = (int)(maxSpawns * BloodyMary.SpawnLimitMultiplier); // 5x spawn rate cap + } + // Only when BOTH effects are active, also applies the previous spawn rate and limit boosts multiplicatively + if (player.Calamity().bloodyMary && player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) + { + spawnRate = (int)(spawnRate * BloodyMary.IVDripAdditionalSpawnRateGateMultiplier); // 1.429x spawn rate, total of 10x + maxSpawns = (int)(maxSpawns * BloodyMary.IVDripAdditionalSpawnLimitMultiplier); // 1.5x spawn rate cap } // Reductions diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index f69127303d..8ff05eff35 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -340,7 +340,8 @@ namespace CalamityMod.Projectiles void ApplyGrapeBeer() { grapeBeer = true; - conditionalHomingRange = 300; + var ivDripPlayer = Main.player[projectile.owner].GetModPlayer(); + conditionalHomingRange = ivDripPlayer.HasAlcohol(AlcoholType.GrapeBeer) ? 800 : 300; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; //Calamity adds a hybrid iframe system when both local and static are set to true, so this works fine for both global and static projectiles. @@ -4326,10 +4327,10 @@ namespace CalamityMod.Projectiles grapeBeerHomingPower = 0.015f; } - HomingTarget = grapeBeerHomingTarget = target.whoAmI; + HomingTarget = grapeBeerHomingTarget = target.whoAmI; Vector2 targetDirection = projectile.SafeDirectionTo(target.Center); - float trackingSpeed = grapeBeerHomingPower;// Vector2.Dot(targetDirection, projectile.velocity.SafeNormalize(Vector2.UnitX)) > 0.835f ? 0.01325f : 0f; // Delicate values, please test changes you make to them + float trackingSpeed = grapeBeerHomingPower; var currVelocity = projectile.velocity.Length(); if (currVelocity < 8) @@ -4623,28 +4624,29 @@ namespace CalamityMod.Projectiles } // Old Fashioned buffs (or debuffs) apply if the player has Old Fashioned - // IV Drip on the Rocks inherits the same logic as Old Fashioned if (modPlayer.oldFashioned && buffedByOldFashioned.HasValue) modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; - if (modPlayer.ivDrip && buffedByOldFashioned.HasValue) - modifiers.SourceDamage *= buffedByOldFashioned.Value ? IVDripOnTheRocks.DamageBoostMultiplier : IVDripOnTheRocks.DamageReductionMultiplier; - if (modPlayer.rum && projectile.DamageType.CountsAsClass(DamageClass.Summon)) + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) && buffedByOldFashioned.HasValue) + modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; + + if ((modPlayer.rum || dripPlayer.HasAlcohol(AlcoholType.Rum)) && projectile.DamageType.CountsAsClass(DamageClass.Summon)) { if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type]) - { - modifiers.SourceDamage *= Rum.MinionBoost; - } + modifiers.SourceDamage *= (modPlayer.rum ? Rum.MinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.MinionBoost : 1f); else - modifiers.SourceDamage *= Rum.NonMinionBoost; + modifiers.SourceDamage *= (modPlayer.rum ? Rum.NonMinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.NonMinionBoost : 1f); } - if (modPlayer.moscowMule || modPlayer.bloodyMary) + + if (modPlayer.moscowMule || modPlayer.bloodyMary || dripPlayer.HasAlcohol(AlcoholType.MoscowMule) || dripPlayer.HasAlcohol(AlcoholType.BloodyMary)) { if (projectile.DamageType == DamageClass.Summon || (PierceResistNPC.exemptProjectiles.Contains(projectile.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(projectile.type) && PierceResistNPC.singleHitboxExemptProjectiles[projectile.type]))) { - modifiers.SourceDamage *= ((modPlayer.moscowMule ? 0.7f : 1f) * (modPlayer.bloodyMary ? 0.33f : 1f)); + modifiers.SourceDamage *= ((modPlayer.moscowMule ? MoscowMule.PierceDamageMultiplier : 1f) * (modPlayer.bloodyMary ? BloodyMary.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? MoscowMule.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? BloodyMary.PierceDamageMultiplier : 1f)); } } + if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula @@ -4798,7 +4800,8 @@ namespace CalamityMod.Projectiles { var player = Main.player[projectile.owner]; float burnRatio = (-player.statMana / 100) * ChaosStone.DamageMultPer100Mana; - target.Calamity().manaBurn += damageDone * burnRatio * (player.Calamity().oldFashioned ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().ivDrip ? IVDripOnTheRocks.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1+Vodka.DebuffBoost : 1); + var dripPlayer = player.GetModPlayer(); + target.Calamity().manaBurn += damageDone * burnRatio * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1+Vodka.DebuffBoost : 1); target.Calamity().playerManaBurnIntensity = -player.statMana / (float)player.statManaMax2; if (Main.netMode != NetmodeID.SinglePlayer) ManaBurnSyncPacket.Send(target); diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index ebdca2b3c4..2ab3093f87 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -149,7 +149,8 @@ namespace CalamityMod baseScale += (player.HeldItem.scale - 1); if (player.HasBuff(BuffID.Tipsy)) baseScale += 0.15f; - + if (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake)) + baseScale += 0.15f; return baseScale; }