they would never make step stool 2

This commit is contained in:
Nathanael Overton committed 2026-02-19 21:46:37 -05:00
1 parent 76dc15edf9
commit 47f2013365
14 files changed
+251

No files matched your search

+51
View File
@@ -8,6 +8,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer.Dashes;
using CalamityMod.CalPlayer.DrawLayers;
using CalamityMod.Cooldowns;
using CalamityMod.DataStructures;
using CalamityMod.Dusts;
@@ -72,6 +73,7 @@ using CalamityMod.Utilities;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -863,6 +865,7 @@ namespace CalamityMod.CalPlayer
public bool tesla = false;
public bool teslaVisuals = true;
public bool cryogenSoul = false;
public bool springStool = false;
public bool ascendantInsignia = false;
public int ascendantInsigniaBuffTime = 0;
public int ascendantInsigniaCooldown = 0;
@@ -2411,6 +2414,7 @@ namespace CalamityMod.CalPlayer
tesla = false;
teslaVisuals = true;
cryogenSoul = false;
springStool = false;
ascendantInsignia = false;
magmaStoneVisuals = true;
eGauntlet = false;
@@ -4966,6 +4970,37 @@ namespace CalamityMod.CalPlayer
Lighting.AddLight(Player.Center, Light * (0.55f + (oceanCrestTimer * 0.0035f)));
}
if (springStool)
{
if (springStool)
{
bool holdingUp = Player.controlUp;
bool standingStill = Player.velocity.Y == 0 && Player.velocity.X == 0;
if (holdingUp && standingStill && !Player.mount.Active)
{
// Vertical displacement when using Spring Stool
int boost = 61;
Player.portableStoolInfo.HasAStool = true;
Player.portableStoolInfo.IsInUse = true;
Player.portableStoolInfo.HeightBoost = boost;
Player.portableStoolInfo.VisualYOffset = boost;
Player.portableStoolInfo.MapYOffset = boost;
Player.UpdatePortableStoolUsage();
}
else
{
// Stool still exists even if not being used
Player.portableStoolInfo.HasAStool = true;
}
}
}
if (rampartOfDeities)
{
// Ice Barrier buff inherited from Frozen Turtle Shell
@@ -5022,6 +5057,8 @@ namespace CalamityMod.CalPlayer
public override void PostUpdate()
{
Main.NewText(Main.LocalPlayer.Top.Y);
if (ZoneAbyss && Main.netMode != NetmodeID.Server)
{
//Main aura
@@ -6244,6 +6281,20 @@ namespace CalamityMod.CalPlayer
GeneralParticleHandler.SpawnParticle(square1);
GeneralParticleHandler.SpawnParticle(square2);
}
public override void Load()
{
// Hook into the vanilla stool drawing method to remove it
On_PlayerDrawLayers.DrawPlayer_03_PortableStool += HideStepStool;
}
private void HideStepStool(On_PlayerDrawLayers.orig_DrawPlayer_03_PortableStool orig, ref PlayerDrawSet drawInfo)
{
if (drawInfo.drawPlayer.GetModPlayer<CalamityPlayer>().springStool)
return;
orig(ref drawInfo);
}
#endregion
#region Mana Consumption Effects
+19
View File
@@ -461,6 +461,25 @@ namespace CalamityMod.CalPlayer
#endregion
#region Modify Hit NPC
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (springStool)
{
if (Main.LocalPlayer.Top.Y < target.Top.Y)
{
// Effective +10% crit chance. Increasing crit chance additively through manual rolling is scuffed for crossmod compatability, feel free to improve it if you know a better way
float finalCritChance = Player.GetTotalCritChance(modifiers.DamageType) + 100f;
if (Main.rand.NextFloat(1f, 101f) <= finalCritChance)
modifiers.SetCrit();
else
modifiers.DisableCrit();
}
}
}
public override void ModifyHitNPCWithItem(Item item, NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.CritDamage += critDamage;
+75
View File
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.ExtraJumps;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using static Terraria.ModLoader.PlayerDrawLayer;
namespace CalamityMod.CalPlayer.DrawLayers
{
public class SpringStoolLayer : PlayerDrawLayer
{
private Asset<Texture2D> stoolTexture;
private Asset<Texture2D> springTexture;
private Asset<Texture2D> topTexture;
public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Leggings);
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
{
// Only draw if the player is holding Up and still
return drawInfo.drawPlayer.GetModPlayer<CalamityPlayer>().springStool &&
drawInfo.drawPlayer.portableStoolInfo.IsInUse;
}
protected override void Draw(ref PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
// Load textures if null
stoolTexture ??= ModContent.Request<Texture2D>("CalamityMod/ExtraJumps/SpringStoolBottom");
springTexture ??= ModContent.Request<Texture2D>("CalamityMod/ExtraJumps/SpringStoolSpring");
topTexture ??= ModContent.Request<Texture2D>("CalamityMod/ExtraJumps/SpringStoolTop");
Texture2D stoolTex = stoolTexture.Value;
Texture2D springTex = springTexture.Value;
Texture2D topTex = topTexture.Value;
// Bottom Position
Vector2 bottomPosition = new Vector2(
(int)(drawInfo.Position.X - Main.screenPosition.X + drawPlayer.width / 2f),
(int)(drawInfo.Position.Y - Main.screenPosition.Y + drawPlayer.height + drawPlayer.portableStoolInfo.HeightBoost)
);
Rectangle bottomSource = stoolTex.Frame();
Vector2 bottomOrigin = new Vector2(bottomSource.Width / 2f, bottomSource.Height - 2);
// Spring
Vector2 springPosition = bottomPosition - new Vector2(0, bottomSource.Height);
Rectangle springSource = springTex.Frame();
Vector2 springOrigin = new Vector2(springSource.Width / 2f, springSource.Height - 2);
// Top
Vector2 topPosition = springPosition - new Vector2(0, springSource.Height - 5);
Rectangle topSource = topTex.Frame();
Vector2 topOrigin = new Vector2(topSource.Width / 2f, topSource.Height);
// Add all to cache
DrawPart(ref drawInfo, stoolTex, bottomPosition, bottomSource, bottomOrigin);
DrawPart(ref drawInfo, springTex, springPosition, springSource, springOrigin);
DrawPart(ref drawInfo, topTex, topPosition, topSource, topOrigin);
}
private void DrawPart(ref PlayerDrawSet drawInfo, Texture2D tex, Vector2 pos, Rectangle src, Vector2 origin)
{
drawInfo.DrawDataCache.Add(new DrawData(tex, pos, src, drawInfo.colorArmorLegs, drawInfo.drawPlayer.bodyRotation, origin, 1f, drawInfo.playerEffect, 0)
{ shader = drawInfo.cPortableStool });
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using Microsoft.Xna.Framework;
using Terraria.Audio;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class Stooldown : CooldownHandler
{
public static new string ID => "Stooldown";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/AscendEffect";
public override Color OutlineColor => new Color(197, 165, 108);
public override Color CooldownStartColor => new Color(144, 84, 29);
public override Color CooldownEndColor => Color.Khaki;
public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/AscendantOff");
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

+51
View File
@@ -0,0 +1,51 @@
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace CalamityMod.ExtraJumps
{
public class SpringStoolJump : ExtraJump
{
public override Position GetDefaultPosition() => BeforeBottleJumps;
public override float GetDurationMultiplier(Player player) => 1f;
public override void UpdateHorizontalSpeeds(Player player)
{
player.runAcceleration *= 2f;
player.maxRunSpeed *= 1.35f;
}
public override void OnStarted(Player player, ref bool playSound)
{
playSound = true;
if (player.wingsLogic <= 0)
{
player.velocity.Y *= player.slowFall ? 2.0f : 2.75f;
}
else
{
player.velocity.Y *= 1.7f;
}
player.StopExtraJumpInProgress();
for (int i = 0; i < 3; i++)
{
Vector2 position = player.Center;
Vector2 velocity = (Vector2.UnitY * -(2.5f + 2f * i)) * player.gravDir;
int lifetime = 120;
float scale = MathHelper.Lerp(0.05f, 0.1f, i / 3f);
Color color = new Color(94, 229, 163);
Vector2 stretch = new Vector2(0.5f, 1.5f);
float shrink = -0.3f;
Particle boostRing = new CustomSpark(position, velocity, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, lifetime, scale, color, stretch, shrinkSpeed: shrink);
GeneralParticleHandler.SpawnParticle(boostRing);
}
}
public override void ShowVisuals(Player player)
{
player.StopExtraJumpInProgress();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
public class SpringStool : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void SetDefaults()
{
Item.width = 30;
Item.height = 46;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
Item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.springStool = true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.PortableStool).
AddIngredient(ItemID.CopperBar, 3).
AddTile(TileID.Anvils).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B