Added toggle for MOAB and Tracer wings

This commit is contained in:
Doze-Zoze committed 2025-04-14 23:54:52 -05:00
1 parent ba740c0624
commit 188fc93e96
10 files changed
+232 -23

No files matched your search

+10 -1
View File
@@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories.Wings
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
{
if (Item.wingSlot == -1) return;
ascentWhenFalling = BonusAscentWhileFalling;
ascentWhenRising = BonusAscentWhileRising;
maxCanAscendMultiplier = RisingSpeedThreshold;
@@ -60,7 +61,15 @@ namespace CalamityMod.Items.Accessories.Wings
public override void ModifyTooltips(List<TooltipLine> list)
{
WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot];
if (Item.wingSlot == -1) return;
WingStats stats = new();
if (Item.type == ModContent.ItemType<TracersCelestial>())
stats = ArmorIDs.Wing.Sets.Stats[TracersCelestial.wingSlot];
else if (Item.type == ModContent.ItemType<TracersElysian>())
stats = ArmorIDs.Wing.Sets.Stats[TracersElysian.wingSlot];
else if (Item.type == ModContent.ItemType<TracersSeraph>())
stats = ArmorIDs.Wing.Sets.Stats[TracersSeraph.wingSlot];
else stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot];
int time = stats.FlyTime;
float run = stats.AccRunSpeedOverride;
float rAcc = stats.AccRunAccelerationMult * 0.08f;
+55 -2
View File
@@ -1,10 +1,13 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.Items.Accessories.Wings
{
@@ -17,7 +20,12 @@ namespace CalamityMod.Items.Accessories.Wings
public override float MaxAscentSpeed => 2.5f;
public override float BaseAscent => 0.125f;
public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f);
public static int wingSlot = 0;
public override void SetStaticDefaults()
{
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f);
wingSlot = Item.wingSlot;
}
public override void SetDefaults()
{
@@ -28,9 +36,37 @@ namespace CalamityMod.Items.Accessories.Wings
Item.rare = ItemRarityID.LightPurple;
}
public override void SaveData(TagCompound tag)
{
tag.Add("wingsDisabled", Item.wingSlot == -1);
}
public override void LoadData(TagCompound tag)
{
if (tag.TryGet("wingsDisabled", out bool wingsDisabled))
{
if (wingsDisabled) Item.wingSlot = -1;
}
}
public override bool CanRightClick()
{
if (!Main.keyState.PressingShift())
return false;
return true;
}
public override void RightClick(Player player)
{
if (Item.wingSlot == wingSlot)
Item.wingSlot = -1;
else
Item.wingSlot = wingSlot;
}
public override bool ConsumeItem(Player player) => false;
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
if (Item.wingSlot != -1 && player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
{
player.rocketDelay2--;
if (player.rocketDelay2 <= 0)
@@ -97,6 +133,23 @@ namespace CalamityMod.Items.Accessories.Wings
player.Calamity().calamityBonusLuck += 0.05f;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings.
position -= -new Vector2(0, frame.Height/2-2);
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
position,
frame,
drawColor,
itemColor,
origin,
scale
);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 1.1 KiB

+42 -3
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using System.Linq;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -7,6 +8,7 @@ using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.Items.Accessories.Wings
{
@@ -20,7 +22,12 @@ namespace CalamityMod.Items.Accessories.Wings
public override float MaxAscentSpeed => 2.5f;
public override float BaseAscent => 0.125f;
public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f);
public static int wingSlot = 0;
public override void SetStaticDefaults() {
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f);
wingSlot = Item.wingSlot;
}
public override void SetDefaults()
{
@@ -30,7 +37,33 @@ namespace CalamityMod.Items.Accessories.Wings
Item.value = CalamityGlobalItem.RarityRedBuyPrice;
Item.rare = ItemRarityID.Red;
}
public override void SaveData(TagCompound tag)
{
tag.Add("wingsDisabled", Item.wingSlot == -1);
}
public override void LoadData(TagCompound tag)
{
if (tag.TryGet("wingsDisabled", out bool wingsDisabled))
{
if (wingsDisabled) Item.wingSlot = -1;
}
}
public override bool CanRightClick()
{
if (!Main.keyState.PressingShift())
return false;
return true;
}
public override void RightClick(Player player)
{
if (Item.wingSlot == wingSlot)
Item.wingSlot = -1;
else
Item.wingSlot = wingSlot;
}
public override bool ConsumeItem(Player player) => false;
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
@@ -57,7 +90,11 @@ namespace CalamityMod.Items.Accessories.Wings
player.fireWalk = true;
player.lavaImmune = true;
player.buffImmune[BuffID.OnFire] = true;
player.noFallDmg = true;
player.noFallDmg = true; if (Item.wingSlot == -1) //Only applies if tracers are plucked
{
player.rocketBoots = player.vanityRocketBoots = 4;
modPlayer.angelTreads = true;
}
modPlayer.tracersDust = !hideVisual;
modPlayer.tracersCelestial = true;
}
@@ -74,6 +111,8 @@ namespace CalamityMod.Items.Accessories.Wings
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
frame = new Rectangle(0,(Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings.
position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 2 : 0));
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 936 B

After

Width:  |  Height:  |  Size: 1.1 KiB

+55 -2
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using System.Linq;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
@@ -10,6 +11,7 @@ using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.Items.Accessories.Wings
{
@@ -23,7 +25,12 @@ namespace CalamityMod.Items.Accessories.Wings
public override float MaxAscentSpeed => 2.7f;
public override float BaseAscent => 0.135f;
public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f);
public static int wingSlot = 0;
public override void SetStaticDefaults()
{
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f);
wingSlot = Item.wingSlot;
}
public override void SetDefaults()
{
@@ -33,7 +40,45 @@ namespace CalamityMod.Items.Accessories.Wings
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
Item.rare = ModContent.RarityType<DarkBlue>();
}
public override void SaveData(TagCompound tag)
{
tag.Add("wingsDisabled", Item.wingSlot == -1);
}
public override void LoadData(TagCompound tag)
{
if (tag.TryGet("wingsDisabled", out bool wingsDisabled))
{
if (wingsDisabled) Item.wingSlot = -1;
}
}
public override bool CanRightClick()
{
if (!Main.keyState.PressingShift())
return false;
if (Main.LocalPlayer.armor.Contains(Item)) foreach (var item in Main.LocalPlayer.armor)
{
if (item.wingSlot > 0 && item.wingSlot != wingSlot)
return false;
}
return true;
}
public override void RightClick(Player player)
{
if (Item.wingSlot == wingSlot)
{
Item.wingSlot = -1;
Item.color = Color.Gray;
}
else
{
Item.wingSlot = wingSlot;
Item.color = Color.White;
}
}
public override bool ConsumeItem(Player player) => false;
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
@@ -61,6 +106,12 @@ namespace CalamityMod.Items.Accessories.Wings
player.lavaImmune = true;
player.buffImmune[BuffID.OnFire] = true;
player.noFallDmg = true;
player.socialShadowRocketBoots = true;
if (Item.wingSlot == -1) //Only applies if tracers are plucked
{
player.rocketBoots = player.vanityRocketBoots = 1;
modPlayer.angelTreads = true;
}
modPlayer.tracersDust = !hideVisual;
modPlayer.elysianWingsDust = !hideVisual;
modPlayer.tracersElysian = true;
@@ -79,6 +130,8 @@ namespace CalamityMod.Items.Accessories.Wings
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings.
position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 2 : 0));
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1008 B

After

Width:  |  Height:  |  Size: 1.3 KiB

+55 -2
View File
@@ -1,5 +1,7 @@
using CalamityMod.CalPlayer;
using System.Linq;
using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
@@ -10,6 +12,7 @@ using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.Items.Accessories.Wings
{
@@ -23,8 +26,51 @@ namespace CalamityMod.Items.Accessories.Wings
public override float MaxAscentSpeed => 2.9f;
public override float BaseAscent => 0.145f;
public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f);
public static int wingSlot = 0;
public override void SetStaticDefaults()
{
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f);
wingSlot = Item.wingSlot;
}
public override void SaveData(TagCompound tag)
{
tag.Add("wingsDisabled", Item.wingSlot == -1);
}
public override void LoadData(TagCompound tag)
{
if (tag.TryGet("wingsDisabled", out bool wingsDisabled))
{
if (wingsDisabled) Item.wingSlot = -1;
}
}
public override bool CanRightClick()
{
if (!Main.keyState.PressingShift())
return false;
if (Main.LocalPlayer.armor.Contains(Item)) foreach (var item in Main.LocalPlayer.armor)
{
if (item.wingSlot > 0 && item.wingSlot != wingSlot)
return false;
}
return true;
}
public override void RightClick(Player player)
{
if (Item.wingSlot == wingSlot){
Item.wingSlot = -1;
Item.color = Color.Gray;
}
else
{
Item.wingSlot = wingSlot;
Item.color = Color.White;
}
}
public override bool ConsumeItem(Player player) => false;
public override void SetDefaults()
{
base.SetDefaults();
@@ -61,6 +107,11 @@ namespace CalamityMod.Items.Accessories.Wings
player.lavaImmune = true;
player.buffImmune[BuffID.OnFire] = true;
player.noFallDmg = true;
if (Item.wingSlot == -1) //Only applies if tracers are plucked
{
player.rocketBoots = player.vanityRocketBoots = 2;
modPlayer.angelTreads = true;
}
modPlayer.tracersDust = !hideVisual;
modPlayer.elysianWingsDust = !hideVisual;
modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects
@@ -78,6 +129,8 @@ namespace CalamityMod.Items.Accessories.Wings
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
frame = new Rectangle(0, (Item.wingSlot == -1 ? frame.Height / 2 : 0), frame.Width, frame.Height / 2); //Draws the tracers with/without wings depending on if they're set to function as wings.
position -= -new Vector2((Item.wingSlot == -1 ? 4 : 0), frame.Height / 2 - (Item.wingSlot == -1 ? 6 : 4));
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -59,7 +59,8 @@ MOAB: {
DisplayName: MOAB
Tooltip:
'''
{$CommonItemTooltip.FlightAndSlowfall}
{$CommonItemTooltip.FlightAndSlowfall} when jetpack is enabled
Shift-<right> this item while in your inventory to toggle the jetpack
32% increased jump speed and allows auto-jump
Grants the player cloud, blizzard, and sandstorm mid-air jumps
'The Mother Of All Balloons'
@@ -114,10 +115,10 @@ TracersCelestial: {
DisplayName: Celestial Tracers
Tooltip:
'''
{$CommonItemTooltip.FlightAndSlowfall}
24% increased running acceleration and greater mobility on ice
Provides the ability to walk on water, honey, and lava
Grants immunity to fire and lava
{$CommonItemTooltip.FlightAndSlowfall} when it has wings
Shift-<right> this item while in your inventory to toggle the wings
24% increased running acceleration
Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads
'Ludicrous speed!'
'''
}
@@ -126,10 +127,10 @@ TracersElysian: {
DisplayName: Elysian Tracers
Tooltip:
'''
{$CommonItemTooltip.FlightAndSlowfall}
36% increased running acceleration and greater mobility on ice
Provides the ability to walk on water, honey, and lava
Grants immunity to fire and lava
{$CommonItemTooltip.FlightAndSlowfall} when it has wings
Shift-<right> this item while in your inventory to toggle the wings
36% increased running acceleration
Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads
'Ludicrous speed!'
'''
}
@@ -138,10 +139,11 @@ TracersSeraph: {
DisplayName: Seraph Tracers
Tooltip:
'''
{$CommonItemTooltip.FlightAndSlowfall}
50% increased running acceleration and greater mobility on ice
Provides the ability to walk on water, honey, and lava
Grants immunity to fire, lava, and harmful block effects
{$CommonItemTooltip.FlightAndSlowfall} when it has wings
Shift-<right> this item while in your inventory to toggle the wings
50% increased running acceleration
Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads
Provides immunity to [i:CalamityMod/AuricOre] Auric Ore's rejection
'Taking speed EVEN FURTHER BEYOND!'
'''
}