Fixes and Bacon Oil Support
- Adds support for copying Bacon Oil - Tweaked IV Drip's tooltip - Fixed alcohol poisoning count not incrementing - Made IV Drip increase alcohol poisoning stacks equal to the alcohol level of the inserted type - Edited Everclear's IV Drip variant text - Fixed IV Drip drawing incorrectly in the inventory and overworld
This commit is contained in:
1 parent
37d02b4bf1
commit
848df2990a
8 files changed
+134
-25
No files matched your search
@@ -5326,16 +5326,18 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (Player.Calamity().baconOil && !Player.mount.Active)
|
||||
if ((Player.Calamity().baconOil || Player.GetModPlayer<IVDripPlayer>().HasAlcohol(AlcoholType.BaconOil)) && !Player.mount.Active)
|
||||
{
|
||||
Player.noFallDmg = true;
|
||||
|
||||
|
||||
float stackScale = (Player.Calamity().baconOil && Player.GetModPlayer<IVDripPlayer>().HasAlcohol(AlcoholType.BaconOil)) ? 1.33f : 1;
|
||||
|
||||
float velX = Math.Abs(Player.velocity.X);
|
||||
float velY = Math.Abs(Player.velocity.Y);
|
||||
|
||||
float speedMult = Player.GetBestClassDamage().ApplyTo(1);
|
||||
float maxMoveSpeed = 10.5f * speedMult;
|
||||
float minMoveSpeed = 3; // Minimum move speed to be at if the player can bounce
|
||||
float maxMoveSpeed = 10.5f * speedMult * stackScale;
|
||||
float minMoveSpeed = 3 * stackScale; // Minimum move speed to be at if the player can bounce
|
||||
float hitboxSizeMult = 0.45f;
|
||||
|
||||
bool onPlatform = false;
|
||||
@@ -5354,9 +5356,9 @@ namespace CalamityMod.CalPlayer
|
||||
bool hitDown = velY > minMoveSpeed && (Collision.SolidCollision(Player.Bottom + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1) || onPlatform);
|
||||
bool hitUp = velY > minMoveSpeed && Collision.SolidCollision(Player.Top + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1);
|
||||
bool hitSide = velX > minMoveSpeed && Collision.SolidCollision(Vector2.Lerp(Player.TopLeft, Player.Left, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Player.TopRight, Player.Right, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult));
|
||||
float acceleration = 0.05f;
|
||||
float acceleration = 0.05f * stackScale;
|
||||
float decceleration = -0.025f / speedMult;
|
||||
float riseSpeed = 0.8f; // The speed the player rises when in water or rain
|
||||
float riseSpeed = 0.8f * stackScale; // The speed the player rises when in water or rain
|
||||
float slipPower = 0.85f; //How strong the slippery effect is
|
||||
|
||||
float bounceReduction = 0.9f;
|
||||
@@ -5384,7 +5386,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (baconOilSoundCooldown < soundCDMax)
|
||||
baconOilSoundCooldown += 30;
|
||||
float pitch = 0.55f * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true);
|
||||
float pitch = (0.55f * stackScale) * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true);
|
||||
SoundStyle boyoyoing = new("CalamityMod/Sounds/Item/BaconOilBounce");
|
||||
SoundEngine.PlaySound(boyoyoing with { Volume = 0.45f, Pitch = hitSide ? pitch - 0.3f : pitch, MaxInstances = 5 }, Player.Center);
|
||||
}
|
||||
|
||||
@@ -190,14 +190,30 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion
|
||||
|
||||
#region Alcohol
|
||||
var dripPlayer = Player.GetModPlayer<IVDripPlayer>();
|
||||
|
||||
for (int l = 0; l < Player.MaxBuffs; l++)
|
||||
{
|
||||
int buff = Player.buffType[l];
|
||||
if (BuffDatasets.DebuffDataset[buff] is not null && BuffDatasets.DebuffDataset[buff].AlcoholLevel > 0)
|
||||
alcoholPoisonLevel += BuffDatasets.DebuffDataset[buff].AlcoholLevel + (Player.GetModPlayer<IVDripPlayer>().HasAlcohol(AlcoholType.Everclear) ? 1 : 0);
|
||||
if (buff <= 0) continue;
|
||||
|
||||
var data = BuffDatasets.DebuffDataset[buff];
|
||||
if (data?.AlcoholLevel > 0)
|
||||
alcoholPoisonLevel += data.AlcoholLevel;
|
||||
}
|
||||
if (Player.Calamity().ivDrip) // +1 stack of poisoning while IV Drip is equipped
|
||||
alcoholPoisonLevel++;
|
||||
|
||||
if (dripPlayer.ivDripEquipped && dripPlayer.currentAlcohol != AlcoholType.None)
|
||||
{
|
||||
int ivBuffID = BuffDatasets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol);
|
||||
|
||||
if (ivBuffID != -1)
|
||||
{
|
||||
var ivData = BuffDatasets.DebuffDataset[ivBuffID];
|
||||
if (ivData?.AlcoholLevel > 0)
|
||||
alcoholPoisonLevel += ivData.AlcoholLevel;
|
||||
}
|
||||
}
|
||||
|
||||
if (everclear)
|
||||
totalNegativeLifeRegen += Everclear.RegenLoss;
|
||||
if (Player.GetModPlayer<IVDripPlayer>().HasAlcohol(AlcoholType.Everclear))
|
||||
@@ -347,7 +363,6 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
}
|
||||
|
||||
var dripPlayer = Player.GetModPlayer<IVDripPlayer>();
|
||||
if (dripPlayer.HasAlcohol(AlcoholType.TequilaSunrise))
|
||||
{
|
||||
if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.Alcohol;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -10,6 +12,7 @@ namespace CalamityMod.DataStructures
|
||||
[ReinitializeDuringResizeArrays]
|
||||
public static class BuffDatasets
|
||||
{
|
||||
private static DebuffData Alch(int level) => new DebuffData() { AlcoholLevel = level };
|
||||
public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData")
|
||||
.Description("Stores DebuffData for a particular debuff")
|
||||
.RegisterCustomSet<DebuffData>(null,
|
||||
@@ -24,8 +27,69 @@ namespace CalamityMod.DataStructures
|
||||
BuffID.Poisoned, DebuffData.Poisoned,
|
||||
BuffID.Venom, DebuffData.AcidVenom,
|
||||
BuffID.Electrified, DebuffData.Electrified,
|
||||
BuffID.Oiled, DebuffData.Oiled
|
||||
BuffID.Oiled, DebuffData.Oiled,
|
||||
|
||||
BuffID.Tipsy, Alch(1),
|
||||
ModContent.BuffType<BloodyMaryBuff>(), Alch(1),
|
||||
ModContent.BuffType<CaribbeanRumBuff>(), Alch(1),
|
||||
ModContent.BuffType<CinnamonRollBuff>(), Alch(1),
|
||||
ModContent.BuffType<EvergreenGinBuff>(), Alch(1),
|
||||
ModContent.BuffType<FireballBuff>(), Alch(1),
|
||||
ModContent.BuffType<GrapeBeerBuff>(), Alch(1),
|
||||
ModContent.BuffType<ManhattanBuff>(), Alch(1),
|
||||
ModContent.BuffType<MargaritaBuff>(), Alch(1),
|
||||
ModContent.BuffType<MoonshineBuff>(), Alch(1),
|
||||
ModContent.BuffType<MoscowMuleBuff>(), Alch(1),
|
||||
ModContent.BuffType<OldFashionedBuff>(), Alch(1),
|
||||
ModContent.BuffType<PurpleHazeBuff>(), Alch(1),
|
||||
ModContent.BuffType<RedWineBuff>(), Alch(1),
|
||||
ModContent.BuffType<RumBuff>(), Alch(1),
|
||||
ModContent.BuffType<ScrewdriverBuff>(), Alch(1),
|
||||
ModContent.BuffType<StarBeamRyeBuff>(), Alch(1),
|
||||
ModContent.BuffType<TequilaBuff>(), Alch(1),
|
||||
ModContent.BuffType<TequilaSunriseBuff>(), Alch(1),
|
||||
ModContent.BuffType<VodkaBuff>(), Alch(1),
|
||||
ModContent.BuffType<WhiskeyBuff>(), Alch(1),
|
||||
ModContent.BuffType<WhiteWineBuff>(), Alch(1),
|
||||
|
||||
ModContent.BuffType<EverclearBuff>(), Alch(2),
|
||||
ModContent.BuffType<BaconOilBuff>(), Alch(3)
|
||||
);
|
||||
public static int GetBuffIDFromAlcoholType(AlcoholType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
AlcoholType.BaconOil => ModContent.BuffType<BaconOilBuff>(),
|
||||
AlcoholType.BloodyMary => ModContent.BuffType<BloodyMaryBuff>(),
|
||||
AlcoholType.CaribbeanRum => ModContent.BuffType<CaribbeanRumBuff>(),
|
||||
AlcoholType.CinnamonRoll => ModContent.BuffType<CinnamonRollBuff>(),
|
||||
AlcoholType.Everclear => ModContent.BuffType<EverclearBuff>(),
|
||||
AlcoholType.EvergreenGin => ModContent.BuffType<EvergreenGinBuff>(),
|
||||
AlcoholType.Fireball => ModContent.BuffType<FireballBuff>(),
|
||||
AlcoholType.GrapeBeer => ModContent.BuffType<GrapeBeerBuff>(),
|
||||
AlcoholType.Manhattan => ModContent.BuffType<ManhattanBuff>(),
|
||||
AlcoholType.Margarita => ModContent.BuffType<MargaritaBuff>(),
|
||||
AlcoholType.Moonshine => ModContent.BuffType<MoonshineBuff>(),
|
||||
AlcoholType.MoscowMule => ModContent.BuffType<MoscowMuleBuff>(),
|
||||
AlcoholType.OldFashioned => ModContent.BuffType<OldFashionedBuff>(),
|
||||
AlcoholType.PurpleHaze => ModContent.BuffType<PurpleHazeBuff>(),
|
||||
AlcoholType.RedWine => ModContent.BuffType<RedWineBuff>(),
|
||||
AlcoholType.Rum => ModContent.BuffType<RumBuff>(),
|
||||
AlcoholType.Screwdriver => ModContent.BuffType<ScrewdriverBuff>(),
|
||||
AlcoholType.StarBeamRye => ModContent.BuffType<StarBeamRyeBuff>(),
|
||||
AlcoholType.Tequila => ModContent.BuffType<TequilaBuff>(),
|
||||
AlcoholType.TequilaSunrise => ModContent.BuffType<TequilaSunriseBuff>(),
|
||||
AlcoholType.Vodka => ModContent.BuffType<VodkaBuff>(),
|
||||
AlcoholType.Whiskey => ModContent.BuffType<WhiskeyBuff>(),
|
||||
AlcoholType.WhiteWine => ModContent.BuffType<WhiteWineBuff>(),
|
||||
|
||||
// Vanilla treats both Ale and Sake as the "Tipsy" buff
|
||||
AlcoholType.Ale => BuffID.Tipsy,
|
||||
AlcoholType.Sake => BuffID.Tipsy,
|
||||
|
||||
_ => -1
|
||||
};
|
||||
}
|
||||
}
|
||||
public class DebuffData
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public enum AlcoholType
|
||||
{
|
||||
None,
|
||||
BaconOil,
|
||||
BloodyMary,
|
||||
CaribbeanRum,
|
||||
CinnamonRoll,
|
||||
@@ -39,7 +40,7 @@ namespace CalamityMod.Items.Accessories
|
||||
Whiskey,
|
||||
WhiteWine,
|
||||
Ale,
|
||||
Sake
|
||||
Sake,
|
||||
}
|
||||
|
||||
public interface IAlcoholItem
|
||||
@@ -57,14 +58,14 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.RegisterItemAnimation(Item.type, new Terraria.DataStructures.DrawAnimationVertical(1, 25));
|
||||
Main.RegisterItemAnimation(Item.type, new Terraria.DataStructures.DrawAnimationVertical(1, 26));
|
||||
ItemID.Sets.AnimatesAsSoul[Item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 58;
|
||||
Item.height = 62;
|
||||
Item.height = 60;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.accessory = true;
|
||||
@@ -189,7 +190,6 @@ namespace CalamityMod.Items.Accessories
|
||||
if (effectLine != null)
|
||||
{
|
||||
effectLine.Text = this.GetLocalizedValue("Empty");
|
||||
effectLine.OverrideColor = Color.Gray;
|
||||
}
|
||||
nameLine?.Hide();
|
||||
return;
|
||||
@@ -220,7 +220,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
Texture2D texture = TextureAssets.Item[Item.type].Value;
|
||||
|
||||
int frameHeight = texture.Height / 25;
|
||||
int frameHeight = texture.Height / 26;
|
||||
int frameIndex = (int)currentAlcoholType;
|
||||
|
||||
Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight);
|
||||
@@ -228,6 +228,21 @@ namespace CalamityMod.Items.Accessories
|
||||
spriteBatch.Draw(texture, position, targetFrame, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Item[Item.type].Value;
|
||||
|
||||
int frameHeight = texture.Height / 26;
|
||||
int frameIndex = (int)currentAlcoholType;
|
||||
|
||||
Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight);
|
||||
|
||||
Vector2 drawPosition = Item.position - Main.screenPosition + new Vector2(Item.width / 2, Item.height - frameHeight / 2);
|
||||
Vector2 origin = targetFrame.Size() / 2f;
|
||||
|
||||
spriteBatch.Draw(texture, drawPosition, targetFrame, lightColor, rotation, origin, scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class IVDripPlayer : ModPlayer
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.Alcohol;
|
||||
using CalamityMod.Items.Materials;
|
||||
using System;
|
||||
using CalamityMod.Buffs.Alcohol;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -8,9 +9,17 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Potions.Alcohol
|
||||
{
|
||||
public class BaconOil : ModItem, ILocalizedModType
|
||||
public class BaconOil : ModItem, ILocalizedModType, IAlcoholItem
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Potions";
|
||||
public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BaconOil.DripEffect");
|
||||
public AlcoholType AlcoholVariant => AlcoholType.BaconOil;
|
||||
public Action<Player, float> IVDripAlcoholEffect => ApplyBaconOilEffect;
|
||||
|
||||
private static void ApplyBaconOilEffect(Player player, float intensity)
|
||||
{
|
||||
// See CalamityPlayer
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
|
||||
@@ -1034,12 +1034,10 @@ IVDripOnTheRocks: {
|
||||
'''
|
||||
[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
|
||||
Inserted alcohols contribute toward alcohol poisoning
|
||||
{$Common.AlcoholWarning}
|
||||
[c/aaaaaa:Shift-<right> this item in your inventory to empty its contents]
|
||||
[ceffect/drunk:'(drunken mumbling)']
|
||||
|
||||
'''
|
||||
Empty: Place an alcoholic beverage on this item in your inventory to pour its contents in
|
||||
CurrentAlcoholText: Filled with
|
||||
|
||||
@@ -181,6 +181,12 @@ BaconOil: {
|
||||
Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName}
|
||||
{$Common.AlcoholWarning}
|
||||
'''
|
||||
DripEffect:
|
||||
'''
|
||||
Provides "good" mobility that scales with your damage stat boosts
|
||||
Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName}
|
||||
When combined with drinking Bacon Oil straight, mobility becomes zanier
|
||||
'''
|
||||
}
|
||||
|
||||
BloodyMary: {
|
||||
@@ -242,7 +248,7 @@ Everclear: {
|
||||
'''
|
||||
{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}
|
||||
Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user