Void Sash/Ninja Belt climbing claw toggle
This commit is contained in:
1 parent
2c2bc5e560
commit
96a3a2c281
3 files changed
+100
-6
No files matched your search
@@ -1,10 +1,14 @@
|
||||
using CalamityMod.CalPlayer.Dashes;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.CalPlayer.Dashes;
|
||||
using CalamityMod.Items.Materials;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
@@ -25,6 +29,47 @@ namespace CalamityMod.Items.Accessories
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
Item.accessory = true;
|
||||
}
|
||||
#region Toggleable Tiger Gear
|
||||
|
||||
bool toggleEnabled = true;
|
||||
|
||||
public override bool CanRightClick() => Main.keyState.PressingShift();
|
||||
public override void RightClick(Player player)
|
||||
{
|
||||
toggleEnabled = !toggleEnabled;
|
||||
Item.NetStateChanged();
|
||||
}
|
||||
public override bool ConsumeItem(Player player) => false;
|
||||
public override void SaveData(TagCompound tag)
|
||||
{
|
||||
tag.Add("toggleEffect", toggleEnabled);
|
||||
}
|
||||
|
||||
public override void LoadData(TagCompound tag)
|
||||
{
|
||||
toggleEnabled = tag.GetBool("toggleEffect");
|
||||
}
|
||||
|
||||
public override void NetSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(toggleEnabled);
|
||||
}
|
||||
|
||||
public override void NetReceive(BinaryReader reader)
|
||||
{
|
||||
toggleEnabled = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled);
|
||||
}
|
||||
#endregion
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
{
|
||||
tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : "");
|
||||
base.ModifyTooltips(tooltips);
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
@@ -35,7 +80,8 @@ namespace CalamityMod.Items.Accessories
|
||||
player.blackBelt = true;
|
||||
player.dashType = 0;
|
||||
player.Calamity().DashID = StatisNinjaBeltDash.ID;
|
||||
player.spikedBoots = 2;
|
||||
if (toggleEnabled)
|
||||
player.spikedBoots = 2;
|
||||
player.accFlipper = true;
|
||||
player.Calamity().statisNinjaBelt = true;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.CalPlayer.Dashes;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Rarities;
|
||||
@@ -11,6 +13,7 @@ using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
@@ -35,7 +38,47 @@ namespace CalamityMod.Items.Accessories
|
||||
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
|
||||
Item.rare = ModContent.RarityType<CosmicPurple>();
|
||||
}
|
||||
#region Toggleable Tiger Gear
|
||||
|
||||
bool toggleEnabled = true;
|
||||
|
||||
public override bool CanRightClick() => Main.keyState.PressingShift();
|
||||
public override void RightClick(Player player)
|
||||
{
|
||||
toggleEnabled = !toggleEnabled;
|
||||
Item.NetStateChanged();
|
||||
}
|
||||
public override bool ConsumeItem(Player player) => false;
|
||||
public override void SaveData(TagCompound tag)
|
||||
{
|
||||
tag.Add("toggleEffect", toggleEnabled);
|
||||
}
|
||||
|
||||
public override void LoadData(TagCompound tag)
|
||||
{
|
||||
toggleEnabled = tag.GetBool("toggleEffect");
|
||||
}
|
||||
|
||||
public override void NetSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(toggleEnabled);
|
||||
}
|
||||
|
||||
public override void NetReceive(BinaryReader reader)
|
||||
{
|
||||
toggleEnabled = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled);
|
||||
}
|
||||
#endregion
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
{
|
||||
tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : "");
|
||||
base.ModifyTooltips(tooltips);
|
||||
}
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
@@ -49,7 +92,8 @@ namespace CalamityMod.Items.Accessories
|
||||
player.blackBelt = true;
|
||||
modPlayer.DashID = StatisVoidSashDash.ID;
|
||||
player.dashType = 0;
|
||||
player.spikedBoots = 2;
|
||||
if (toggleEnabled)
|
||||
player.spikedBoots = 2;
|
||||
player.accFlipper = true;
|
||||
player.Calamity().statisVoidSash = true;
|
||||
|
||||
|
||||
@@ -1739,8 +1739,10 @@ StatisNinjaBelt: {
|
||||
Provides a high-speed dash
|
||||
10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage
|
||||
Increases movement acceleration and deceleration by 1.6x
|
||||
Grants the ability to swim, climb walls, and dodge attacks
|
||||
Grants the ability to swim[TOGGLE] and dodge attacks
|
||||
[c/aaaaaa:Shift-<right> this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws]
|
||||
'''
|
||||
ToggleEffect: ", climb walls,"
|
||||
HoldShiftTooltip: "{$Common.DodgeInformation}"
|
||||
}
|
||||
|
||||
@@ -1751,9 +1753,11 @@ StatisVoidSash: {
|
||||
Provides a high-speed dash
|
||||
20% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage
|
||||
Increases movement acceleration and deceleration by 1.85x
|
||||
Grants the ability to swim, climb walls, and dodge attacks
|
||||
Grants the ability to swim[TOGGLE] and dodge attacks
|
||||
Visual effects are reduced if visibility is disabled
|
||||
[c/aaaaaa:Shift-<right> this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws]
|
||||
'''
|
||||
ToggleEffect: ", climb walls,"
|
||||
HoldShiftTooltip: "{$Common.DodgeInformation}"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user