Health/Mana API + Small changes and fixes

This commit is contained in:
Altixal committed 2023-05-30 20:07:25 +07:00
1 parent be6edf0a05
commit 126e3ac10d
40 files changed
+320 -352

No files matched your search

+17 -8
View File
@@ -32,6 +32,7 @@ using CalamityMod.Items.Armor.Wulfrum;
using CalamityMod.Items.Dyes;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Mounts.Minecarts;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.TreasureBags.MiscGrabBags;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.DraedonsArsenal;
@@ -1389,11 +1390,6 @@ namespace CalamityMod.CalPlayer
// Max health bonuses
if (absorber)
Player.statLifeMax2 += sponge ? 30 : 20;
Player.statLifeMax2 +=
(mFruit ? 25 : 0) +
(bOrange ? 25 : 0) +
(eBerry ? 25 : 0) +
(dFruit ? 25 : 0);
if (fleshKnuckles)
Player.statLifeMax2 += 45;
@@ -2055,6 +2051,22 @@ namespace CalamityMod.CalPlayer
}
#endregion
#region Modify Max Health and Mana
public override void ModifyMaxStats(out StatModifier health, out StatModifier mana)
{
health = StatModifier.Default;
health.Base = bOrange.ToInt() * BloodOrange.LifeBoost
+ mFruit.ToInt() * MiracleFruit.LifeBoost
+ eBerry.ToInt() * Elderberry.LifeBoost
+ dFruit.ToInt() * Dragonfruit.LifeBoost;
mana = StatModifier.Default;
mana.Base = cShard.ToInt() * CometShard.ManaBoost
+ eCore.ToInt() * EtherealCore.ManaBoost
+ pHeart.ToInt() * PhantomHeart.ManaBoost;
}
#endregion
#region Screen Position Movements
public override void ModifyScreenPosition()
{
@@ -2480,7 +2492,6 @@ namespace CalamityMod.CalPlayer
#endregion
#region Keybinds
public Item FindAccessory(int itemID)
{
for (int i = 0; i < 10; i++)
@@ -2491,8 +2502,6 @@ namespace CalamityMod.CalPlayer
return new Item();
}
public override void ProcessTriggers(TriggersSet triggersSet)
{
// Why does this otherwise work when you're dead lmao
-24
View File
@@ -114,30 +114,6 @@ namespace CalamityMod.CalPlayer
Player.armorEffectDrawShadowSubtle = false;
}
// Hearts
Asset<Texture2D> bOrange = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/HeartBloodOrange");
Asset<Texture2D> mFruit = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/HeartMiracleFruit");
Asset<Texture2D> eBerry = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/HeartElderberry");
Asset<Texture2D> dFruit = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/HeartDragonfruit");
Asset<Texture2D> heartOriginal = CalamityMod.heartOriginal; // Life crystal
Asset<Texture2D> heartOriginal2 = CalamityMod.heartOriginal2; // Life fruit
int totalFruit =
(calamityPlayer.mFruit ? 1 : 0) +
(calamityPlayer.bOrange ? 1 : 0) +
(calamityPlayer.eBerry ? 1 : 0) +
(calamityPlayer.dFruit ? 1 : 0);
TextureAssets.Heart2 = totalFruit switch
{
4 => dFruit,
3 => eBerry,
2 => mFruit,
1 => bOrange,
_ => heartOriginal2,
};
TextureAssets.Heart = heartOriginal;
if (calamityPlayer.tRegen)
{
if (Main.rand.NextBool(10) && drawInfo.shadow == 0f)
+12 -52
View File
@@ -112,9 +112,6 @@ namespace CalamityMod.CalPlayer
// Misc effects, because I don't know what else to call it
MiscEffects();
// Max life and mana effects
MaxLifeAndManaEffects();
// Standing still effects
StandingStillEffects();
@@ -601,6 +598,14 @@ namespace CalamityMod.CalPlayer
private void MiscEffects()
{
// Update Carpet textures
if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer)
{
Asset<Texture2D> carpetAuric = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/AuricCarpet");
Asset<Texture2D> carpetOriginal = CalamityMod.carpetOriginal;
TextureAssets.FlyingCarpet = (auricSet ? carpetAuric : carpetOriginal);
}
// Calculate/reset DoG cart rotations based on whether the DoG cart is in use.
if (Player.mount.Active && Player.mount.Type == ModContent.MountType<DoGCartMount>())
{
@@ -722,14 +727,6 @@ namespace CalamityMod.CalPlayer
}
}
// Max mana bonuses
Player.statManaMax2 +=
(permafrostsConcoction ? 50 : 0) +
(pHeart ? 50 : 0) +
(eCore ? 50 : 0) +
(cShard ? 50 : 0) +
(starBeamRye ? 50 : 0);
// Life Steal nerf
// Reduces Normal Mode life steal recovery rate from 0.6/s to 0.5/s
// Reduces Expert Mode life steal recovery rate from 0.5/s to 0.35/s
@@ -1580,7 +1577,10 @@ namespace CalamityMod.CalPlayer
//Permafrost's Concoction bonuses/debuffs
if (permafrostsConcoction)
{
Player.manaCost *= 0.85f;
Player.statManaMax2 += 50;
}
if (encased)
{
@@ -2103,47 +2103,6 @@ namespace CalamityMod.CalPlayer
}
#endregion
#region Max Life And Mana Effects
private void MaxLifeAndManaEffects()
{
// New textures
if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer)
{
Asset<Texture2D> cometShard = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaCometShard");
Asset<Texture2D> etherealCore = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaEtherealCore");
Asset<Texture2D> phantomHeart = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaPhantomHeart");
Asset<Texture2D> manaOriginal = CalamityMod.manaOriginal;
Asset<Texture2D> carpetAuric = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaReplacements/AuricCarpet");
Asset<Texture2D> carpetOriginal = CalamityMod.carpetOriginal;
int totalManaBoost =
(pHeart ? 1 : 0) +
(eCore ? 1 : 0) +
(cShard ? 1 : 0);
switch (totalManaBoost)
{
case 3:
TextureAssets.Mana = phantomHeart;
break;
case 2:
TextureAssets.Mana = etherealCore;
break;
case 1:
TextureAssets.Mana = cometShard;
break;
default:
TextureAssets.Mana = manaOriginal;
break;
}
if (auricSet)
TextureAssets.FlyingCarpet = carpetAuric;
else
TextureAssets.FlyingCarpet = carpetOriginal;
}
}
#endregion
#region Standing Still Effects
private void StandingStillEffects()
{
@@ -2531,6 +2490,7 @@ namespace CalamityMod.CalPlayer
{
Player.GetDamage<MagicDamageClass>() += 0.08f;
Player.manaCost *= 0.9f;
Player.statManaMax2 += 50;
}
if (moscowMule)
+14 -14
View File
@@ -22,20 +22,20 @@ namespace CalamityMod
public override void Load()
{
// Register keybinds
NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "Normality Relocator", "Z");
RageHotKey = KeybindLoader.RegisterKeybind(Mod, "Rage Mode", "V");
AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "Adrenaline Mode", "B");
AegisHotKey = KeybindLoader.RegisterKeybind(Mod, "Elysian Guard", "N");
SetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "Armor Set Bonus", "Y");
AstralTeleportHotKey = KeybindLoader.RegisterKeybind(Mod, "Astral Teleport", "P");
AstralArcanumUIHotkey = KeybindLoader.RegisterKeybind(Mod, "Astral Arcanum UI Toggle", "O");
SandCloakHotkey = KeybindLoader.RegisterKeybind(Mod, "Sand Cloak Effect", "C");
SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "Spectral Veil Teleport", "Z");
PlaguePackHotKey = KeybindLoader.RegisterKeybind(Mod, "Booster Dash", "Q");
AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "Angelic Alliance Blessing", "G");
GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "God Slayer Dash", "H");
ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "Exo Chair Slow Down", "RightShift");
DashHotkey = KeybindLoader.RegisterKeybind(Mod, "Dash Double Tap Override", "F");
NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z");
RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V");
AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B");
AegisHotKey = KeybindLoader.RegisterKeybind(Mod, "ElysianGuard", "N");
SetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y");
AstralTeleportHotKey = KeybindLoader.RegisterKeybind(Mod, "AstralTeleport", "P");
AstralArcanumUIHotkey = KeybindLoader.RegisterKeybind(Mod, "AstralArcanumUIToggle", "O");
SandCloakHotkey = KeybindLoader.RegisterKeybind(Mod, "SandCloakEffect", "C");
SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z");
PlaguePackHotKey = KeybindLoader.RegisterKeybind(Mod, "BoosterDash", "Q");
AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G");
GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "GodSlayerDash", "H");
ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "ExoChairSlowDown", "RightShift");
DashHotkey = KeybindLoader.RegisterKeybind(Mod, "DashDoubleTapOverride", "F");
}
public override void Unload()
-14
View File
@@ -89,10 +89,6 @@ namespace CalamityMod
public static int ghostKillCount = 0;
public static int sharkKillCount = 0;
// Textures
public static Asset<Texture2D> heartOriginal;
public static Asset<Texture2D> heartOriginal2;
public static Asset<Texture2D> manaOriginal;
public static Asset<Texture2D> carpetOriginal;
//Astral Sky/BG
@@ -177,10 +173,6 @@ namespace CalamityMod
{
Instance = this;
// Save vanilla textures.
heartOriginal = TextureAssets.Heart;
heartOriginal2 = TextureAssets.Heart2;
manaOriginal = TextureAssets.Mana;
carpetOriginal = TextureAssets.FlyingCarpet;
// Apply IL edits as soon as possible.
@@ -488,9 +480,6 @@ namespace CalamityMod
if (!Main.dedServ)
{
TextureAssets.Heart = heartOriginal;
TextureAssets.Heart2 = heartOriginal2;
TextureAssets.Mana = manaOriginal;
TextureAssets.FlyingCarpet = carpetOriginal;
GeneralParticleHandler.Unload();
}
@@ -504,9 +493,6 @@ namespace CalamityMod
SceneMetrics.GraveyardTileMin = 16;
SceneMetrics.GraveyardTileThreshold = 28;
heartOriginal = null;
heartOriginal2 = null;
manaOriginal = null;
carpetOriginal = null;
/*
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+7 -7
View File
@@ -36,13 +36,13 @@ namespace CalamityMod.ILEditing
Terraria.On_Main.DrawInfernoRings += DrawForegroundParticles;
// ERROR
Terraria.GameContent.Drawing.On_TileDrawing.DrawPartialLiquid += DrawCustomLava;
//Terraria.GameContent.Drawing.On_TileDrawing.DrawPartialLiquid += DrawCustomLava;
// ERROR
Terraria.IL_WaterfallManager.DrawWaterfall += DrawCustomLavafalls;
//Terraria.IL_WaterfallManager.DrawWaterfall += DrawCustomLavafalls;
// ERROR
Terraria.GameContent.Liquid.IL_LiquidRenderer.InternalDraw += ChangeWaterQuadColors;
//Terraria.GameContent.Liquid.IL_LiquidRenderer.InternalDraw += ChangeWaterQuadColors;
// ERROR
Terraria.IL_Main.oldDrawWater += DrawCustomLava3;
//Terraria.IL_Main.oldDrawWater += DrawCustomLava3;
Terraria.Graphics.Light.On_TileLightScanner.GetTileLight += MakeSulphSeaWaterBetter;
Terraria.GameContent.Drawing.On_TileDrawing.PreDrawTiles += ClearForegroundStuff;
@@ -61,7 +61,7 @@ namespace CalamityMod.ILEditing
Terraria.IL_Player.ApplyEquipFunctional += ScopesRequireVisibilityToZoom;
// ERROR
Terraria.IL_Player.Hurt += RemoveRNGFromDodges;
//Terraria.IL_Player.Hurt += RemoveRNGFromDodges;
Terraria.IL_Player.DashMovement += FixAllDashMechanics;
Terraria.On_Player.DoCommonDashHandle += ApplyDashKeybind;
@@ -88,7 +88,7 @@ namespace CalamityMod.ILEditing
// Damage and health balance
// ERROR
Terraria.IL_Main.DamageVar += AdjustDamageVariance;
//Terraria.IL_Main.DamageVar += AdjustDamageVariance;
Terraria.IL_Projectile.Damage += MakeTagDamageMultiplicative;
Terraria.IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling;
@@ -128,7 +128,7 @@ namespace CalamityMod.ILEditing
Terraria.On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns;
// ERROR
Terraria.IL_NPC.SpawnNPC += MakeVoodooDemonDollWork;
//Terraria.IL_NPC.SpawnNPC += MakeVoodooDemonDollWork;
// TODO -- Beat Lava Slimes once and for all
// IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes;
+2 -2
View File
@@ -760,7 +760,7 @@ namespace CalamityMod.ILEditing
#endregion General Particle Rendering
#region Custom Lava Visuals
private static void DrawCustomLava(Terraria.GameContent.Drawing.On_TileDrawing.orig_DrawPartialLiquid orig, TileDrawing self, Tile tileCache, Vector2 position, Rectangle liquidSize, int liquidType, Color aColor)
/*private static void DrawCustomLava(Terraria.GameContent.Drawing.On_TileDrawing.orig_DrawPartialLiquid orig, TileDrawing self, Tile tileCache, Vector2 position, Rectangle liquidSize, int liquidType, Color aColor)
{
if (liquidType != 1)
{
@@ -799,7 +799,7 @@ namespace CalamityMod.ILEditing
{
Main.spriteBatch.Draw(slopeTexture, position, liquidSize, aColor, 0f, Vector2.Zero, 1f, 0, 0f);
}
}
}*/
private static void ChangeWaterQuadColors(ILContext il)
{
+17 -22
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using System.Linq;
using System.Collections.Generic;
@@ -13,10 +14,14 @@ namespace CalamityMod.Items.PermanentBoosters
public class BloodOrange : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int LifeBoost = 25;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LifeBoost);
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/BloodOrangeConsume");
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit
}
@@ -32,33 +37,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.consumable = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.bOrange)
{
string key = "Mods.CalamityMod.Misc.BloodOrangeText";
Color messageColor = Color.Orange;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
else if (player.statLifeMax < 500)
{
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.bOrange)
{
player.HealEffect(25);
string key = "Mods.CalamityMod.Misc.BloodOrangeText";
Color messageColor = Color.Orange;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseHealthMaxIncreasingItem(LifeBoost);
modPlayer.bOrange = true;
}
return true;
@@ -66,10 +61,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().bOrange)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+16 -19
View File
@@ -3,6 +3,7 @@ using CalamityMod.Items.Materials;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using System.Linq;
using System.Collections.Generic;
@@ -12,6 +13,10 @@ namespace CalamityMod.Items.PermanentBoosters
public class CometShard : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int ManaBoost = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost);
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
@@ -30,31 +35,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.consumable = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.cShard)
{
string key = "Mods.CalamityMod.Misc.CometShardText";
Color messageColor = Color.DarkOrchid;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.cShard)
{
player.ManaEffect(50);
string key = "Mods.CalamityMod.Misc.CometShardText";
Color messageColor = Color.DarkOrchid;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseManaMaxIncreasingItem(ManaBoost);
modPlayer.cShard = true;
}
return true;
@@ -62,10 +59,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().cShard)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+17 -23
View File
@@ -6,6 +6,7 @@ using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using System.Linq;
using System.Collections.Generic;
@@ -15,10 +16,14 @@ namespace CalamityMod.Items.PermanentBoosters
public class Dragonfruit : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int LifeBoost = 25;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LifeBoost);
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/DragonfruitConsume");
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit
}
@@ -34,34 +39,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.rare = ModContent.RarityType<Violet>();
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.dFruit)
{
string key = "Mods.CalamityMod.Misc.DragonfruitText";
Color messageColor = Color.Cyan;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
else if (player.statLifeMax < 500)
{
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.dFruit)
{
player.HealEffect(25);
string key = "Mods.CalamityMod.Misc.DragonfruitText";
Color messageColor = Color.Cyan;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseHealthMaxIncreasingItem(LifeBoost);
modPlayer.dFruit = true;
}
return true;
@@ -69,10 +63,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().dFruit)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+17 -23
View File
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.PermanentBoosters
@@ -14,10 +15,14 @@ namespace CalamityMod.Items.PermanentBoosters
public class Elderberry : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int LifeBoost = 25;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LifeBoost);
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/ElderberryConsume");
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit
}
@@ -33,34 +38,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.consumable = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.eBerry)
{
string key = "Mods.CalamityMod.Misc.ElderberryText";
Color messageColor = Color.RoyalBlue;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
else if (player.statLifeMax < 500)
{
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.eBerry)
{
player.HealEffect(25);
string key = "Mods.CalamityMod.Misc.ElderberryText";
Color messageColor = Color.RoyalBlue;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseHealthMaxIncreasingItem(LifeBoost);
modPlayer.eBerry = true;
}
return true;
@@ -68,10 +62,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().eBerry)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+16 -19
View File
@@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using System.Linq;
using System.Collections.Generic;
@@ -12,6 +13,10 @@ namespace CalamityMod.Items.PermanentBoosters
public class EtherealCore : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int ManaBoost = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost);
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
@@ -30,31 +35,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.consumable = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.eCore)
{
string key = "Mods.CalamityMod.Misc.EtherealCoreText";
Color messageColor = Color.Purple;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.eCore)
{
player.ManaEffect(50);
string key = "Mods.CalamityMod.Misc.EtherealCoreText";
Color messageColor = Color.Purple;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseManaMaxIncreasingItem(ManaBoost);
modPlayer.eCore = true;
}
return true;
@@ -62,10 +59,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().eCore)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+17 -23
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using System.Linq;
using System.Collections.Generic;
@@ -13,10 +14,14 @@ namespace CalamityMod.Items.PermanentBoosters
public class MiracleFruit : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int LifeBoost = 25;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LifeBoost);
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/MiracleFruitConsume");
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit
}
@@ -32,34 +37,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.consumable = true;
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.mFruit)
{
string key = "Mods.CalamityMod.Misc.MiracleFruitText";
Color messageColor = Color.GreenYellow;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
else if (player.statLifeMax < 500)
{
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.mFruit)
{
player.HealEffect(25);
string key = "Mods.CalamityMod.Misc.MiracleFruitText";
Color messageColor = Color.GreenYellow;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseHealthMaxIncreasingItem(LifeBoost);
modPlayer.mFruit = true;
}
return true;
@@ -67,10 +61,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().mFruit)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
+16 -18
View File
@@ -6,6 +6,7 @@ using System.Linq;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.PermanentBoosters
@@ -13,6 +14,10 @@ namespace CalamityMod.Items.PermanentBoosters
public class PhantomHeart : ModItem, ILocalizedModType
{
public string LocalizationCategory => "Items.Misc";
public const int ManaBoost = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost);
public override void SetStaticDefaults()
{
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
@@ -31,30 +36,23 @@ namespace CalamityMod.Items.PermanentBoosters
Item.rare = ModContent.RarityType<PureGreen>();
}
public override bool CanUseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.pHeart)
{
string key = "Mods.CalamityMod.Misc.PhantomHeartText";
Color messageColor = Color.Magenta;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
return true;
}
public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax;
public override bool? UseItem(Player player)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.itemAnimation > 0 && player.itemTime == 0)
{
player.itemTime = Item.useTime;
if (Main.myPlayer == player.whoAmI)
if (modPlayer.pHeart)
{
player.ManaEffect(50);
string key = "Mods.CalamityMod.Misc.PhantomHeartText";
Color messageColor = Color.Magenta;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return false;
}
CalamityPlayer modPlayer = player.Calamity();
player.UseManaMaxIncreasingItem(ManaBoost);
modPlayer.pHeart = true;
}
return true;
@@ -62,10 +60,10 @@ namespace CalamityMod.Items.PermanentBoosters
public override void ModifyTooltips(List<TooltipLine> list)
{
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
if (line != null && Main.LocalPlayer.Calamity().pHeart)
line.Text = "[c/8a8a8a:You have already consumed this item]";
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
}
public override void AddRecipes()
@@ -63,8 +63,8 @@ BloodOrange: {
DisplayName: Blood Orange
Tooltip:
'''
Permanently increases maximum life by 25
Can only be used if the max amount of life fruit has been consumed
Permanently increases maximum life by {0}
Can only be used once and requires the max amount of Life Fruits consumed
It has a distinctly sweet flavor and a strong aroma
'''
}
@@ -81,15 +81,19 @@ CelestialOnion: {
CometShard: {
DisplayName: Comet Shard
Tooltip: Permanently increases maximum mana by 50
Tooltip:
'''
Permanently increases maximum mana by {0}
Can only be used once and requires the max amount of Mana Crystals consumed
'''
}
Dragonfruit: {
DisplayName: Dragonfruit
Tooltip:
'''
Permanently increases maximum life by 25
Can only be used if the max amount of life fruit has been consumed
Permanently increases maximum life by {0}
Can only be used once and requires the max amount of Life Fruits consumed
Though somewhat bland, what taste can be described is unlike any other experienced
'''
}
@@ -107,8 +111,8 @@ Elderberry: {
DisplayName: Elderberry
Tooltip:
'''
Permanently increases maximum life by 25
Can only be used if the max amount of life fruit has been consumed
Permanently increases maximum life by {0}
Can only be used once and requires the max amount of Life Fruits consumed
A tangy, tart flavor with a somewhat earthen touch
'''
}
@@ -124,7 +128,11 @@ ElectrolyteGelPack: {
EtherealCore: {
DisplayName: Ethereal Core
Tooltip: Permanently increases maximum mana by 50
Tooltip:
'''
Permanently increases maximum mana by {0}
Can only be used once and requires the max amount of Mana Crystals consumed
'''
}
InfernalBlood: {
@@ -140,8 +148,8 @@ MiracleFruit: {
DisplayName: Miracle Fruit
Tooltip:
'''
Permanently increases maximum life by 25
Can only be used if the max amount of life fruit has been consumed
Permanently increases maximum life by {0}
Can only be used once and requires the max amount of Life Fruits consumed
Refreshing and cool, perhaps even a bit minty
'''
}
@@ -157,7 +165,11 @@ MushroomPlasmaRoot: {
PhantomHeart: {
DisplayName: Phantom Heart
Tooltip: Permanently increases maximum mana by 50
Tooltip:
'''
Permanently increases maximum mana by {0}
Can only be used once and requires the max amount of Mana Crystals consumed
'''
}
RedLightningContainer: {
@@ -1,14 +1,14 @@
"Dash Double Tap Override.DisplayName": Dash Double Tap Override
"Exo Chair Slow Down.DisplayName": Exo Chair Slow Down
"God Slayer Dash.DisplayName": God Slayer Dash
"Angelic Alliance Blessing.DisplayName": Angelic Alliance Blessing
"Booster Dash.DisplayName": Booster Dash
"Spectral Veil Teleport.DisplayName": Spectral Veil Teleport
"Sand Cloak Effect.DisplayName": Sand Cloak Effect
"Astral Arcanum UI Toggle.DisplayName": Astral Arcanum UI Toggle
"Astral Teleport.DisplayName": Astral Teleport
"Armor Set Bonus.DisplayName": Armor Set Bonus
"Elysian Guard.DisplayName": Elysian Guard
"Adrenaline Mode.DisplayName": Adrenaline Mode
"Rage Mode.DisplayName": Rage Mode
"Normality Relocator.DisplayName": Normality Relocator
DashDoubleTapOverride.DisplayName: Dash Double Tap Override
ExoChairSlowDown.DisplayName: Exo Chair Slow Down
GodSlayerDash.DisplayName: God Slayer Dash
AngelicAllianceBlessing.DisplayName: Angelic Alliance Blessing
BoosterDash.DisplayName: Booster Dash
SpectralVeilTeleport.DisplayName: Spectral Veil Teleport
SandCloakEffect.DisplayName: Sand Cloak Effect
AstralArcanumUIToggle.DisplayName: Astral Arcanum UI Toggle
AstralTeleport.DisplayName: Astral Teleport
ArmorSetBonus.DisplayName: Armor Set Bonus
ElysianGuard.DisplayName: Elysian Guard
AdrenalineMode.DisplayName: Adrenaline Mode
RageMode.DisplayName: Rage Mode
NormalityRelocator.DisplayName: Normality Relocator
@@ -12,6 +12,7 @@ IceSchematicRecipeCondition: Place a schematic from the lab within the frozen ca
/* Item Messages */
ThirdSageBlessingText: You have been blessed by the Third Sage!
ThirdSageBlessingText2: The Third Sage has rescinded its blessing...
GenericConsumedText: "[c/8a8a8a:You have already consumed this item]"
BloodOrangeText: You have already consumed a Blood Orange. Eating any more would not be good for you.
MiracleFruitText: You have already consumed a Miracle Fruit. Having another would make you sick.
ElderberryText: You have already consumed an Elderberry. It is probably not wise to eat more than one.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

@@ -0,0 +1,101 @@
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System.Collections.Generic;
using Terraria;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.UI.TextureReplacements
{
public class CalamityTextureOverlay : ModResourceOverlay
{
// Most of this is taken from ExampleMod. See that for additional explanations.
private Dictionary<string, Asset<Texture2D>> vanillaAssetCache = new();
public string baseFolder = "CalamityMod/UI/TextureReplacements/";
// Determines which health UI to draw based on player upgrades.
public string LifeTexturePath()
{
string folder = $"{baseFolder}HP";
CalamityPlayer modPlayer = Main.LocalPlayer.Calamity();
if (modPlayer.dFruit)
return folder + "Dragonfruit";
if (modPlayer.eBerry)
return folder + "Elderberry";
if (modPlayer.mFruit)
return folder + "MiracleFruit";
if (modPlayer.bOrange)
return folder + "BloodOrange";
return string.Empty;
}
// Determines which mana UI to draw based on player upgrades.
public string ManaTexturePath()
{
string folder = $"{baseFolder}MP";
CalamityPlayer modPlayer = Main.LocalPlayer.Calamity();
if (modPlayer.pHeart)
return folder + "PhantomHeart";
if (modPlayer.eCore)
return folder + "EtherealCore";
if (modPlayer.cShard)
return folder + "CometShard";
return string.Empty;
}
public override void PostDrawResource(ResourceOverlayDrawContext context)
{
Asset<Texture2D> asset = context.texture;
// Vanilla texture paths
string fancyFolder = "Images/UI/PlayerResourceSets/FancyClassic/";
string barsFolder = "Images/UI/PlayerResourceSets/HorizontalBars/";
// Auric Flying Carpet
if (asset == TextureAssets.FlyingCarpet && Main.LocalPlayer.Calamity().auricSet)
{
context.texture = ModContent.Request<Texture2D>($"{baseFolder}AuricCarpet");
context.Draw();
}
if (ManaTexturePath() != string.Empty)
{
if (asset == TextureAssets.Mana || CompareAssets(asset, fancyFolder + "Star_Fill"))
{
context.texture = ModContent.Request<Texture2D>(ManaTexturePath() + "Star");
context.Draw();
}
else if (CompareAssets(asset, barsFolder + "MP_Fill"))
{
context.texture = ModContent.Request<Texture2D>(ManaTexturePath() + "Bar");
context.Draw();
}
}
if (LifeTexturePath() == string.Empty)
return;
// Draw hearts for Classic and Fancy
if (asset == TextureAssets.Heart || asset == TextureAssets.Heart2 || CompareAssets(asset, fancyFolder + "Heart_Fill") || CompareAssets(asset, fancyFolder + "Heart_Fill_B"))
{
context.texture = ModContent.Request<Texture2D>(LifeTexturePath() + "Heart");
context.Draw();
}
// Draw bars
else if (CompareAssets(asset, barsFolder + "HP_Fill") || CompareAssets(asset, barsFolder + "HP_Fill_Honey"))
{
context.texture = ModContent.Request<Texture2D>(LifeTexturePath() + "Bar");
context.Draw();
}
}
private bool CompareAssets(Asset<Texture2D> currentAsset, string compareAssetPath)
{
if (!vanillaAssetCache.TryGetValue(compareAssetPath, out var asset))
asset = vanillaAssetCache[compareAssetPath] = Main.Assets.Request<Texture2D>(compareAssetPath);
return currentAsset == asset;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 157 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 514 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 472 B

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod
return Language.GetText("ItemName." + ItemID.Search.GetName(itemID));
}
var modItem = ItemLoader.GetItem(itemID);
return Language.GetOrRegister($"Mods.{modItem.Mod.Name}.{modItem.LocalizationCategory}.{modItem.Name}.DisplayName");
return modItem.GetLocalization("DisplayName");
}
/// <returns>
File renamed without changes.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

+6 -29
View File
@@ -8,34 +8,11 @@ namespace CalamityMod.Waters
{
public class AstralWater : ModWaterStyle
{
public override int ChooseWaterfallStyle()
{
return ModContent.Find<ModWaterfallStyle>("CalamityMod/AstralWaterflow").Slot;
}
public override int GetSplashDust()
{
return 52; //corruption water?
}
public override int GetDropletGore()
{
return ModContent.Find<ModGore>("CalamityMod/AstralWaterDroplet").Type;
}
public override Asset<Texture2D> GetRainTexture()
{
return ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaReplacements/RainAstral");
}
public override byte GetRainVariant()
{
return (byte)Main.rand.Next(3);
}
public override Color BiomeHairColor()
{
return Color.MediumPurple;
}
public override int ChooseWaterfallStyle() => ModContent.Find<ModWaterfallStyle>("CalamityMod/AstralWaterflow").Slot;
public override int GetSplashDust() => 52; //corruption water?
public override int GetDropletGore() => ModContent.Find<ModGore>("CalamityMod/AstralWaterDroplet").Type;
public override Asset<Texture2D> GetRainTexture() => ModContent.Request<Texture2D>("CalamityMod/Waters/AstralRain");
public override byte GetRainVariant() => (byte)Main.rand.Next(3);
public override Color BiomeHairColor() => Color.MediumPurple;
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 602 B

+6 -29
View File
@@ -13,34 +13,11 @@ namespace CalamityMod.Waters
{
Type = Slot;
}
public override int ChooseWaterfallStyle()
{
return ModContent.Find<ModWaterfallStyle>("CalamityMod/SulphuricWaterflow").Slot;
}
public override int GetSplashDust()
{
return 101;
}
public override int GetDropletGore()
{
return 708;
}
public override Asset<Texture2D> GetRainTexture()
{
return ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaReplacements/RainSulphSea");
}
public override byte GetRainVariant()
{
return (byte)Main.rand.Next(3);
}
public override Color BiomeHairColor()
{
return Color.Turquoise;
}
public override int ChooseWaterfallStyle() => ModContent.Find<ModWaterfallStyle>("CalamityMod/SulphuricWaterflow").Slot;
public override int GetSplashDust() => 101;
public override int GetDropletGore()=> 708;
public override Asset<Texture2D> GetRainTexture() => ModContent.Request<Texture2D>("CalamityMod/Waters/SulphuricRain");
public override byte GetRainVariant() => (byte)Main.rand.Next(3);
public override Color BiomeHairColor() => Color.Turquoise;
}
}