Bacon Oil

This commit is contained in:
Xyk committed 2026-03-15 01:04:54 -07:00
1 parent 87fdf1b850
commit f0b867dcd7
10 files changed
+171 -8

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class BaconOilBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 3
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
Main.persistentBuff[Type] = true;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
BuffDatasets.DebuffDataset[Type] = debuffData;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().baconOil = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+91 -3
View File
@@ -1473,6 +1473,8 @@ namespace CalamityMod.CalPlayer
public bool whiteWine = false;
public float whiteWineTimer = 0;
public bool evergreenGin = false;
public bool baconOil = false;
public int baconOilSoundCooldown = 0;
public bool tranquilityCandle = false;
public bool chaosCandle = false;
public bool blueCandle = false;
@@ -2766,6 +2768,7 @@ namespace CalamityMod.CalPlayer
moscowMule = false;
whiteWine = false;
evergreenGin = false;
baconOil = false;
tranquilityCandle = false;
chaosCandle = false;
@@ -3280,6 +3283,7 @@ namespace CalamityMod.CalPlayer
moscowMule = false;
whiteWine = false;
evergreenGin = false;
baconOil = false;
tranquilityCandle = false;
chaosCandle = false;
blueCandle = false;
@@ -4843,9 +4847,9 @@ namespace CalamityMod.CalPlayer
// Gives inverted buffs from well fed
Player.statDefense -= 2;
Player.GetCritChance<GenericDamageClass>() -= 2;
Player.GetDamage<GenericDamageClass>() -= 0.05f;
Player.minionKB -= 0.5f;
// Move speed reduction/boost happens in PostUpdate
Player.moveSpeed -= 0.05f;
// damage nerf/boost happens in PostUpdate
Player.pickSpeed += 0.05f;
@@ -5119,7 +5123,7 @@ namespace CalamityMod.CalPlayer
}
if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now
Player.moveSpeed += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel;
Player.GetDamage<GenericDamageClass>() += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel;
// Relic of Convergence defense cut
if (Player.ownedProjectileCounts[ModContent.ProjectileType<RelicOfConvergenceCrystal>()] > 0 && Player.HeldItem.type == ModContent.ItemType<RelicOfConvergence>())
@@ -5252,6 +5256,90 @@ namespace CalamityMod.CalPlayer
}
#endregion
if (Player.Calamity().baconOil && !Player.mount.Active)
{
Player.noFallDmg = true;
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 hitboxSizeMult = 0.45f;
bool onPlatform = false;
if (Player.velocity.Y > 0 && !Player.controlDown)
{
for (int i = 4; i < 8; i++)
{
Point bottom = (Player.Bottom + Vector2.UnitY * i).ToTileCoordinates();
if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType])
{
onPlatform = true;
}
}
}
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 decceleration = -0.025f / speedMult;
float riseSpeed = 0.8f; // The speed the player rises when in water or rain
float slipPower = 0.85f; //How strong the slippery effect is
float bounceReduction = 0.9f;
bool makeSound = false;
if (hitSide)
{
Player.velocity.X = -Player.velocity.X * bounceReduction;
Player.oldVelocity.X = -Player.oldVelocity.X * bounceReduction;
makeSound = true;
}
if ((hitDown || hitUp))
{
if (Player.controlUp)
bounceReduction = 1.3f;
Player.velocity.Y = -Player.velocity.Y * bounceReduction;
Player.oldVelocity.Y = -Player.oldVelocity.Y * bounceReduction;
if (hitDown)
{
Player.RefreshMovementAbilities(true);
}
makeSound = true;
}
int soundCDMax = 150;
if (makeSound && baconOilSoundCooldown < soundCDMax)
{
if (baconOilSoundCooldown < soundCDMax)
baconOilSoundCooldown += 30;
float pitch = 0.55f * 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);
}
bool playerMoving = Player.controlLeft || Player.controlRight;
bool playerMovingInDirection = (Player.controlLeft && Player.oldVelocity.X < 0) || (Player.controlRight && Player.oldVelocity.X > 0);
if (((Player.oldVelocity.X > 0 && Player.velocity.X > 0) || (Player.oldVelocity.X < 0 && Player.velocity.X < 0)))
Player.velocity.X = MathHelper.Clamp(Player.velocity.X + maxMoveSpeed * MathF.Sign(Player.oldVelocity.X) *
((playerMovingInDirection || !playerMoving) ? Player.dashDelay == -1 ? decceleration : // If dashing, deccelerate to prevent infinite dash
// If not moving or holding in move direction, accelerate to max speed, otherwise deccelerate
acceleration : decceleration), -maxMoveSpeed, maxMoveSpeed);
bool raining = Player.Center.Y < Main.worldSurface * 16.0 && Main.raining;
if ((Player.wet || raining) && Player.velocity.Y > -maxMoveSpeed)
{
Player.velocity.Y -= riseSpeed; // Cover yourself in oil (go up in liquid)
}
Vector2 lerpedVel = Vector2.Lerp(Player.velocity, Player.oldVelocity, slipPower);
Player.velocity = new Vector2(lerpedVel.X, Player.velocity.Y);
}
if (baconOilSoundCooldown > 0)
baconOilSoundCooldown = (int)MathHelper.Lerp(baconOilSoundCooldown, 0, 0.027f);
Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it
}
#endregion
-2
View File
@@ -12,9 +12,7 @@ using CalamityMod.Items.Armor.Silva;
using CalamityMod.Items.Armor.Tarragon;
using CalamityMod.Items.Fishing.BrimstoneCragCatches;
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.Potions.Food;
using CalamityMod.NPCs;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Systems;
+32
View File
@@ -0,0 +1,32 @@
using CalamityMod.Buffs.Alcohol;
using CalamityMod.Items.Materials;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions.Alcohol
{
public class BaconOil : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Potions";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 20;
ItemID.Sets.DrinkParticleColors[Type] = new Color[3] {
new Color(204, 90, 73),
new Color(168, 37, 37),
new Color(120, 28, 28)
};
}
public override void SetDefaults()
{
Item.DefaultToFood(20, 32, ModContent.BuffType<BaconOilBuff>(), CalamityUtils.MinutesToFrames(6), true);
Item.value = Item.sellPrice(silver: 2);
Item.rare = ItemRarityID.Blue;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@@ -8,6 +8,11 @@ AlcoholPoisoning: {
Description: You drank too much and you are now dying
}
BaconOilBuff: {
DisplayName: Bacon Oil
Description: Oh gosh you spilled it all over yourself!
}
BloodyMaryBuff: {
DisplayName: Bloody Mary
Description: Increased enemy spawn rates, reduced piercing weapon effectiveness
@@ -166,6 +166,16 @@ ZergPotion: {
Tooltip: Vastly increases enemy spawn rate
}
BaconOil: {
DisplayName: Bacon Oil
Tooltip:
'''
Provides "good" mobility that scales with your damage stat boosts
Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName}
{$Common.AlcoholWarning}
'''
}
BloodyMary: {
DisplayName: Bloody Mary
Tooltip:
@@ -453,7 +463,7 @@ TheSandwich: {
'''
A sandwich made of the finest bread, cheese, and fish in the land!
Minor reductions to all stats
{0}% movespeed for every alcohol you are effected by
{0}% increased damage for every alcohol you are effected by
Allows you to drink 2 more alcohols than normal
Alcohol effects don't deteriorate while under the effects of The Sandwich
'Might actually taste good if it was the only thing you'd ever eaten...'
Binary file not shown.
+3 -2
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Systems.Collections
BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, BuffType<AnechoicCoatingBuff>(), BuffType<AstralInjectionBuff>(), BuffType<BaguetteBuff>(), BuffType<BloodfinBoost>(),
BuffType<BoundingBuff>(), BuffType<CalciumBuff>(), BuffType<CeaselessHunger>(), BuffType<GravityNormalizerBuff>(), BuffType<Omniscience>(), BuffType<PhotosynthesisBuff>(),
BuffType<ShadowBuff>(), BuffType<Soaring>(), BuffType<SulphurskinBuff>(), BuffType<WeaponImbueBrimstone>(), BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(),
BuffType<Zen>(), BuffType<Zerg>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(), BuffType<EvergreenGinBuff>(),
BuffType<Zen>(), BuffType<Zerg>(), BuffType<BaconOilBuff>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(), BuffType<EvergreenGinBuff>(),
BuffType<PurpleHazeBuff>(), BuffType<FireballBuff>(), BuffType<GrapeBeerBuff>(), BuffType<MargaritaBuff>(), BuffType<MoonshineBuff>(), BuffType<MoscowMuleBuff>(),
BuffType<RedWineBuff>(), BuffType<RumBuff>(), BuffType<ScrewdriverBuff>(), BuffType<StarBeamRyeBuff>(), BuffType<TequilaBuff>(), BuffType<TequilaSunriseBuff>(),
BuffType<Trippy>(), BuffType<VodkaBuff>(), BuffType<WhiskeyBuff>(), BuffType<WhiteWineBuff>());
@@ -47,7 +47,7 @@ namespace CalamityMod.Systems.Collections
/// </summary>
public static bool[] IsPersistentBuff = Factory.CreateBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold,
BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType<WeaponImbueBrimstone>(),
BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(),
BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(), BuffType<BaconOilBuff>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(),
BuffType<EvergreenGinBuff>(), BuffType<FireballBuff>(), BuffType<GrapeBeerBuff>(), BuffType<ManhattanBuff>(), BuffType<MargaritaBuff>(), BuffType<MoonshineBuff>(),
BuffType<MoscowMuleBuff>(), BuffType<OldFashionedBuff>(), BuffType<PurpleHazeBuff>(), BuffType<RedWineBuff>(), BuffType<RumBuff>(), BuffType<ScrewdriverBuff>(),
BuffType<StarBeamRyeBuff>(), BuffType<TequilaBuff>(), BuffType<TequilaSunriseBuff>(), BuffType<VodkaBuff>(), BuffType<WhiskeyBuff>(), BuffType<WhiteWineBuff>());
@@ -101,6 +101,7 @@ namespace CalamityMod.Systems.Collections
public static Dictionary<int, int> AlcoholStrength = new Dictionary<int, int>
{
{ BuffID.Tipsy, 1 },
{ BuffType<BaconOilBuff>(), 3 },
{ BuffType<BloodyMaryBuff>(), 1 },
{ BuffType<CaribbeanRumBuff>(), 1 },
{ BuffType<CinnamonRollBuff>(), 1 },