This commit is contained in:
mountaindrew10 committed 2022-06-09 05:36:15 -05:00
commit f104136f23
52 files changed
+1081 -884

No files matched your search

+13 -6
View File
@@ -1,3 +1,4 @@
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -18,16 +19,22 @@ namespace CalamityMod.Buffs.StatBuffs
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().bossZen = true;
// TODO -- This bool does nothing except enable boss zen config. All other effects are hardcoded.
// Is this intended?
player.Calamity().isNearbyBoss = true;
}
public override void ModifyBuffTip(ref string tip, ref int rare)
{
tip = "The nearby boss is:\n" +
"Greatly reducing enemy spawn rates\n" +
"Disabling teleportation effects\n" +
"Increasing Nurse healing cost by 400%\n" +
"Disabling Target and Super Dummy hitboxes";
StringBuilder sb = new StringBuilder(512);
sb.Append("The nearby boss is:\n");
if (CalamityConfig.Instance.BossZen)
sb.Append("Greatly reducing enemy spawn rates\n");
sb.Append("Disabling teleportation effects\n");
sb.Append("Increasing Nurse healing cost by 400%\n");
sb.Append("Disabling Target and Super Dummy hitboxes");
tip = sb.ToString();
}
}
}
+9 -17
View File
@@ -821,7 +821,7 @@ namespace CalamityMod.CalPlayer
public bool omniscience = false;
public bool zerg = false;
public bool zen = false;
public bool bossZen = false;
public bool isNearbyBoss = false;
public bool yPower = false;
public bool aWeapon = false;
public bool tScale = false;
@@ -1911,7 +1911,7 @@ namespace CalamityMod.CalPlayer
omniscience = false;
zerg = false;
zen = false;
bossZen = false;
isNearbyBoss = false;
permafrostsConcoction = false;
armorCrumbling = false;
armorShattering = false;
@@ -2151,7 +2151,7 @@ namespace CalamityMod.CalPlayer
#region Screen Position Movements
public override void ModifyScreenPosition()
{
if (CalamityConfig.Instance.DisableScreenShakes)
if (!CalamityConfig.Instance.Screenshake)
return;
if (GeneralScreenShakePower > 0f)
@@ -2333,7 +2333,7 @@ namespace CalamityMod.CalPlayer
omniscience = false;
zerg = false;
zen = false;
bossZen = false;
isNearbyBoss = false;
permafrostsConcoction = false;
armorCrumbling = false;
armorShattering = false;
@@ -3443,15 +3443,7 @@ namespace CalamityMod.CalPlayer
Player.buffImmune[BuffID.WindPushed] = true;
}
if (CalamityConfig.Instance.BossHealthBar)
{
drawBossHPBar = true;
}
else
{
drawBossHPBar = false;
}
// TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem
CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText;
// Increase tile placement speed to speed up early game a bit and make building more fun
@@ -5870,10 +5862,10 @@ namespace CalamityMod.CalPlayer
if (totalMoonlightDyes > 0)
{
// Initialize the aurora drawer.
int size = 455;
int size = 425;
FluidFieldManager.AdjustSizeRelativeToGraphicsQuality(ref size);
float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size;
float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size * 0.4f;
if (ProfanedMoonlightAuroraDrawer is null || ProfanedMoonlightAuroraDrawer.Size != size)
ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f);
@@ -5891,7 +5883,7 @@ namespace CalamityMod.CalPlayer
Vector2 auroraVelocity = (offsetAngle / 3f + Main.GlobalTimeWrappedHourly * 0.32f).ToRotationVector2();
auroraVelocity.Y = -Math.Abs(auroraVelocity.Y);
auroraVelocity = (auroraVelocity * new Vector2(0.15f, 1f) - Vector2.UnitX * Player.velocity.X / 9f).SafeNormalize(Vector2.UnitY) * 0.03f;
auroraVelocity = (auroraVelocity * new Vector2(0.15f, 1f) - Vector2.UnitX * Player.velocity.X / 9f).SafeNormalize(Vector2.UnitY) * 0.07f;
Vector2 drawPosition = Main.LocalPlayer.Center - Main.screenPosition;
Vector2 auroraSpawnPosition = drawPosition - Vector2.UnitY * 15f;
@@ -6415,7 +6407,7 @@ namespace CalamityMod.CalPlayer
else
Player.GiveIFrames(Player.immuneTime + iFramesToAdd, true);
if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushImmunityFrameCurse)
if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushIFrameCurse)
bossRushImmunityFrameCurseTimer = 180 + Player.immuneTime;
if (aeroSet && damage > 25)
+5 -260
View File
@@ -1,34 +1,11 @@
using CalamityMod.CalPlayer.DrawLayers;
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer.DrawLayers;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs.AdultEidolonWyrm;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.NPCs.Bumblebirb;
using CalamityMod.NPCs.Calamitas;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.NPCs.Crabulon;
using CalamityMod.NPCs.Cryogen;
using CalamityMod.NPCs.DesertScourge;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.NPCs.Leviathan;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Providence;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.Signus;
using CalamityMod.NPCs.SlimeGod;
using CalamityMod.NPCs.Yharon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
@@ -68,238 +45,6 @@ namespace CalamityMod.CalPlayer
AndromedaMechLayer.DrawTheStupidFuckingRobot(ref drawInfo);
CalamityPlayer calamityPlayer = Player.Calamity();
if (Main.myPlayer == Player.whoAmI && !Main.gameMenu && CalamityConfig.Instance.SpeedrunTimer)
{
string formatStr = @"hh\:mm\:ss\.ff";
string formatStrDays = @"d\:hh\:mm\:ss\.ff";
TimeSpan totalTime = CalamityMod.SpeedrunTimer.Elapsed.Add(calamityPlayer.previousSessionTotal);
string text = totalTime.ToString(totalTime.Days > 0 ? formatStrDays : formatStr);
float scale = 2f;
float xOffset = CalamityConfig.Instance.SpeedrunTimerPosX;
float yOffset = CalamityConfig.Instance.SpeedrunTimerPosY;
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, Main.screenWidth / 2f - xOffset, yOffset, Color.White, Color.Black, default, scale);
if (calamityPlayer.lastSplitType > -1)
{
TimeSpan split = calamityPlayer.lastSplit;
text = split.ToString(split.Days > 0 ? formatStrDays : formatStr);
scale = 1f;
yOffset += 44f;
Texture2D texture = null;
switch (calamityPlayer.lastSplitType)
{
// King Slime
case 1:
texture = TextureAssets.NpcHeadBoss[7].Value;
break;
case 2:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<DesertScourgeHead>()]].Value;
break;
// Eye of Cthulhu
case 3:
texture = TextureAssets.NpcHeadBoss[1].Value;
break;
case 4:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CrabulonIdle>()]].Value;
break;
// Eater of Worlds
case 5:
texture = TextureAssets.NpcHeadBoss[2].Value;
break;
// Brain of Cthulhu
case 6:
texture = TextureAssets.NpcHeadBoss[23].Value;
break;
case 7:
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss").Value;
break;
case 8:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PerforatorHive>()]].Value;
break;
// Queen Bee
case 9:
texture = TextureAssets.NpcHeadBoss[14].Value;
break;
// Skeletron
case 10:
texture = TextureAssets.NpcHeadBoss[19].Value;
break;
case 11:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<SlimeGodCore>()]].Value;
break;
// Wall of Flesh
case 12:
texture = TextureAssets.NpcHeadBoss[22].Value;
break;
case 13:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Cryogen>()]].Value;
break;
// The Twins
case 14:
texture = TextureAssets.NpcHeadBoss[21].Value;
break;
case 15:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AquaticScourgeHead>()]].Value;
break;
// The Destroyer
case 16:
texture = TextureAssets.NpcHeadBoss[25].Value;
break;
case 17:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<BrimstoneElemental>()]].Value;
break;
// Skeletron Prime
case 18:
texture = TextureAssets.NpcHeadBoss[18].Value;
break;
case 19:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CalamitasRun3>()]].Value;
break;
// Plantera
case 20:
texture = TextureAssets.NpcHeadBoss[12].Value;
break;
case 21:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Leviathan>()]].Value;
break;
case 22:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumAureus>()]].Value;
break;
// Golem
case 23:
texture = TextureAssets.NpcHeadBoss[5].Value;
break;
case 24:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PlaguebringerGoliath>()]].Value;
break;
// Duke Fishron
case 25:
texture = TextureAssets.NpcHeadBoss[4].Value;
break;
case 26:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<RavagerBody>()]].Value;
break;
// Lunatic Cultist
case 27:
texture = TextureAssets.NpcHeadBoss[31].Value;
break;
case 28:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumDeusHeadSpectral>()]].Value;
break;
// Moon Lord
case 29:
texture = TextureAssets.NpcHeadBoss[8].Value;
break;
case 30:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<ProfanedGuardianBoss>()]].Value;
break;
case 31:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Bumblefuck>()]].Value;
break;
case 32:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Providence>()]].Value;
break;
case 33:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CeaselessVoid>()]].Value;
break;
case 34:
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss").Value;
break;
case 35:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Signus>()]].Value;
break;
case 36:
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss").Value;
break;
case 37:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<OldDuke>()]].Value;
break;
case 38:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<DevourerofGodsHead>()]].Value;
break;
case 39:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Yharon>()]].Value;
break;
case 40:
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon").Value;
break;
case 41:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AresBody>()]].Value;
break;
case 42:
texture = TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<EidolonWyrmHeadHuge>()]].Value;
break;
// Queen Slime
case 43:
texture = TextureAssets.NpcHeadBoss[38].Value;
break;
// Empress of Light
case 44:
texture = TextureAssets.NpcHeadBoss[37].Value;
break;
// Deerclops
case 45:
texture = TextureAssets.NpcHeadBoss[39].Value;
break;
default:
break;
}
xOffset -= 58f;
if (texture != null)
Main.spriteBatch.Draw(texture, new Vector2(Main.screenWidth / 2f - xOffset - texture.Width - 4f, yOffset), null, Color.White, 0f, default, 1f, SpriteEffects.None, 0f);
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, Main.screenWidth / 2f - xOffset, yOffset, Color.White, Color.Black, default, scale);
}
}
// Dust modifications while high.
if (calamityPlayer.trippy)
@@ -350,8 +95,8 @@ namespace CalamityMod.CalPlayer
}
}
bool noRogueStealth = calamityPlayer.rogueStealth == 0f || Player.townNPCs > 2f || !CalamityConfig.Instance.StealthInvisbility;
if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisbility)
bool noRogueStealth = calamityPlayer.rogueStealth == 0f || Player.townNPCs > 2f || !CalamityConfig.Instance.StealthInvisibility;
if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility)
{
// A translucent orchid color, the rogue class color
float colorValue = calamityPlayer.rogueStealth / calamityPlayer.rogueStealthMax * 0.9f; //0 to 0.9
+6 -9
View File
@@ -980,18 +980,15 @@ namespace CalamityMod.CalPlayer
}
}
if (BossRushEvent.BossRushActive)
if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushRegenCurse)
{
if (CalamityConfig.Instance.BossRushHealthCurse)
{
if (Player.lifeRegen > 0)
Player.lifeRegen = 0;
if (Player.lifeRegen > 0)
Player.lifeRegen = 0;
Player.lifeRegenTime = 0;
Player.lifeRegenTime = 0;
if (Player.lifeRegenCount > 0)
Player.lifeRegenCount = 0;
}
if (Player.lifeRegenCount > 0)
Player.lifeRegenCount = 0;
}
}
#endregion
+7 -2
View File
@@ -77,12 +77,17 @@ namespace CalamityMod.CalPlayer
if (fearmongerRegenFrames > 0)
fearmongerRegenFrames--;
// Reduce the expert debuff time multiplier to the normal mode multiplier
// Reduce the expert+ debuff time multiplier to the normal mode multiplier
// TODO -- This should be a ModSystem, why is this in CalamityPlayer
if (CalamityConfig.Instance.NerfExpertDebuffs)
{
var copy = Main.RegisteredGameModes[GameModeID.Expert];
copy.DebuffTimeMultiplier = 1f;
Main.RegisteredGameModes[GameModeID.Expert] = copy;
copy = Main.RegisteredGameModes[GameModeID.Master];
copy.DebuffTimeMultiplier = 1f;
Main.RegisteredGameModes[GameModeID.Master] = copy;
}
// Go through the old positions for the player.
@@ -745,7 +750,7 @@ namespace CalamityMod.CalPlayer
{
Player.buffImmune[ModContent.BuffType<FrozenLungs>()] = true;
}
if (CalamityConfig.Instance.ReworkChilledWater)
if (CalamityConfig.Instance.ChilledWaterRework)
{
if (Main.expertMode && Player.ZoneSnow && Player.wet && !Player.lavaWet && !Player.honeyWet)
{
+190 -176
View File
@@ -1,380 +1,394 @@
using CalamityMod.UI;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.Serialization;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.DifficultyItems;
using CalamityMod.Items.DraedonMisc;
using CalamityMod.Items.Dyes.HairDye;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Weapons.DraedonsArsenal;
using CalamityMod.UI;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.ModLoader.Config;
namespace CalamityMod
{
[Label("Config")]
[Label("$Mods.CalamityMod.Config.MainTitle")]
[BackgroundColor(49, 32, 36, 216)]
public class CalamityConfig : ModConfig
{
public static CalamityConfig Instance;
// TODO -- Not all Calamity config settings should be considered client side.
// There are many configs which are server side and should stay that way.
public override ConfigScope Mode => ConfigScope.ClientSide;
public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message) => true;
// Clamps values that would cause ugly problems if loaded directly without sanitization.
[OnDeserialized]
internal void ClampValues(StreamingContext context)
{
BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost);
MeterShake = Utils.Clamp(MeterShake, MinMeterShake, MaxMeterShake);
RipperMeterShake = Utils.Clamp(RipperMeterShake, MinMeterShake, MaxMeterShake);
}
[Header("Graphics Changes")]
#region Graphics Changes
[Header("$Mods.CalamityMod.Config.SectionTitle.Graphics")]
[Label("Afterimages")]
[Label("$Mods.CalamityMod.Config.EntryTitle.Afterimages")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables rendering afterimages for Calamity NPCs, projectiles, etc.\nDisable to improve performance.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.Afterimages")]
public bool Afterimages { get; set; }
[Label("MaxParticles")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ParticleLimit")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0, 1000)]
[DefaultValue(500)]
[Tooltip("Sets the maximum of particle effects that can exist at once.\nParticles are separate from dust and gores.\nTurn down to improve performance.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ParticleLimit")]
public int ParticleLimit { get; set; }
[Label("ScreenshakeOff")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Disables all screen-shaking effects.")]
public bool DisableScreenShakes { get; set; }
[Label("StealthInvisibility")]
[Label("$Mods.CalamityMod.Config.EntryTitle.Screenshake")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables players gradually turning invisible as their Rogue Stealth increases.\nThis effect is visually similar to Shroomite armor's stealth.")]
public bool StealthInvisbility { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.Screenshake")]
public bool Screenshake { get; set; }
[Label("ShopAlert")]
[Label("$Mods.CalamityMod.Config.EntryTitle.StealthInvisibility")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Adds an icon that appears over Town NPCs when they have new items in their shops.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.StealthInvisibility")]
public bool StealthInvisibility { get; set; }
[Label("$Mods.CalamityMod.Config.EntryTitle.ShopNewAlert")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ShopNewAlert")]
public bool ShopNewAlert { get; set; }
#endregion
[Header("UI Changes")]
#region UI Changes
[Header("$Mods.CalamityMod.Config.SectionTitle.UI")]
[Label("BossHealthBar")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossHealthBarExtraInfo")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables Calamity's boss health bar in the bottom right corner of the screen.")]
public bool BossHealthBar { get; set; }
[Label("BossHealthBarExtra")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Adds extra info to the Calamity boss health bar.\nThis displays either the boss's exact health or number of remaining parts or segments.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossHealthBarExtraInfo")]
public bool BossHealthBarExtraInfo { get; set; }
[Label("DebuffDisplay")]
[Label("$Mods.CalamityMod.Config.EntryTitle.DebuffDisplay")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Adds an array of debuff icons above all bosses and minibosses.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.DebuffDisplay")]
public bool DebuffDisplay { get; set; }
[Label("CooldownDisplay")]
[Label("$Mods.CalamityMod.Config.EntryTitle.CooldownDisplay")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f,2f)]
[Range(0f, 2f)]
[DefaultValue(2f)]
[Increment(1f)]
[DrawTicks]
[Tooltip("Displays all the important cooldowns on your UI under your buffs and debuffs. Set this to 1 to have it display in a more compact way, and to 0 to entirely disable the UI")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.CooldownDisplay")]
public float CooldownDisplay { get; set; }
[Label("VanillaCooldownDisplay")]
[Label("$Mods.CalamityMod.Config.EntryTitle.VanillaCooldownDisplay")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Adds custom cooldown displays for Chaos State and Potion Sickness.\nThis doesn't remove them from your buff list, but can help with visibility nontheless")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.VanillaCooldownDisplay")]
public bool VanillaCooldownDisplay { get; set; }
[BackgroundColor(192, 54, 64, 192)]
[Label("MeterLock")]
[Label("$Mods.CalamityMod.Config.EntryTitle.MeterPosLock")]
[DefaultValue(true)]
[Tooltip("Prevents clicking on the Stealth, Charge, Rage, and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.MeterPosLock")]
public bool MeterPosLock { get; set; }
[Label("StealthMeter")]
[Label("$Mods.CalamityMod.Config.EntryTitle.StealthMeter")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables the Stealth Meter UI, which shows the player's current stealth level.\nThe Stealth Meter is always hidden if not wearing Rogue armor.")]
public bool StealthBar { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.StealthMeter")]
public bool StealthMeter { get; set; }
[Label("StealthMeterX")]
[Label("$Mods.CalamityMod.Config.EntryTitle.StealthMeterPosX")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 3840f)]
[DefaultValue(820f)]
[Tooltip("The X position of the Stealth Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Range(0f, 100f)]
[DefaultValue(StealthUI.DefaultStealthPosX)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.StealthMeterPosX")]
public float StealthMeterPosX { get; set; }
[Label("StealthMeterY")]
[Label("$Mods.CalamityMod.Config.EntryTitle.StealthMeterPosY")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 2160f)]
[DefaultValue(43f)]
[Tooltip("The Y position of the Stealth Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Range(0f, 100f)]
[DefaultValue(StealthUI.DefaultStealthPosY)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.StealthMeterPosY")]
public float StealthMeterPosY { get; set; }
[Label("ChargeMeter")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ChargeMeter")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables the Charge Meter UI, which shows the charge level of the player's currently held Arsenal item.\nThe Charge Meter is always hidden if not holding a chargable arsenal item.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ChargeMeter")]
public bool ChargeMeter { get; set; }
[Label("ChargeMeterX")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ChargeMeterPosX")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 3840f)]
[DefaultValue(950f)]
[Tooltip("The X position of the Charge Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Range(0f, 100f)]
[DefaultValue(ChargeMeterUI.DefaultChargePosX)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ChargeMeterPosX")]
public float ChargeMeterPosX { get; set; }
[Label("ChargeMeterY")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ChargeMeterPosY")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 2160f)]
[DefaultValue(43f)]
[Tooltip("The Y position of the Charge Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Range(0f, 100f)]
[DefaultValue(ChargeMeterUI.DefaultChargePosY)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ChargeMeterPosY")]
public float ChargeMeterPosY { get; set; }
[Label("SpeedrunTimer")]
[Label("$Mods.CalamityMod.Config.EntryTitle.SpeedrunTimer")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Enables a Speedrun Timer.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.SpeedrunTimer")]
public bool SpeedrunTimer { get; set; }
[Label("SpeedrunTimerX")]
[Label("$Mods.CalamityMod.Config.EntryTitle.SpeedrunTimerPosX")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(-800f, 800f)]
[DefaultValue(68f)]
[Tooltip("The X position of the Speedrun Timer.")]
[Range(0f, 100f)]
[DefaultValue(SpeedrunTimerUI.DefaultTimerPosX)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.SpeedrunTimerPosX")]
public float SpeedrunTimerPosX { get; set; }
[Label("SpeedrunTimerY")]
[Label("$Mods.CalamityMod.Config.EntryTitle.SpeedrunTimerPosY")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(16f, 1000f)]
[DefaultValue(16f)]
[Tooltip("The Y position of the Speedrun Timer.")]
[Range(0f, 100f)]
[DefaultValue(SpeedrunTimerUI.DefaultTimerPosY)]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.SpeedrunTimerPosY")]
public float SpeedrunTimerPosY { get; set; }
#endregion
[Header("General Gameplay Changes")]
#region General Gameplay Changes
[Header("$Mods.CalamityMod.Config.SectionTitle.Gameplay")]
[Label("EarlyHMRework")]
[Label("$Mods.CalamityMod.Config.EntryTitle.EarlyHardmodeProgressionRework")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Demon Altars no longer spawn ores and crimson/corruption blocks when broken.\n" +
"Wall of Flesh spawns Cobalt and Palladium ore on first kill.\n" +
"The first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill.\n" +
"The second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill.\n" +
"The third mech boss spawns Hallowed Ore on first kill")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.EarlyHardmodeProgressionRework")]
public bool EarlyHardmodeProgressionRework { get; set; }
[Label("Proficiency")]
[Label("$Mods.CalamityMod.Config.EntryTitle.Proficiency")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Enables the Proficiency system which allows the player to gain slight stat bonuses by persistently using one damage class.\nDisabling the system does not remove levels players already have, but disables their stat bonuses and prevents experience gain.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.Proficiency")]
public bool Proficiency { get; set; }
[Label("BossZen")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossZen")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("While a boss is alive, all players near a boss receive the Boss Effects buff, which drastically reduces enemy spawn rates.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossZen")]
public bool BossZen { get; set; }
[Label("NPCNightSpawn")]
[Label("$Mods.CalamityMod.Config.EntryTitle.TownNPCsSpawnAtNight")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Allows you to determine if town NPCs (including the Old Man) can spawn at night.")]
public bool CanTownNPCsSpawnAtNight { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.TownNPCsSpawnAtNight")]
public bool TownNPCsSpawnAtNight { get; set; }
private const int MinTownNPCSpawnMultiplier = 1;
private const int MaxTownNPCSpawnMultiplier = 10;
[Label("NPCExtraSpawn")]
[Label("$Mods.CalamityMod.Config.EntryTitle.TownNPCSpawnRateMultiplier")]
[BackgroundColor(192, 54, 64, 192)]
[Range(MinTownNPCSpawnMultiplier, MaxTownNPCSpawnMultiplier)]
[Increment(1)]
[DrawTicks]
[DefaultValue(MinTownNPCSpawnMultiplier)]
[Tooltip("Makes town NPCs spawn more quickly, the higher this value is.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.TownNPCSpawnRateMultiplier")]
public int TownNPCSpawnRateMultiplier { get; set; }
private const float MinBossHealthBoost = 0f;
private const float MaxBossHealthBoost = 900f;
[Label("BossHPBoost")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossHealthBoost")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(MinBossHealthBoost, MaxBossHealthBoost)]
[Increment(50f)]
[Increment(25f)]
[DrawTicks]
[DefaultValue(MinBossHealthBoost)]
[Tooltip("Globally boosts the health of all bosses.\nDoes not affect bosses that are already spawned.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossHealthBoost")]
public float BossHealthBoost { get; set; }
#endregion
[Header("Expert Mode Changes")]
#region Expert and Master Mode Changes
[Header("$Mods.CalamityMod.Config.SectionTitle.ExpertMaster")]
[Label("ExpertDebuffReduction")]
[Label("$Mods.CalamityMod.Config.EntryTitle.NerfExpertDebuffs")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("Disables Expert Mode doubling the duration of all debuffs inflicted on the player.\nCalamity is balanced with the assumption that this setting is enabled.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.NerfExpertDebuffs")]
public bool NerfExpertDebuffs { get; set; }
[Label("ChillWaterRework")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ChilledWaterRework")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
[Tooltip("When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled.")]
public bool ReworkChilledWater { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ChilledWaterRework")]
public bool ChilledWaterRework { get; set; }
[Label("ExpertSafeTowns")]
[Label("$Mods.CalamityMod.Config.EntryTitle.ForceTownSafety")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Counteracts Expert Mode allowing enemies to spawn near towns by vastly decreasing spawn rates.\nThis can have unintended side effects such as making critters difficult to find.")]
public bool DisableExpertTownSpawns { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ForceTownSafety")]
public bool ForceTownSafety { get; set; }
#endregion
[Header("Revengeance Mode Changes")]
#region Revengeance Mode Changes
[Header("$Mods.CalamityMod.Config.SectionTitle.Revengeance")]
private const float MinMeterShake = 0f;
private const float MaxMeterShake = 4f;
[Label("RipperBarShake")]
[Label("$Mods.CalamityMod.Config.EntryTitle.RipperMeterShake")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(MinMeterShake, MaxMeterShake)]
[Increment(1f)]
[DrawTicks]
[DefaultValue(2f)]
[Tooltip("How much the Rage and Adrenaline Meters shake while in use.\nSet to zero to disable the shaking entirely.")]
public float MeterShake { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.RipperMeterShake")]
public float RipperMeterShake { get; set; }
[Label("RageX")]
[Label("$Mods.CalamityMod.Config.EntryTitle.RageMeterPosX")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 3840f)]
[Range(0f, 100f)]
[DefaultValue(RipperUI.DefaultRagePosX)]
[Tooltip("The X position of the Rage Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.RageMeterPosX")]
public float RageMeterPosX { get; set; }
[Label("RageY")]
[Label("$Mods.CalamityMod.Config.EntryTitle.RageMeterPosY")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 2160f)]
[Range(0f, 100f)]
[DefaultValue(RipperUI.DefaultRagePosY)]
[Tooltip("The Y position of the Rage Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.RageMeterPosY")]
public float RageMeterPosY { get; set; }
[Label("AdrenalineX")]
[Label("$Mods.CalamityMod.Config.EntryTitle.AdrenalineMeterPosX")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 3840f)]
[Range(0f, 100f)]
[DefaultValue(RipperUI.DefaultAdrenPosX)]
[Tooltip("The X position of the Adrenaline Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.AdrenalineMeterPosX")]
public float AdrenalineMeterPosX { get; set; }
[Label("AdrenalineY")]
[Label("$Mods.CalamityMod.Config.EntryTitle.AdrenalineMeterPosY")]
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 2160f)]
[Range(0f, 100f)]
[DefaultValue(RipperUI.DefaultAdrenPosY)]
[Tooltip("The Y position of the Adrenaline Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.AdrenalineMeterPosY")]
public float AdrenalineMeterPosY { get; set; }
#endregion
[Header("Boss Rush Curses")]
#region Boss Rush Curses
[Header("$Mods.CalamityMod.Config.SectionTitle.BossRushCurses")]
[Label("BRCurseAccessory")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossRushRegenCurse")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Limits the player to five accessories during the Boss Rush.")]
public bool BossRushAccessoryCurse { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushRegenCurse")]
public bool BossRushRegenCurse { get; set; }
[Label("BRCurseHealth")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossRushDashCurse")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Disables all health regeneration during the Boss Rush.")]
public bool BossRushHealthCurse { get; set; }
[Label("BRCurseDash")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("Disables all dashes during the Boss Rush.")]
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushDashCurse")]
public bool BossRushDashCurse { get; set; }
[Label("BRCurseImmunity")]
[Label("$Mods.CalamityMod.Config.EntryTitle.BossRushIFrameCurse")]
[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
[Tooltip("During the Boss Rush, being hit twice within three seconds will cause instant death.\nThis effect ignores revives.")]
public bool BossRushImmunityFrameCurse { get; set; }
[Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushIFrameCurse")]
public bool BossRushIFrameCurse { get; set; }
#endregion
public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message) => true;
public static void LoadConfigLabels(Mod instance)
#region Dynamic Localization (Item Icon Injection)
// Because it is impossible to know the item IDs of Calamity items until runtime,
// and we have many config titles which use embedded Calamity items,
// we need to dynamically declare those items and inject them as dynamic localization.
internal static void RegisterDynamicLocalization()
{
string[][] _configLabels = new[]
static string EmbedItem(int itemID, string suffix = "") => $"[i:{itemID}] {suffix}";
var configLabelItemEmbeds = new KeyValuePair<string, int>[]
{
new [] { "Afterimages", ItemID.SteampunkGoggles.ToString(), "Afterimages" },
new [] { "MaxParticles", ItemID.FragmentStardust.ToString(), "Maximum particles" },
new [] { "ScreenshakeOff", instance.Find<ModItem>("WavePounder").Type.ToString(), "Disable Screenshakes" },
new [] { "StealthInvisibility", instance.Find<ModItem>("StealthHairDye").Type.ToString(), "Stealth Invisibility" },
new [] { "ShopAlert", ItemID.GoldChest.ToString(), "New Shop Inventory Alert" },
new("Afterimages", ItemID.SteampunkGoggles),
new("Screenshake", ModContent.ItemType<WavePounder>()),
new("ParticleLimit", ItemID.FragmentStardust),
new("StealthInvisibility", ModContent.ItemType<StealthHairDye>()),
new("ShopNewAlert", ItemID.GoldChest),
new [] { "BossHealthBar", instance.Find<ModItem>("BloodOrange").Type.ToString(), "Boss Health Bars" },
new [] { "BossHealthBarExtra", instance.Find<ModItem>("EncryptedSchematicPlanetoid").Type.ToString(), "Boss Health Bar Extra Info" },
new [] { "DebuffDisplay", ItemID.FlaskofIchor.ToString(), "Boss and Miniboss Debuff Display" },
new [] { "CooldownDisplay", instance.Find<ModItem>("NebulousCore").Type.ToString(), "Cooldown Display" },
new [] { "VanillaCooldownDisplay", ItemID.HealingPotion.ToString(), "Vanilla Cooldowns Display" },
new [] { "MeterLock", ItemID.GemLockTopaz.ToString(), "Lock Meter Positions" },
new("BossHealthBarExtraInfo", ModContent.ItemType<EncryptedSchematicPlanetoid>()),
new("DebuffDisplay", ItemID.FlaskofIchor),
new("CooldownDisplay", ModContent.ItemType<NebulousCore>()),
new("VanillaCooldownDisplay", ItemID.HealingPotion),
new("MeterPosLock", ItemID.GemLockTopaz),
new [] { "StealthMeter", instance.Find<ModItem>("EclipseMirror").Type.ToString(), "Stealth Meter" },
new [] { "StealthMeterX", ItemID.LaserRuler.ToString(), "Stealth Meter X Position" },
new [] { "StealthMeterY", ItemID.LaserRuler.ToString(), "Stealth Meter Y Position" },
new("StealthMeter", ModContent.ItemType<EclipseMirror>()),
new("StealthMeterPosX", ItemID.LaserRuler),
new("StealthMeterPosY", ItemID.LaserRuler),
new [] { "ChargeMeter", instance.Find<ModItem>("PowerCell").Type.ToString(), "Charge Meter" },
new [] { "ChargeMeterX", ItemID.LaserRuler.ToString(), "Charge Meter X Position" },
new [] { "ChargeMeterY", ItemID.LaserRuler.ToString(), "Charge Meter Y Position" },
new("ChargeMeter", ModContent.ItemType<PowerCell>()),
new("ChargeMeterPosX", ItemID.LaserRuler),
new("ChargeMeterPosY", ItemID.LaserRuler),
new [] { "SpeedrunTimer", ItemID.Stopwatch.ToString(), "Speedrun Timer" },
new [] { "SpeedrunTimerX", ItemID.LaserRuler.ToString(), "Speedrun Timer X Position" },
new [] { "SpeedrunTimerY", ItemID.LaserRuler.ToString(), "Speedrun Timer Y Position" },
new("SpeedrunTimer", ItemID.Stopwatch),
new("SpeedrunTimerPosX", ItemID.LaserRuler),
new("SpeedrunTimerPosY", ItemID.LaserRuler),
new [] { "EarlyHMRework", ItemID.Pwnhammer.ToString(), "Early Hardmode Progression Rework" },
new [] { "Proficiency", instance.Find<ModItem>("MagicLevelMeter").Type.ToString(), "Proficiency" },
new [] { "BossZen", instance.Find<ModItem>("ZenPotion").Type.ToString(), "Boss Zen" },
new [] { "NPCNightSpawn", ItemID.ClothierVoodooDoll.ToString(), "Let Town NPCs spawn at night" },
new [] { "NPCExtraSpawn", ItemID.GuideVoodooDoll.ToString(), "Town NPC Spawn Rate Multiplier" },
new [] { "BossHPBoost", ItemID.LifeCrystal.ToString(), "Boss Health Percentage Boost" },
new("EarlyHardmodeProgressionRework", ItemID.Pwnhammer),
new("Proficiency", ModContent.ItemType<MagicLevelMeter>()),
new("BossZen", ModContent.ItemType<ZenPotion>()),
new("TownNPCsSpawnAtNight", ItemID.ClothierVoodooDoll),
new("TownNPCSpawnRateMultiplier", ItemID.GuideVoodooDoll),
new("BossHealthBoost", ItemID.LifeCrystal),
new [] { "ExpertDebuffReduction", ItemID.AnkhCharm.ToString(), "Reduce Expert Debuff Durations" },
new [] { "ChillWaterRework", ItemID.ArcticDivingGear.ToString(), "Rework Chilled Water" },
new [] { "ExpertSafeTowns", ItemID.Sunflower.ToString(), "Disable Expert Enemy Spawns in Towns" },
new [] { "RipperBarShake", instance.Find<ModItem>("Revenge").Type.ToString(), "Rage and Adrenaline Meter Shake" },
new [] { "RageX", ItemID.LaserRuler.ToString(), "Rage Meter X Position" },
new [] { "RageY", ItemID.LaserRuler.ToString(), "Rage Meter Y Position" },
new [] { "AdrenalineX", ItemID.LaserRuler.ToString(), "Adrenaline Meter X Position" },
new [] { "AdrenalineY", ItemID.LaserRuler.ToString(), "Adrenaline Meter Y Position" },
new("NerfExpertDebuffs", ItemID.AnkhCharm),
new("ChilledWaterRework", ItemID.ArcticDivingGear),
new("ForceTownSafety", ItemID.Sunflower),
new [] { "BRCurseAccessory", ItemID.Shackle.ToString(), "Accessory Curse" },
new [] { "BRCurseHealth", ItemID.Shackle.ToString(), "Health Curse" },
new [] { "BRCurseDash", ItemID.Shackle.ToString(), "Dash Curse" },
new [] { "BRCurseImmunity", ItemID.Shackle.ToString(), "Immunity Frame Curse" }
new("RipperMeterShake", ModContent.ItemType<Revenge>()),
new("RageMeterPosX", ItemID.LaserRuler),
new("RageMeterPosY", ItemID.LaserRuler),
new("AdrenalineMeterPosX", ItemID.LaserRuler),
new("AdrenalineMeterPosY", ItemID.LaserRuler),
new("BossRushRegenCurse", ItemID.Shackle),
new("BossRushDashCurse", ItemID.Shackle),
new("BossRushIFrameCurse", ItemID.Shackle),
};
foreach (string[] label in _configLabels)
// TODO -- Next month's TML Stable will have this function be public
MethodInfo getTrans = typeof(LocalizationLoader).GetMethod("GetOrCreateTranslation", BindingFlags.Static | BindingFlags.NonPublic, new[] { typeof(string), typeof(bool) });
foreach (KeyValuePair<string, int> kv in configLabelItemEmbeds)
{
ModTranslation text = LocalizationLoader.CreateTranslation(label[0]);
text.SetDefault($"[i:" + label[1] + "] "+ label[2]);
LocalizationLoader.AddTranslation(text);
string localizationKey = $"Mods.CalamityMod.Config.EntryTitle.{kv.Key}";
ModTranslation trans = getTrans.Invoke(null, new object[] { localizationKey, true }) as ModTranslation;
var culture = Language.ActiveCulture;
trans.AddTranslation(culture, EmbedItem(kv.Value, trans.GetTranslation(culture)));
}
}
#endregion
}
}
+5 -2
View File
@@ -75,7 +75,6 @@ namespace CalamityMod
public class CalamityMod : Mod
{
// CONSIDER -- I have been advised by Jopo that Mods should never contain static variables
// TODO -- 1.4 fixes the crit reforge price calculation bug, so GetWeaponCrit everywhere can go.
// Boss Spawners
public static int ghostKillCount = 0;
@@ -207,7 +206,7 @@ namespace CalamityMod
SetupBossKillTimes();
SetupBossVelocityScalingValues();
CalamityLocalization.AddLocalizations();
CalamityConfig.LoadConfigLabels(ModContent.GetInstance<CalamityMod>());
CalamityConfig.RegisterDynamicLocalization();
SchematicManager.Load();
CustomLavaManagement.Load();
Attunement.Load();
@@ -268,6 +267,8 @@ namespace CalamityMod
});
RipperUI.Load();
StealthUI.Load();
ChargeMeterUI.Load();
AstralArcanumUI.Load(this);
Apollo.LoadHeadIcons();
@@ -345,6 +346,8 @@ namespace CalamityMod
});
RipperUI.Unload();
StealthUI.Unload();
ChargeMeterUI.Unload();
AstralArcanumUI.Unload();
if (!Main.dedServ)
+1 -1
View File
@@ -43,7 +43,7 @@ float4 CalculateDiffusion(float4 sampleColor : TEXCOORD, float2 coords : TEXCOOR
float step = 1.0 / size;
float4 currentValue = 0;
float4 previousValue = tex2D(previousStates, coords);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 2; i++)
{
float4 leftState = tex2D(nextStates, clamp(coords - float2(step, 0), step, 1 - step));
float4 rightState = tex2D(nextStates, clamp(coords + float2(step, 0), step, 1 - step));
Binary file not shown.
+1 -1
View File
@@ -50,7 +50,7 @@ namespace CalamityMod.FluidSimulation
public const float DeltaTime = 0.016666f;
public const int GaussSeidelIterations = 3;
public const int GaussSeidelIterations = 2;
internal static BasicEffect basicShader = null;
+4 -2
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
@@ -15,7 +16,7 @@ namespace CalamityMod.FluidSimulation
return field;
}
public static void AdjustSizeRelativeToGraphicsQuality(ref int size, int min = 325, int max = 725)
public static void AdjustSizeRelativeToGraphicsQuality(ref int size, int min = 245, int max = 530)
{
float graphicsQuality = MathHelper.Clamp(Main.gfxQuality, 0f, 1f);
@@ -23,6 +24,7 @@ namespace CalamityMod.FluidSimulation
// require the creation of a new field altogether.
if (Main.qaStyle == 0)
graphicsQuality = 0.5f;
graphicsQuality = (float)Math.Pow(graphicsQuality, 2.3);
int lowerBound = (int)MathHelper.Lerp(size, min, 1f - graphicsQuality);
int upperBound = (int)MathHelper.Lerp(size, max, graphicsQuality);
+1 -1
View File
@@ -253,7 +253,7 @@ namespace CalamityMod.ILEditing
{
// A cached delegate is used here instead of direct reflection for performance reasons
// since UpdateTime is called every frame.
if (Main.dayTime || CalamityConfig.Instance.CanTownNPCsSpawnAtNight)
if (Main.dayTime || CalamityConfig.Instance.TownNPCsSpawnAtNight)
VanillaSpawnTownNPCs();
});
+1 -1
View File
@@ -102,7 +102,7 @@ namespace CalamityMod.ILEditing
#region Prevention of Slime Rain Spawns When Near Bosses
private static void PreventBossSlimeRainSpawns(On.Terraria.NPC.orig_SlimeRainSpawns orig, int plr)
{
if (!Main.player[plr].Calamity().bossZen)
if (!Main.player[plr].Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen)
orig(plr);
}
#endregion Prevention of Slime Rain Spawns When Near Bosses
@@ -65,6 +65,8 @@ namespace CalamityMod.Items.Weapons.Summon
return;
int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType<MechwormHead>(), damage, knockback, owner.whoAmI, 0f, 0f);
if (Main.projectile.IndexInRange(curr))
Main.projectile[curr].originalDamage = damage;
curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType<MechwormBody>(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f);
if (Main.projectile.IndexInRange(curr))
Main.projectile[curr].originalDamage = damage;
+97 -2
View File
@@ -2,10 +2,105 @@
{
CalamityMod:
{
Config:
{
MainTitle: "Main Config",
SectionTitle:
{
"BossRushCurses": "Boss Rush Curses",
"ExpertMaster": "Expert and Master Mode Changes",
"Gameplay": "General Gameplay Changes",
"Graphics": "Graphics Changes",
"Revengeance": "Revengeance Mode Changes",
"UI": "UI Changes",
}
EntryTitle:
{
"AdrenalineMeterPosX": "Adrenaline Meter X Position",
"AdrenalineMeterPosY": "Adrenaline Meter Y Position",
"Afterimages": "Afterimages",
"BossHealthBarExtraInfo": "Boss Health Bar Extra Info",
"BossHealthBoost": "Boss Health Boost Percentage",
"BossRushDashCurse": "Dashes",
"BossRushIFrameCurse": "Immunity Frames",
"BossRushRegenCurse": "Regeneration",
"BossZen": "Bosses Drastically Reduce Spawn Rates",
"ChargeMeter": "Display Charge Meter",
"ChargeMeterPosX": "Charge Meter X Position",
"ChargeMeterPosY": "Charge Meter Y Position",
"ChilledWaterRework": "Chilled Water Rework",
"CooldownDisplay": "Cooldown Rack Display Mode",
"DebuffDisplay": "Display Enemy Debuffs",
"EarlyHardmodeProgressionRework": "Early Hardmode Progression Rework",
"ForceTownSafety": "Force Town Safety",
"MeterPosLock": "Lock Meter Positions",
"NerfExpertDebuffs": "Remove Increased Debuff Duration",
"ParticleLimit": "Max Particle Limit",
"Proficiency": "Proficiency",
"RageMeterPosX": "Rage Meter X Position",
"RageMeterPosY": "Rage Meter Y Position",
"RipperMeterShake": "Rage and Adrenaline Meter Shake",
"Screenshake": "Screenshake",
"ShopNewAlert": "New Shop Inventory Alerts",
"SpeedrunTimer": "Display Speedrun Timer",
"SpeedrunTimerPosX": "Speedrun Timer X Position",
"SpeedrunTimerPosY": "Speedrun Timer Y Position",
"StealthInvisibility": "Stealth Invisibility",
"StealthMeter": "Display Stealth Meter",
"StealthMeterPosX": "Stealth Meter X Position",
"StealthMeterPosY": "Stealth Meter Y Position",
"TownNPCSpawnRateMultiplier": "Town NPC Spawn Rate Multiplier",
"TownNPCsSpawnAtNight": "Town NPCs Spawn at Night",
"VanillaCooldownDisplay": "Display Vanilla Cooldowns",
}
EntryTooltip:
{
"AdrenalineMeterPosX": "The X position of the Adrenaline Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"AdrenalineMeterPosY": "The Y position of the Adrenaline Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"Afterimages": "Enables rendering afterimages for Calamity NPCs, projectiles, etc.\nDisable to improve performance.",
"BossHealthBarExtraInfo": "Adds extra info to Calamity's boss health bar.\nThis displays either the boss's exact health or number of remaining parts or segments.",
"BossHealthBoost": "Globally boosts the health of all bosses by the specified percentage.\nThis stacks with multiplayer boss health boosts.\nDoes not affect bosses that are already spawned.",
"BossRushDashCurse": "Disables all dashes during the Boss Rush.",
"BossRushIFrameCurse": "During the Boss Rush, being hit twice within three seconds will cause instant death.\nThis effect ignores revives.",
"BossRushRegenCurse": "Disables all health regeneration during the Boss Rush.",
"BossZen": "All living bosses will drastically reduce the spawn rates of regular enemies.\nThis also prevents Slime Rain from occurring while a boss is alive.",
"ChargeMeter": "Enables the Charge Meter UI, which displays the current charge of the player's held weapon.\nThe Charge Meter is always hidden if not holding a weapon which requires charge.",
"ChargeMeterPosX": "The X position of the Charge Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"ChargeMeterPosY": "The Y position of the Charge Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"ChilledWaterRework": "When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled.",
"CooldownDisplay": "Adds the Cooldown Rack which displays all important cooldowns right underneath buffs and debuffs.\nSet this to 1 to display the Cooldown Rack in compact mode, and to 0 to hide it entirely.",
"DebuffDisplay": "Adds an array of debuff icons above all bosses and minibosses.",
"EarlyHardmodeProgressionRework": "Demon Altars no longer spawn ores and crimson/corruption blocks when broken.\nWall of Flesh spawns Cobalt and Palladium ore on first kill.\nThe first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill.\nThe second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill.\nThe third mech boss spawns Hallowed Ore on first kill",
"ForceTownSafety": "Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates.\nThis can have unintended side effects such as making critters difficult to find.",
"MeterPosLock": "Prevents clicking on the Stealth, Charge, Rage, and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.",
"NerfExpertDebuffs": "Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player.\nCalamity is balanced around this setting being enabled.",
"ParticleLimit": "Sets the maximum of particle effects that can exist at once.\nParticles are separate from dust and gores.\nTurn down to improve performance.",
"Proficiency": "Enables the Proficiency system which allows the player to gain slight stat bonuses by persistently using one damage class.\nDisabling the system does not remove levels players already have, but disables their stat bonuses and prevents experience gain.",
"RageMeterPosX": "The X position of the Rage Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"RageMeterPosY": "The Y position of the Rage Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"RipperMeterShake": "How much the Rage and Adrenaline Meters shake while in use.\nSet to zero to disable the shaking entirely.",
"Screenshake": "Enable or disable all screen-shaking effects.",
"ShopNewAlert": "Adds an icon that appears over Town NPCs when they have new items in their shops.",
"SpeedrunTimer": "Enables an in-game speedrun timer which shows in-game time down to the millisecond.\nA second line displays the time of your most recent boss kill.\nThe time is tracked per player and only counts time while loaded into a world.",
"SpeedrunTimerPosX": "The X position of the Speedrun Timer, measured as a % of your screen width.\nThis must be set manually and cannot be dragged around.",
"SpeedrunTimerPosY": "The Y position of the Speedrun Timer, measured as a % of your screen height.\nThis must be set manually and cannot be dragged around.",
"StealthInvisibility": "Enables players gradually turning invisible as their Rogue Stealth increases.\nThis effect is visually similar to Shroomite armor's stealth.",
"StealthMeter": "Enables the Stealth Meter UI, which shows the player's current stealth level.\nThe Stealth Meter is always hidden if not wearing Rogue armor.",
"StealthMeterPosX": "The X position of the Stealth Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"StealthMeterPosY": "The Y position of the Stealth Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.",
"TownNPCSpawnRateMultiplier": "Directly multiply the rate at which town NPCs spawn and respawn.\nThis reduces waiting times if a boss or event wipes your whole town.",
"TownNPCsSpawnAtNight": "When enabled, town NPCs can spawn and respawn at night.\nThis includes the Old Man.",
"VanillaCooldownDisplay": "Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack.\nThis doesn't remove them from your buff list, but can help with visibility nontheless",
}
}
DamageClassName:
{
"RogueDamageClass": "rogue damage",
"AverageDamageClass": "average damage",
RogueDamageClass: "rogue damage",
AverageDamageClass: "average damage",
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

+5 -4
View File
@@ -52,9 +52,10 @@ namespace CalamityMod.NPCs.AcidRain
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Scale = 0.425f,
PortraitScale = 0.9f
PortraitScale = 0.9f,
SpriteDirection = 1
};
value.Position.X -= 10f;
value.Position.X += 10f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
@@ -88,8 +89,8 @@ namespace CalamityMod.NPCs.AcidRain
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.AcidRainTier3,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Sharks are perhaps one of the most resilient and well-adapted species in our planet’s history. It is no surprise that one of these apex predators has come to thrive in these seas.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Sharks are perhaps one of the most resilient and well-adapted species in our planet’s history. It is no surprise that one of these apex predators has come to thrive in these seas.")
});
}
+4 -3
View File
@@ -79,8 +79,9 @@ namespace CalamityMod.NPCs.AcidRain
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Scale = 0.4f,
Direction = 1
};
value.Position.X -= 10f;
value.Position.X += 10f;
value.Position.Y += 50f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
@@ -115,8 +116,8 @@ namespace CalamityMod.NPCs.AcidRain
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.AcidRainTier3,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Perhaps it was once just a simple crab or perhaps there are plenty of others like it, lurking in the depths. Any answer is sure to make you want to never set foot in the sulphurous sea again.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Perhaps it was once just a simple crab or perhaps there are plenty of others like it, lurking in the depths. Any answer is sure to make you want to never set foot in the sulphurous sea again.")
});
}
+2 -2
View File
@@ -168,8 +168,8 @@ namespace CalamityMod.NPCs.AcidRain
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<SulfuricScale>(), 2, 1, 3);
npcLoot.AddIf(() => !DownedBossSystem.downedAquaticScourge, ModContent.ItemType<CausticCroakerStaff>(), 20, 1, 3);
npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType<CausticCroakerStaff>(), 100, 1, 3);
npcLoot.AddIf(() => !DownedBossSystem.downedAquaticScourge, ModContent.ItemType<CausticCroakerStaff>(), 20);
npcLoot.AddIf(() => DownedBossSystem.downedAquaticScourge, ModContent.ItemType<CausticCroakerStaff>(), 100);
}
public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
+2 -2
View File
@@ -59,8 +59,8 @@ namespace CalamityMod.NPCs.Calamitas
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Guardians were brought together by Calamitas to shield its body from blows. It is possible that they are soul slurpers empowered and enslaved by a different brand of magic than brimstone.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Guardians were brought together by Calamitas to shield its body from blows. It is possible that they are soul slurpers empowered and enslaved by a different brand of magic than brimstone.")
});
}
+3 -3
View File
@@ -604,7 +604,7 @@ namespace CalamityMod.NPCs
}
Item heldItem = Main.player[owner].ActiveItem();
int totalDamage = (int)(150 * Main.player[owner].GetDamage<SummonDamageClass>().Base);
int totalDamage = (int)Main.player[owner].GetDamage<SummonDamageClass>().ApplyTo(150f);
bool forbidden = Main.player[owner].head == ArmorIDs.Head.AncientBattleArmor && Main.player[owner].body == ArmorIDs.Body.AncientBattleArmor && Main.player[owner].legs == ArmorIDs.Legs.AncientBattleArmor;
bool reducedNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass<MagicDamageClass>());
@@ -4608,12 +4608,12 @@ namespace CalamityMod.NPCs
spawnRate = (int)(spawnRate * 1.4);
maxSpawns = (int)(maxSpawns * 0.4f);
}
if (player.Calamity().zen || (CalamityConfig.Instance.DisableExpertTownSpawns && player.townNPCs > 1f && Main.expertMode))
if (player.Calamity().zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode))
{
spawnRate = (int)(spawnRate * 2.5);
maxSpawns = (int)(maxSpawns * 0.3f);
}
if (player.Calamity().bossZen && CalamityConfig.Instance.BossZen)
if (player.Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen)
{
spawnRate *= 5;
maxSpawns = (int)(maxSpawns * 0.001f);
+1
View File
@@ -182,6 +182,7 @@ namespace CalamityMod.NPCs
"Ortho", // <@!264984390910738432> (Worcuus#5225)
"Chris Tallballs", // <@!770211589076418571> (Bewearium#1111)
"Syethas", // <@!325413275066171393> (CosmicStarIight#4430)
"Nextdoor Psycho", // <@!173261518572486656> (⋈-NextdoorPsycho-⋈#0001)
};
// The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies.
+27 -17
View File
@@ -15,6 +15,13 @@ namespace CalamityMod.NPCs.Crags
{
DisplayName.SetDefault("Heat Spirit");
Main.npcFrameCount[NPC.type] = 4;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = -1,
PortraitPositionYOverride = -16f
};
value.Position.X += 8f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -41,8 +48,8 @@ namespace CalamityMod.NPCs.Crags
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Crags,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A human spirit, its mind lost to the blazing orange fires of its dwelling. It seeks out and attempts to eliminate any source of moisture it can detect entering the hellscape.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A human spirit, its mind lost to the blazing orange fires of its dwelling. It seeks out and attempts to eliminate any source of moisture it can detect entering the hellscape.")
});
}
@@ -53,23 +60,26 @@ namespace CalamityMod.NPCs.Crags
public override void FindFrame(int frameHeight)
{
if (NPC.velocity.X < 0f)
if (!NPC.IsABestiaryIconDummy)
{
NPC.direction = -1;
if (NPC.velocity.X < 0f)
{
NPC.direction = -1;
}
else
{
NPC.direction = 1;
}
if (NPC.direction == 1)
{
NPC.spriteDirection = 1;
}
if (NPC.direction == -1)
{
NPC.spriteDirection = -1;
}
NPC.rotation = (float)Math.Atan2((double)(NPC.velocity.Y * (float)NPC.direction), (double)(NPC.velocity.X * (float)NPC.direction));
}
else
{
NPC.direction = 1;
}
if (NPC.direction == 1)
{
NPC.spriteDirection = 1;
}
if (NPC.direction == -1)
{
NPC.spriteDirection = -1;
}
NPC.rotation = (float)Math.Atan2((double)(NPC.velocity.Y * (float)NPC.direction), (double)(NPC.velocity.X * (float)NPC.direction));
NPC.frameCounter += 0.15f;
NPC.frameCounter %= Main.npcFrameCount[NPC.type];
int frame = (int)NPC.frameCounter;
+2 -1
View File
@@ -78,9 +78,10 @@ namespace CalamityMod.NPCs.ExoMechs
Main.npcFrameCount[NPC.type] = 12;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
PortraitPositionYOverride = 30f,
PortraitPositionYOverride = 40f,
Scale = 0.7f,
PortraitScale = 0.85f,
SpriteDirection = 1
};
value.Position.Y += 45f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
+5 -1
View File
@@ -52,7 +52,11 @@ namespace CalamityMod.NPCs.Leviathan
DisplayName.SetDefault("Anahita");
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Scale = 0.5f
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
+24 -12
View File
@@ -14,7 +14,14 @@ namespace CalamityMod.NPCs.NormalNPCs
{
DisplayName.SetDefault("Aurora Spirit");
Main.npcFrameCount[NPC.type] = 5;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = -1,
PortraitPositionYOverride = -20f
};
value.Position.X += 4f;
value.Position.Y -= 4f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -41,8 +48,8 @@ namespace CalamityMod.NPCs.NormalNPCs
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("The souls of those who passed on in the heart of a blizzard. They now seek out others to freeze to death, to die as they did.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("The souls of those who passed on in the heart of a blizzard. They now seek out others to freeze to death, to die as they did.")
});
}
@@ -55,15 +62,20 @@ namespace CalamityMod.NPCs.NormalNPCs
return;
num1 = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type];
}
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
if (NPC.direction == 1)
NPC.spriteDirection = 1;
if (NPC.direction == -1)
NPC.spriteDirection = -1;
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y * (double)NPC.direction, (double)NPC.velocity.X * (double)NPC.direction);
if (!NPC.IsABestiaryIconDummy)
{
if (NPC.velocity.X < 0f)
NPC.direction = -1;
else
NPC.direction = 1;
if (NPC.direction == 1)
NPC.spriteDirection = 1;
if (NPC.direction == -1)
NPC.spriteDirection = -1;
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y * (double)NPC.direction, (double)NPC.velocity.X * (double)NPC.direction);
}
NPC.frameCounter++;
if (NPC.frameCounter > 4)
{
+7 -3
View File
@@ -16,7 +16,11 @@ namespace CalamityMod.NPCs.NormalNPCs
{
DisplayName.SetDefault("Mantis Shrimp");
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -45,8 +49,8 @@ namespace CalamityMod.NPCs.NormalNPCs
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Should it land a blow with its rounded front claws, it will tear your flesh and shatter your bones. Needless to say, avoid this at all costs.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Should it land a blow with its rounded front claws, it will tear your flesh and shatter your bones. Needless to say, avoid this at all costs.")
});
}
+24 -15
View File
@@ -16,6 +16,11 @@ namespace CalamityMod.NPCs.NormalNPCs
Main.npcFrameCount[NPC.type] = 5;
Main.npcCatchable[NPC.type] = true;
NPCID.Sets.CountsAsCritter[NPC.type] = true;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -45,8 +50,8 @@ namespace CalamityMod.NPCs.NormalNPCs
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime,
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Pigs are greedy little beasts. If they come across anything they could barely fathom as food, they will scarf it down in a blink.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Pigs are greedy little beasts. If they come across anything they could barely fathom as food, they will scarf it down in a blink.")
});
}
@@ -63,21 +68,25 @@ namespace CalamityMod.NPCs.NormalNPCs
{
if (NPC.velocity.Y == 0f)
{
if (NPC.direction == 1)
if (!NPC.IsABestiaryIconDummy)
{
NPC.spriteDirection = -1;
if (NPC.direction == 1)
{
NPC.spriteDirection = -1;
}
if (NPC.direction == -1)
{
NPC.spriteDirection = 1;
}
if (NPC.velocity.X == 0f)
{
NPC.frame.Y = 0;
NPC.frameCounter = 0.0;
return;
}
}
if (NPC.direction == -1)
{
NPC.spriteDirection = 1;
}
if (NPC.velocity.X == 0f)
{
NPC.frame.Y = 0;
NPC.frameCounter = 0.0;
return;
}
NPC.frameCounter += (double)(Math.Abs(NPC.velocity.X) * 0.25f);
NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.25f;
NPC.frameCounter += 1.0;
if (NPC.frameCounter > 12.0)
{
+9 -3
View File
@@ -41,7 +41,13 @@ namespace CalamityMod.NPCs.OldDuke
Main.npcFrameCount[NPC.type] = 7;
NPCID.Sets.TrailingMode[NPC.type] = 1;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1,
Scale = 0.45f
};
value.Position.X += 14f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -78,8 +84,8 @@ namespace CalamityMod.NPCs.OldDuke
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SulphurousSea,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Despite appearing old and decrepit, it clings to life. It does not seem native to the polluted sea, yet it has taken its place as its apex predator.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Despite appearing old and decrepit, it clings to life. It does not seem native to the polluted sea, yet it has taken its place as its apex predator.")
});
}
@@ -61,11 +61,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
{
Scale = 0.4f,
PortraitScale = 0.5f,
PortraitPositionXOverride = -80f,
PortraitPositionXOverride = -56f,
PortraitPositionYOverride = -8f,
SpriteDirection = 1
SpriteDirection = -1
};
value.Position.X -= 92f;
value.Position.X -= 48f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
@@ -101,8 +101,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Machinery and nanobots have nearly entirely eaten away at the form of this Queen Bee. One wonders if it would simply be more efficient to create one from the ground up.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Machinery and nanobots have nearly entirely eaten away at the form of this Queen Bee. One wonders if it would simply be more efficient to create one from the ground up.")
});
}
+8 -3
View File
@@ -21,6 +21,11 @@ namespace CalamityMod.NPCs.SulphurousSea
{
DisplayName.SetDefault("Anthozoan Crab");
Main.npcFrameCount[NPC.type] = 16;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -47,10 +52,10 @@ namespace CalamityMod.NPCs.SulphurousSea
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SulphurousSea,
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SulphurousSea,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A crab that has placed upon its back, a sturdy structure of stone. It is quite strong and displays this extraordinary strength by hurling boulders at those who encroach on its territory.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A crab that has placed upon its back, a sturdy structure of stone. It is quite strong and displays this extraordinary strength by hurling boulders at those who encroach on its territory.")
});
}
+8 -3
View File
@@ -14,6 +14,11 @@ namespace CalamityMod.NPCs.SulphurousSea
{
DisplayName.SetDefault("Gnasher");
Main.npcFrameCount[NPC.type] = 5;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -42,10 +47,10 @@ namespace CalamityMod.NPCs.SulphurousSea
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SulphurousSea,
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SulphurousSea,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A turtle that has had its shell encrusted by the filth of the sulphurous sea. For an animal of its size, its jaws have a nearly unmatched biting strength.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A turtle that has had its shell encrusted by the filth of the sulphurous sea. For an animal of its size, its jaws have a nearly unmatched biting strength.")
});
}
+8 -3
View File
@@ -19,6 +19,11 @@ namespace CalamityMod.NPCs.SunkenSea
{
DisplayName.SetDefault("Clam");
Main.npcFrameCount[NPC.type] = 5;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
public override void SetDefaults()
@@ -49,10 +54,10 @@ namespace CalamityMod.NPCs.SunkenSea
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SunkenSea,
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SunkenSea,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Sluggish mollusks filter what they can from the brackish water. Their shells are as hard as stone but contain delicate, succulent flesh.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Sluggish mollusks filter what they can from the brackish water. Their shells are as hard as stone but contain delicate, succulent flesh.")
});
}
+6 -4
View File
@@ -31,10 +31,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Scale = 0.5f,
Scale = 0.6f,
PortraitPositionXOverride = -5f,
SpriteDirection = 1
};
value.Position.Y += 10f;
value.Position.X += 12f;
value.Position.Y -= 4f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
@@ -65,8 +67,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas
//We'll probably want a custom background SCal her like ML has.
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SCal,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Incomplete, ghoulish skulls, their forms are limited but their devotion boundless. It’s likely each yearns for a soul of their own to be complete, whether it’s given by Calamitas or ripped from the foe they kill.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("Incomplete, ghoulish skulls, their forms are limited but their devotion boundless. It’s likely each yearns for a soul of their own to be complete, whether it’s given by Calamitas or ripped from the foe they kill.")
});
}
+12 -3
View File
@@ -186,7 +186,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas
Main.npcFrameCount[NPC.type] = 21;
NPCID.Sets.TrailingMode[NPC.type] = 1;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
SpriteDirection = 1
};
value.Position.Y += 14f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
@@ -225,8 +228,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas
//We'll probably want a custom background SCal her like ML has.
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SCal,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("The Brimstone Witch's harsh life can be seen in the magic she casts. Volatile and powerful, yet just barely refined. Her temper is said to be fiery enough to burn down a kingdom.")
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("The Brimstone Witch's harsh life can be seen in the magic she casts. Volatile and powerful, yet just barely refined. Her temper is said to be fiery enough to burn down a kingdom.")
});
}
@@ -2579,6 +2582,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas
public override void FindFrame(int frameHeight)
{
if (NPC.IsABestiaryIconDummy)
{
FrameType = FrameAnimationType.UpwardDraft;
FrameChangeSpeed = 0.2f;
}
bool wormAlive = false;
if (CalamityGlobalNPC.SCalWorm != -1)
wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active;
+3 -2
View File
@@ -71,9 +71,10 @@ namespace CalamityMod.NPCs.Yharon
{
Scale = 0.3f,
PortraitScale = 0.4f,
PortraitPositionYOverride = -16f
PortraitPositionYOverride = -16f,
SpriteDirection = 1
};
value.Position.X -= 26f;
value.Position.X += 26f;
value.Position.Y -= 14f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
}
+3 -1
View File
@@ -116,7 +116,9 @@ namespace CalamityMod.Projectiles.Summon
var source = Projectile.GetSource_FromThis();
for (int n = 0; n < projAmt; n++)
{
CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType<BloodRain>(), (int)(Projectile.damage * Main.rand.NextFloat(0.7f, 1f)), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner);
float damageFactor = Main.rand.NextFloat(0.7f, 1f);
Projectile rain = CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType<BloodRain>(), (int)(Projectile.damage * damageFactor), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner);
rain.originalDamage = (int)(Projectile.originalDamage * damageFactor);
}
}
}
@@ -63,7 +63,9 @@ namespace CalamityMod.Projectiles.Summon
}
speed.Normalize();
speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType<CosmicViperSplitRocket1>(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f);
int splitRocket = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed, ModContent.ProjectileType<CosmicViperSplitRocket1>(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f);
if (Main.projectile.IndexInRange(splitRocket))
Main.projectile[splitRocket].originalDamage = (int)(Projectile.originalDamage * 0.25f);
}
}
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
+1 -1
View File
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon
if (Projectile.ai[0] == 2f)
return;
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/EndoCooperBody_Glow").Value;
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/EndoCooperLimbs_Glow").Value;
Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height);
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0);
}
+3 -13
View File
@@ -122,12 +122,14 @@ namespace CalamityMod.Projectiles.Summon
// Produce some dust when the worm is summoned.
if (Time < 3 && !Main.dedServ)
{
for (int i = 0; i < 50; i++)
{
Dust purpleElectricity = Dust.NewDustDirect(Projectile.position + Vector2.UnitY * 16f, Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f);
purpleElectricity.velocity *= 2f;
purpleElectricity.scale *= 1.15f;
}
}
CalamityPlayer modPlayer = owner.Calamity();
// Maintain or remove the Mechworm buff from the owner.
@@ -208,19 +210,7 @@ namespace CalamityMod.Projectiles.Summon
}
}
private bool TailExists()
{
int tailType = ModContent.ProjectileType<MechwormTail>();
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].type != tailType || !Main.projectile[i].active || Main.projectile[i].owner != Projectile.owner)
continue;
return true;
}
return false;
}
private bool TargetInSafeBoundaries(NPC target) => target?.Center.Between(WorldTopLeft(), WorldBottomRight()) ?? true;
private static bool TargetInSafeBoundaries(NPC target) => target?.Center.Between(WorldTopLeft(), WorldBottomRight()) ?? true;
private void PlayerFollowMovement(Player owner)
{
+2
View File
@@ -284,6 +284,7 @@ namespace CalamityMod.Projectiles.Summon
if (spark.WithinBounds(Main.maxProjectiles))
{
Main.projectile[spark].Calamity().forceMinion = true;
Main.projectile[spark].originalDamage = Projectile.originalDamage;
Main.projectile[spark].timeLeft = 120;
Main.projectile[spark].penetrate = 3;
Main.projectile[spark].usesIDStaticNPCImmunity = true;
@@ -327,6 +328,7 @@ namespace CalamityMod.Projectiles.Summon
if (spark.WithinBounds(Main.maxProjectiles))
{
Main.projectile[spark].Calamity().forceMinion = true;
Main.projectile[spark].originalDamage = Projectile.originalDamage;
Main.projectile[spark].timeLeft = 120;
Main.projectile[spark].penetrate = 3;
Main.projectile[spark].usesIDStaticNPCImmunity = true;
+3 -8
View File
@@ -156,18 +156,13 @@ namespace CalamityMod.Projectiles.Summon
if (Projectile.ai[0]++ % 75f == 24f)
{
int projID = ProjectileID.Bullet;
float shootSpeed = FalseGun.shootSpeed;
bool canShoot = true;
int damage = FalseGun.damage = Projectile.damage;
float kb = Projectile.knockBack;
bool shootRocket = ++Projectile.ai[1] % 20f == 0f;
// Rockets never consume ammo.
bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket;
int projIndex;
// Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item".
player.PickAmmo(FalseGun, out projID, out shootSpeed, out damage, out kb, out _);
player.PickAmmo(FalseGun, out int projID, out float shootSpeed, out int damage, out float kb, out _, dontConsumeAmmo);
// One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback.
if (shootRocket)
@@ -178,8 +173,8 @@ namespace CalamityMod.Projectiles.Summon
}
// Fire the selected bullet, nothing special.
else
projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, Projectile.owner);
else {
projIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, Projectile.owner);}
// Regardless of what was fired, force it to be a summon projectile so that summon accessories work.
if (projIndex.WithinBounds(Main.maxProjectiles))
+3 -2
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.ignoreWater = true;
Projectile.penetrate = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.localNPCHitCooldown = 15;
}
public override void AI()
{
@@ -87,7 +87,8 @@ namespace CalamityMod.Projectiles.Summon
for (int i = 0; i < 2; i++)
{
Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(8f, 8f);
int seeker = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType<PlagueSeeker>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
int seeker = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType<PlagueSeeker>(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner);
Main.projectile[seeker].originalDamage = Projectile.damage / 2;
Main.projectile[seeker].Calamity().forceMinion = true;
}
}
+7
View File
@@ -64,6 +64,13 @@ namespace CalamityMod.Systems
return true;
}, InterfaceScaleType.None));
// Speedrun Timer
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Speedrun Timer", delegate ()
{
SpeedrunTimerUI.Draw(Main.LocalPlayer);
return true;
}, InterfaceScaleType.None));
// Rage and Adrenaline bars
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Rage and Adrenaline UI", delegate ()
{
+2 -2
View File
@@ -367,9 +367,9 @@ namespace CalamityMod.Systems
if (Main.SceneMetrics.WaterCandleCount > 0)
spawnRate *= 0.8D;
if (modPlayer.bossZen)
if (modPlayer.isNearbyBoss && CalamityConfig.Instance.BossZen)
spawnRate *= 50D;
if (modPlayer.zen || (CalamityConfig.Instance.DisableExpertTownSpawns && player.townNPCs > 1f && Main.expertMode))
if (modPlayer.zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode))
spawnRate *= 2D;
if (modPlayer.tranquilityCandle)
spawnRate *= 1.67D;
@@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations
{
int xPos = Main.tile[i, j].TileFrameX;
int yPos = Main.tile[i, j].TileFrameY;
Texture2D glowmask = ModContent.Request<Texture2D>("CalamityMod/Tiles/Furniture/CraftingStations/MonolithCraftingGlow").Value;
Texture2D glowmask = ModContent.Request<Texture2D>("CalamityMod/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow").Value;
Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100));
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
@@ -292,7 +292,7 @@ namespace CalamityMod.UI.CalamitasEnchants
CalamityNetcode.NewNPC_ClientSide(player.Center, orbType, player);
}
},
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.CountsAsClass<SummonDamageClass>()),
item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.CountsAsClass<SummonDamageClass>() && !item.Calamity().trueMelee),
};
// Special disenchantment thing. This is separated from the list on purpose.
+103 -57
View File
@@ -1,8 +1,9 @@
using CalamityMod.CalPlayer;
using System;
using CalamityMod.Items;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -10,92 +11,137 @@ namespace CalamityMod.UI
{
public class ChargeMeterUI
{
public static Vector2 DrawPosition = new Vector2(CalamityConfig.Instance.ChargeMeterPosX, CalamityConfig.Instance.ChargeMeterPosY);
public static Vector2 Offset = DrawPosition;
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
internal const float DefaultChargePosX = 50.104603f;
internal const float DefaultChargePosY = 58.05169f;
private const float MouseDragEpsilon = 0.05f; // 0.05%
private static Vector2? dragOffset = null;
private static Texture2D edgeTexture, barTexture;
internal static void Load()
{
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeterBorder", AssetRequestMode.ImmediateLoad).Value;
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeter", AssetRequestMode.ImmediateLoad).Value;
Reset();
}
internal static void Unload()
{
Reset();
edgeTexture = barTexture = null;
}
private static void Reset() => dragOffset = null;
public static void Draw(SpriteBatch spriteBatch, Player player)
{
if (DrawPosition.X <= 60f && DrawPosition.Y <= 20f)
// Sanity check the planned position before drawing
Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.ChargeMeterPosX, CalamityConfig.Instance.ChargeMeterPosY);
if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f)
screenRatioPosition.X = DefaultChargePosX;
if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f)
screenRatioPosition.Y = DefaultChargePosY;
// Convert the screen ratio position to an absolute position in pixels
// Cast to integer to prevent blurriness which results from decimal pixel positions
float uiScale = Main.UIScale;
Vector2 screenPos = screenRatioPosition;
screenPos.X = (int)(screenPos.X * 0.01f * Main.screenWidth);
screenPos.Y = (int)(screenPos.Y * 0.01f * Main.screenHeight);
void SavePosition()
{
DrawPosition.X = Main.screenWidth / 2f;
DrawPosition.Y = Main.screenHeight / 2 + Main.LocalPlayer.height / 2f + 24f;
bool changed = false;
if (CalamityConfig.Instance.ChargeMeterPosX != screenRatioPosition.X)
{
CalamityConfig.Instance.ChargeMeterPosX = screenRatioPosition.X;
changed = true;
}
if (CalamityConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y)
{
CalamityConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y;
changed = true;
}
if (changed)
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
CalamityPlayer modPlayer = player.Calamity();
// If the Charge Meter is turned off or the player is not holding an item, stop.
Item heldItem = player.ActiveItem();
if (!CalamityConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir)
{
Reset();
SavePosition();
return;
}
// If the player is not holding an item which uses charge, stop.
CalamityGlobalItem modItem = heldItem.Calamity();
if (!(modItem?.UsesCharge ?? false))
{
Reset();
SavePosition();
return;
}
Texture2D edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeterBorder").Value;
Texture2D barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeter").Value;
float uiScale = Main.UIScale;
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
spriteBatch.Draw(edgeTexture, screenPos, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * modItem.ChargeRatio), barTexture.Width);
spriteBatch.Draw(barTexture, DrawPosition + new Vector2(offset * uiScale, 0), barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle chargeBar = Utils.CenteredRectangle(DrawPosition, edgeTexture.Size() * uiScale);
Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle chargeBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale);
if (chargeBar.Intersects(mouse))
// If the mouse is on top of the meter, show the exact numeric charge.
if (chargeBar.Intersects(mouseHitbox))
{
if (modItem.UsesCharge)
{
Main.LocalPlayer.mouseInterface = true;
float displayedPercent = modItem.ChargeRatio * 100f;
string percentString = displayedPercent.ToString("n2");
// Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing.
Main.instance.MouseText("Current Charge: " + percentString + "%", 0, 0, -1, -1, -1, -1);
}
Main.LocalPlayer.mouseInterface = true;
string percentString = (100f * modItem.ChargeRatio).ToString("n2");
// Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing.
Main.instance.MouseText($"Current Charge: {percentString}%", 0, 0, -1, -1, -1, -1);
}
// Handle mouse dragging
if (!CalamityConfig.Instance.MeterPosLock)
{
if (chargeBar.Intersects(mouse))
Vector2 newScreenRatioPosition = screenRatioPosition;
if (chargeBar.Intersects(mouseHitbox))
{
if (Mouse.GetState().LeftButton == ButtonState.Pressed)
MouseState ms = Mouse.GetState();
Vector2 mousePos = new Vector2(ms.X, ms.Y);
// As long as the mouse button is held down, drag the meter along with an offset.
if (ms.LeftButton == ButtonState.Pressed)
{
Offset = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
DrawPosition.X = Offset.X;
DrawPosition.Y = Offset.Y;
// If the drag offset doesn't exist yet, create it.
if (!dragOffset.HasValue)
dragOffset = mousePos - screenPos;
// Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset.
Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero);
// Convert the new corner position into a screen ratio position.
newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth;
newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight;
}
if (Mouse.GetState().LeftButton == ButtonState.Released)
// Compute the change in position. If it is large enough, actually move the meter
Vector2 delta = newScreenRatioPosition - screenRatioPosition;
if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon)
{
DrawPosition.X = Offset.X;
DrawPosition.Y = Offset.Y;
CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X;
CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y;
}
// When the mouse is released, save the config and destroy the drag offset.
if (ms.LeftButton == ButtonState.Released)
{
dragOffset = null;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
if (CalamityConfig.Instance.ChargeMeterPosX != DrawPosition.X)
{
CalamityConfig.Instance.ChargeMeterPosX = DrawPosition.X;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
if (CalamityConfig.Instance.ChargeMeterPosY != DrawPosition.Y)
{
CalamityConfig.Instance.ChargeMeterPosY = DrawPosition.Y;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
}
internal static void Reset()
{
if (CalamityConfig.Instance.ChargeMeterPosX != DrawPosition.X)
{
CalamityConfig.Instance.ChargeMeterPosX = DrawPosition.X;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
if (CalamityConfig.Instance.ChargeMeterPosY != DrawPosition.Y)
{
CalamityConfig.Instance.ChargeMeterPosY = DrawPosition.Y;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
}
+192 -164
View File
@@ -1,11 +1,11 @@
using CalamityMod.CalPlayer;
using CalamityMod.World;
using System;
using System.Collections.Generic;
using System.Text;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using ReLogic.Content;
using System.Collections.Generic;
using System.Text;
using Terraria;
using Terraria.ModLoader;
@@ -13,18 +13,18 @@ namespace CalamityMod.UI
{
public static class RipperUI
{
public const float DefaultRagePosX = 500f;
public const float DefaultRagePosY = 30f;
public const float DefaultAdrenPosX = 650f;
public const float DefaultAdrenPosY = 30f;
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
public const float DefaultRagePosX = 35.77406f;
public const float DefaultRagePosY = 3.9761431f;
public const float DefaultAdrenPosX = 35.77406f;
public const float DefaultAdrenPosY = 8.846918f;
private const float MouseDragEpsilon = 0.05f; // 0.05%
private const int RageAnimFrameDelay = 6;
private const int RageAnimFrames = 10;
private const int AdrenAnimFrameDelay = 5;
private const int AdrenAnimFrames = 10;
public static Vector2 rageDrawPos = new Vector2(DefaultRagePosX, DefaultRagePosY);
public static Vector2 adrenDrawPos = new Vector2(DefaultAdrenPosX, DefaultAdrenPosY);
private static Vector2? rageDragOffset = null;
private static Vector2? adrenDragOffset = null;
private static Vector2 pearlOffsetLeft = Vector2.Zero;
@@ -72,7 +72,6 @@ namespace CalamityMod.UI
internal static void Unload()
{
Reset();
rageBarTex = rageBorderTex = rageAnimTex = null;
adrenBarTex = adrenBorderTex = adrenBorderTexFull = adrenAnimTex = null;
mushroomPlasmaTex = infernalBloodTex = redLightningTex = null;
@@ -82,10 +81,6 @@ namespace CalamityMod.UI
internal static void Reset()
{
bool configExists = CalamityConfig.Instance != null;
rageDrawPos = configExists ? new Vector2(CalamityConfig.Instance.RageMeterPosX, CalamityConfig.Instance.RageMeterPosY) : Vector2.Zero;
adrenDrawPos = configExists ? new Vector2(CalamityConfig.Instance.AdrenalineMeterPosX, CalamityConfig.Instance.AdrenalineMeterPosY) : Vector2.Zero;
rageDragOffset = null;
adrenDragOffset = null;
rageAnimFrame = -1;
@@ -96,27 +91,174 @@ namespace CalamityMod.UI
public static void Draw(SpriteBatch spriteBatch, Player player)
{
// If for some reason either of the bars has been thrown into the corner (likely to 0,0 by default), put them at their default positions
CheckGarbageCornerPos();
// Sanity check the planned Rage Meter position
Vector2 rageScreenRatioPos = new Vector2(CalamityConfig.Instance.RageMeterPosX, CalamityConfig.Instance.RageMeterPosY);
if (rageScreenRatioPos.X < 0f || rageScreenRatioPos.X > 100f)
rageScreenRatioPos.X = DefaultRagePosX;
if (rageScreenRatioPos.Y < 0f || rageScreenRatioPos.Y > 100f)
rageScreenRatioPos.Y = DefaultRagePosY;
// Prevent blurriness which results from decimals in the position variables.
rageDrawPos.X = (int)rageDrawPos.X;
rageDrawPos.Y = (int)rageDrawPos.Y;
adrenDrawPos.X = (int)adrenDrawPos.X;
adrenDrawPos.Y = (int)adrenDrawPos.Y;
// Sanity check the planned Adrenaline Meter position
Vector2 adrenScreenRatioPos = new Vector2(CalamityConfig.Instance.AdrenalineMeterPosX, CalamityConfig.Instance.AdrenalineMeterPosY);
if (adrenScreenRatioPos.X < 0f || adrenScreenRatioPos.X > 100f)
adrenScreenRatioPos.X = DefaultAdrenPosX;
if (adrenScreenRatioPos.Y < 0f || adrenScreenRatioPos.Y > 100f)
adrenScreenRatioPos.Y = DefaultAdrenPosY;
// Grab the ModPlayer object and then start drawing
// Convert the screen ratio position to an absolute position in pixels
// Cast to integer to prevent blurriness which results from decimal pixel positions
Vector2 rageScreenPos = rageScreenRatioPos;
rageScreenPos.X = (int)(rageScreenPos.X * 0.01f * Main.screenWidth);
rageScreenPos.Y = (int)(rageScreenPos.Y * 0.01f * Main.screenHeight);
Vector2 adrenScreenPos = adrenScreenRatioPos;
adrenScreenPos.X = (int)(adrenScreenPos.X * 0.01f * Main.screenWidth);
adrenScreenPos.Y = (int)(adrenScreenPos.Y * 0.01f * Main.screenHeight);
// Grab the ModPlayer object and draw if applicable. If not applicable, save positions to config.
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.RageEnabled)
DrawRageBar(spriteBatch, modPlayer);
if (modPlayer.AdrenalineEnabled)
DrawAdrenalineBar(spriteBatch, modPlayer);
HandleMouseInteraction(modPlayer, rageBorderTex.Size(), adrenBorderTex.Size());
if (modPlayer.RageEnabled)
DrawRageBar(spriteBatch, modPlayer, rageScreenPos);
else
{
bool changed = false;
if (CalamityConfig.Instance.RageMeterPosX != rageScreenRatioPos.X)
{
CalamityConfig.Instance.RageMeterPosX = rageScreenRatioPos.X;
changed = true;
}
if (CalamityConfig.Instance.RageMeterPosY != rageScreenRatioPos.Y)
{
CalamityConfig.Instance.RageMeterPosY = rageScreenRatioPos.Y;
changed = true;
}
if (changed)
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
if (modPlayer.AdrenalineEnabled)
DrawAdrenalineBar(spriteBatch, modPlayer, adrenScreenPos);
else
{
bool changed = false;
if (CalamityConfig.Instance.AdrenalineMeterPosX != adrenScreenRatioPos.X)
{
CalamityConfig.Instance.AdrenalineMeterPosX = adrenScreenRatioPos.X;
changed = true;
}
if (CalamityConfig.Instance.AdrenalineMeterPosY != adrenScreenRatioPos.Y)
{
CalamityConfig.Instance.AdrenalineMeterPosY = adrenScreenRatioPos.Y;
changed = true;
}
if (changed)
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
#region Mouse Interaction
float uiScale = Main.UIScale;
Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle rageBar = Utils.CenteredRectangle(rageScreenPos, rageBorderTex.Size() * uiScale);
Rectangle adrenBar = Utils.CenteredRectangle(adrenScreenPos, adrenBorderTex.Size() * uiScale);
bool rageHover = mouseHitbox.Intersects(rageBar) && modPlayer.RageEnabled;
bool adrenHover = mouseHitbox.Intersects(adrenBar) && modPlayer.AdrenalineEnabled;
MouseState ms = Mouse.GetState();
Vector2 mousePos = Main.MouseScreen;
// Rage bar takes priority, and only one can be hovered at a time
if (rageHover && !adrenHover)
{
// If the meter isn't locked, then the player's mouse counts as being over interface
if (!CalamityConfig.Instance.MeterPosLock)
Main.LocalPlayer.mouseInterface = true;
// Add hover text if the mouse is over Rage bar
string rageStr = MakeRipperPercentString(modPlayer.rage, modPlayer.rageMax);
Main.instance.MouseText($"Rage: {rageStr}");
// The bar is draggable if enabled in config.
Vector2 newScreenRatioPosition = rageScreenRatioPos;
if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed)
{
// If the drag offset doesn't exist yet, create it.
if (!rageDragOffset.HasValue)
rageDragOffset = mousePos - rageScreenPos;
// Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset.
Vector2 newCorner = mousePos - rageDragOffset.GetValueOrDefault(Vector2.Zero);
// Convert the new corner position into a screen ratio position.
newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth;
newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight;
}
// Compute the change in position. If it is large enough, actually move the meter
Vector2 delta = newScreenRatioPosition - rageScreenRatioPos;
if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon)
{
CalamityConfig.Instance.RageMeterPosX = newScreenRatioPosition.X;
CalamityConfig.Instance.RageMeterPosY = newScreenRatioPosition.Y;
}
// When the mouse is released, save the config and destroy the drag offset.
if (ms.LeftButton == ButtonState.Released)
{
rageDragOffset = null;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
else if (adrenHover)
{
// If the meter isn't locked, then the player's mouse counts as being over interface
if (!CalamityConfig.Instance.MeterPosLock)
Main.LocalPlayer.mouseInterface = true;
// Add hover text if the mouse is over the bar
string adrenNameStr = modPlayer.draedonsHeart ? "Nanomachines" : "Adrenaline";
string adrenAmountStr = MakeRipperPercentString(modPlayer.adrenaline, modPlayer.adrenalineMax);
Main.instance.MouseText($"{adrenNameStr}: {adrenAmountStr}");
// The bar is draggable if enabled in config.
Vector2 newScreenRatioPosition = adrenScreenRatioPos;
if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed)
{
// If the drag offset doesn't exist yet, create it.
if (!adrenDragOffset.HasValue)
adrenDragOffset = mousePos - adrenScreenPos;
// Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset.
Vector2 newCorner = mousePos - adrenDragOffset.GetValueOrDefault(Vector2.Zero);
// Convert the new corner position into a screen ratio position.
newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth;
newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight;
}
// Compute the change in position. If it is large enough, actually move the meter
Vector2 delta = newScreenRatioPosition - adrenScreenRatioPos;
if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon)
{
CalamityConfig.Instance.AdrenalineMeterPosX = newScreenRatioPosition.X;
CalamityConfig.Instance.AdrenalineMeterPosY = newScreenRatioPosition.Y;
}
// When the mouse is released, save the config and destroy the drag offset.
if (ms.LeftButton == ButtonState.Released)
{
adrenDragOffset = null;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
#endregion
}
private static void DrawRageBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer)
#region Draw Rage Bar
private static void DrawRageBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Vector2 screenPos)
{
float uiScale = Main.UIScale;
Vector2 shakeOffset = modPlayer.rageModeActive ? GetShakeOffset() : Vector2.Zero;
// If rage is full this frame and the animation hasn't started yet, start it.
@@ -140,17 +282,15 @@ namespace CalamityMod.UI
}
}
float uiScale = Main.UIScale;
// Draw the border of the Rage Bar first
spriteBatch.Draw(rageBorderTex, rageDrawPos + shakeOffset, null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(rageBorderTex, screenPos + shakeOffset, null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// The amount of the bar to draw depends on the player's current Rage level
// offset calculates the deadspace that is the border and not the bar. Bar is 24 pixels tall
int barWidth = rageBarTex.Width;
float offset = (rageBorderTex.Width - rageBarTex.Width) * 0.5f;
Rectangle cropRect = new Rectangle(0, 0, (int)(barWidth * rageRatio), rageBarTex.Height);
spriteBatch.Draw(rageBarTex, rageDrawPos + shakeOffset + new Vector2(offset * uiScale, 0), cropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(rageBarTex, screenPos + shakeOffset + new Vector2(offset * uiScale, 0), cropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// Determine which pearls to draw (and their positions) based off of which Rage upgrades the player has.
IList<Texture2D> pearls = new List<Texture2D>(3);
@@ -164,7 +304,7 @@ namespace CalamityMod.UI
// Draw pearls at appropriate positions.
for (int i = 0; i < pearls.Count; ++i)
spriteBatch.Draw(pearls[i], rageDrawPos + shakeOffset + offsets[i] * uiScale, null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(pearls[i], screenPos + shakeOffset + offsets[i] * uiScale, null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// If the animation is active, draw the animation on top of both the border and the bar.
if (animationActive)
@@ -174,12 +314,15 @@ namespace CalamityMod.UI
float yOffset = (rageBorderTex.Height - frameHeight) / 2f;
Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset);
Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * rageAnimFrame, rageAnimTex.Width, frameHeight);
spriteBatch.Draw(rageAnimTex, rageDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(rageAnimTex, screenPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
}
}
#endregion
private static void DrawAdrenalineBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer)
#region Draw Adrenaline Bar
private static void DrawAdrenalineBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Vector2 screenPos)
{
float uiScale = Main.UIScale;
Vector2 shakeOffset = modPlayer.adrenalineModeActive ? GetShakeOffset() : Vector2.Zero;
// If adrenaline is full this frame and the animation hasn't started yet, start it.
@@ -203,20 +346,18 @@ namespace CalamityMod.UI
}
}
float uiScale = Main.UIScale;
// Draw the border of the Adrenaline Bar first
spriteBatch.Draw(adrenBorderTex, adrenDrawPos + shakeOffset, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(adrenBorderTex, screenPos + shakeOffset, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// Use a slightly different texture if Adrenaline is full or active
if (modPlayer.adrenaline >= modPlayer.adrenalineMax || modPlayer.adrenalineModeActive)
spriteBatch.Draw(adrenBorderTexFull, adrenDrawPos + shakeOffset, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(adrenBorderTexFull, screenPos + shakeOffset, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// The amount of the bar to draw depends on the player's current Adrenaline level
// offset calculates the deadspace that is the border and not the bar. Bar is 24 pixels tall
int barWidth = adrenBarTex.Width;
float offset = (adrenBorderTex.Width - adrenBarTex.Width) * 0.5f;
Rectangle cropRect = new Rectangle(0, 0, (int)(barWidth * adrenRatio), adrenBarTex.Height);
spriteBatch.Draw(adrenBarTex, adrenDrawPos + shakeOffset + new Vector2(offset * uiScale, 0), cropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(adrenBarTex, screenPos + shakeOffset + new Vector2(offset * uiScale, 0), cropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// Determine which pearls to draw (and their positions) based off of which Adrenaline upgrades the player has.
IList<Texture2D> pearls = new List<Texture2D>(3);
@@ -230,7 +371,7 @@ namespace CalamityMod.UI
// Draw pearls at appropriate positions.
for (int i = 0; i < pearls.Count; ++i)
spriteBatch.Draw(pearls[i], adrenDrawPos + shakeOffset + offsets[i] * uiScale, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(pearls[i], screenPos + shakeOffset + offsets[i] * uiScale, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// If the animation is active, draw the animation on top of both the border and the bar.
if (animationActive)
@@ -241,138 +382,25 @@ namespace CalamityMod.UI
float yOffset = (adrenBorderTex.Height - frameHeight) / 2f + animOffset;
Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset);
Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * adrenAnimFrame, adrenAnimTex.Width, frameHeight);
spriteBatch.Draw(adrenAnimTex, adrenDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
spriteBatch.Draw(adrenAnimTex, screenPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
}
}
private static void HandleMouseInteraction(CalamityPlayer modPlayer, Vector2 rageBarSize, Vector2 adrenBarSize)
{
float uiScale = Main.UIScale;
Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle rageBar = Utils.CenteredRectangle(rageDrawPos, rageBarSize * uiScale);
Rectangle adrenBar = Utils.CenteredRectangle(adrenDrawPos, adrenBarSize * uiScale);
bool rageHover = mouse.Intersects(rageBar) && modPlayer.RageEnabled;
bool adrenHover = mouse.Intersects(adrenBar) && modPlayer.AdrenalineEnabled;
MouseState mouseInput = Mouse.GetState();
Vector2 mousePos = Main.MouseScreen;
// Rage bar takes priority, and only one can be hovered at a time
if (rageHover && !adrenHover)
{
// Add hover text if the mouse is over Rage bar
if (!CalamityConfig.Instance.MeterPosLock)
Main.LocalPlayer.mouseInterface = true;
string rageStr = MakeRipperPercentString(modPlayer.rage, modPlayer.rageMax);
Main.instance.MouseText($"Rage: {rageStr}");
// The bar is draggable if enabled in config.
if (!CalamityConfig.Instance.MeterPosLock && mouseInput.LeftButton == ButtonState.Pressed)
{
// On the first frame new mouse input comes in, set the offset. Otherwise do nothing.
if (rageDragOffset is null)
rageDragOffset = rageDrawPos - mousePos;
}
}
else if (adrenHover)
{
// Add hover text if the mouse is over the bar
if (!CalamityConfig.Instance.MeterPosLock)
Main.LocalPlayer.mouseInterface = true;
string adrenNameStr = modPlayer.draedonsHeart ? "Nanomachines" : "Adrenaline";
string adrenAmountStr = MakeRipperPercentString(modPlayer.adrenaline, modPlayer.adrenalineMax);
Main.instance.MouseText($"{adrenNameStr}: {adrenAmountStr}");
// The bar is draggable if enabled in config.
if (!CalamityConfig.Instance.MeterPosLock && mouseInput.LeftButton == ButtonState.Pressed)
{
// On the first frame new mouse input comes in, set the offset. Otherwise do nothing.
if (adrenDragOffset is null)
adrenDragOffset = adrenDrawPos - mousePos;
}
}
// If the rage bar is currently being dragged, move it to follow the mouse.
if (rageDragOffset.HasValue)
rageDrawPos = mousePos + rageDragOffset.GetValueOrDefault();
// If the adrenaline bar is currently being dragged, move it to follow the mouse.
if (adrenDragOffset.HasValue)
adrenDrawPos = mousePos + adrenDragOffset.GetValueOrDefault();
// Regardless of what is hovered, when the mouse is released, destroy the offset, and save the config.
if (mouseInput.LeftButton == ButtonState.Released)
{
bool updateCfg = false;
if (rageDragOffset.HasValue)
{
rageDragOffset = null;
if (CalamityConfig.Instance.RageMeterPosX != rageDrawPos.X)
{
CalamityConfig.Instance.RageMeterPosX = rageDrawPos.X;
updateCfg = true;
}
if (CalamityConfig.Instance.RageMeterPosY != rageDrawPos.Y)
{
CalamityConfig.Instance.RageMeterPosY = rageDrawPos.Y;
updateCfg = true;
}
}
if (adrenDragOffset.HasValue)
{
adrenDragOffset = null;
if (CalamityConfig.Instance.AdrenalineMeterPosX != adrenDrawPos.X)
{
CalamityConfig.Instance.AdrenalineMeterPosX = adrenDrawPos.X;
updateCfg = true;
}
if (CalamityConfig.Instance.AdrenalineMeterPosY != adrenDrawPos.Y)
{
CalamityConfig.Instance.AdrenalineMeterPosY = adrenDrawPos.Y;
updateCfg = true;
}
}
if (updateCfg)
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
private static void CheckGarbageCornerPos()
{
// This should only happen if something happens to the config file.
if (rageDrawPos == Vector2.Zero)
rageDrawPos = new Vector2(DefaultRagePosX, DefaultRagePosY);
rageDrawPos = Vector2.Clamp(rageDrawPos, Vector2.Zero, new Vector2(Main.screenWidth - 104f, Main.screenHeight - 24f));
if (adrenDrawPos == Vector2.Zero)
adrenDrawPos = new Vector2(DefaultAdrenPosX, DefaultAdrenPosY);
adrenDrawPos = Vector2.Clamp(adrenDrawPos, Vector2.Zero, new Vector2(Main.screenWidth - 104f, Main.screenHeight - 24f));
}
#endregion
private static Vector2 GetShakeOffset()
{
float shake = CalamityConfig.Instance.MeterShake;
float shake = CalamityConfig.Instance.RipperMeterShake;
float shakeX = Main.rand.NextFloat(-shake, shake);
float shakeY = Main.rand.NextFloat(-shake, shake);
return new Vector2(shakeX, shakeY);
}
private static IList<Vector2> GetPearlOffsets(int count)
private static IList<Vector2> GetPearlOffsets(int count) => count switch
{
switch (count)
{
case 1:
return new List<Vector2>() { pearlOffsetCenter };
case 2:
return new List<Vector2>() { PearlOffsetCenterLeft, PearlOffsetCenterRight };
case 3:
return new List<Vector2>() { pearlOffsetLeft, pearlOffsetCenter, pearlOffsetRight };
default:
return null;
}
}
1 => new List<Vector2>() { pearlOffsetCenter },
2 => new List<Vector2>() { PearlOffsetCenterLeft, PearlOffsetCenterRight },
3 => new List<Vector2>() { pearlOffsetLeft, pearlOffsetCenter, pearlOffsetRight },
_ => null,
};
private static string MakeRipperPercentString(float value, float maxValue)
{
+142
View File
@@ -0,0 +1,142 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.NPCs.AdultEidolonWyrm;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.NPCs.Bumblebirb;
using CalamityMod.NPCs.Calamitas;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.NPCs.Crabulon;
using CalamityMod.NPCs.Cryogen;
using CalamityMod.NPCs.DesertScourge;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.NPCs.Leviathan;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Providence;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.Signus;
using CalamityMod.NPCs.SlimeGod;
using CalamityMod.NPCs.Yharon;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.UI
{
public class SpeedrunTimerUI
{
// These values put the Speedrun Timer roughly at the top center of a 1080p screen.
internal const float DefaultTimerPosX = 46f;
internal const float DefaultTimerPosY = 1.481f;
private static readonly float SplitHorizontalOffset = +30f;
private static readonly float SplitVerticalOffset = +44f;
public static void Draw(Player player)
{
if (Main.gameMenu || !CalamityConfig.Instance.SpeedrunTimer)
return;
// Sanity check the planned position before drawing
Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.SpeedrunTimerPosX, CalamityConfig.Instance.SpeedrunTimerPosY);
if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f)
screenRatioPosition.X = DefaultTimerPosX;
if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f)
screenRatioPosition.Y = DefaultTimerPosY;
// Convert the screen ratio position to an absolute position in pixels
// Cast to integer to prevent blurriness which results from decimal pixel positions
Vector2 screenPos = screenRatioPosition;
screenPos.X = (int)(screenPos.X * 0.01f * Main.screenWidth);
screenPos.Y = (int)(screenPos.Y * 0.01f * Main.screenHeight);
CalamityPlayer calamityPlayer = player.Calamity();
// Main timer
string formatStr = @"hh\:mm\:ss\.ff";
string formatStrDays = @"d\:hh\:mm\:ss\.ff";
TimeSpan totalTime = CalamityMod.SpeedrunTimer.Elapsed.Add(calamityPlayer.previousSessionTotal);
string text = totalTime.ToString(totalTime.Days > 0 ? formatStrDays : formatStr);
float scale = 2f;
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, screenPos.X, screenPos.Y, Color.White, Color.Black, default, scale);
if (calamityPlayer.lastSplitType == -1)
return;
// Latest split
TimeSpan split = calamityPlayer.lastSplit;
text = split.ToString(split.Days > 0 ? formatStrDays : formatStr);
scale = 1f;
float lineTwoX = screenPos.X + SplitHorizontalOffset;
float lineTwoY = screenPos.Y + SplitVerticalOffset;
Texture2D texture = GetSplitIcon(calamityPlayer.lastSplitType);
// If a split icon exists, draw it.
if (texture != null)
Main.spriteBatch.Draw(texture, new Vector2(lineTwoX - texture.Width - 4f, lineTwoY), null, Color.White, 0f, default, 1f, SpriteEffects.None, 0f);
// Draw the latest split time.
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, lineTwoX, lineTwoY, Color.White, Color.Black, default, scale);
}
// TODO -- these should not be magic numbers that are not used ANYWHERE else
private static Texture2D GetSplitIcon(int magicNumber) => magicNumber switch
{
1 => TextureAssets.NpcHeadBoss[7].Value, // King Slime
2 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<DesertScourgeHead>()]].Value,
3 => TextureAssets.NpcHeadBoss[1].Value, // Eye of Cthulhu
4 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CrabulonIdle>()]].Value,
5 => TextureAssets.NpcHeadBoss[2].Value, // Eater of Worlds
6 => TextureAssets.NpcHeadBoss[23].Value, // Brain of Cthulhu
7 => ModContent.Request<Texture2D>("CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss").Value,
8 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PerforatorHive>()]].Value,
9 => TextureAssets.NpcHeadBoss[14].Value, // Queen Bee
10 => TextureAssets.NpcHeadBoss[19].Value, // Skeletron
11 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<SlimeGodCore>()]].Value,
12 => TextureAssets.NpcHeadBoss[22].Value, // Wall of Flesh
13 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Cryogen>()]].Value,
14 => TextureAssets.NpcHeadBoss[21].Value, // The Twins
15 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AquaticScourgeHead>()]].Value,
16 => TextureAssets.NpcHeadBoss[25].Value, // The Destroyer
17 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<BrimstoneElemental>()]].Value,
18 => TextureAssets.NpcHeadBoss[18].Value, // Skeletron Prime
19 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CalamitasRun3>()]].Value,
20 => TextureAssets.NpcHeadBoss[12].Value, // Plantera
21 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Leviathan>()]].Value,
22 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumAureus>()]].Value,
23 => TextureAssets.NpcHeadBoss[5].Value, // Golem
24 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<PlaguebringerGoliath>()]].Value,
25 => TextureAssets.NpcHeadBoss[4].Value, // Duke Fishron
26 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<RavagerBody>()]].Value,
27 => TextureAssets.NpcHeadBoss[31].Value, // Lunatic Cultist
28 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AstrumDeusHeadSpectral>()]].Value,
29 => TextureAssets.NpcHeadBoss[8].Value, // Moon Lord
30 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<ProfanedGuardianBoss>()]].Value,
31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Bumblefuck>()]].Value,
32 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Providence>()]].Value,
33 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<CeaselessVoid>()]].Value,
34 => ModContent.Request<Texture2D>("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss").Value,
35 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Signus>()]].Value,
36 => ModContent.Request<Texture2D>("CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss").Value,
37 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<OldDuke>()]].Value,
38 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<DevourerofGodsHead>()]].Value,
39 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<Yharon>()]].Value,
40 => ModContent.Request<Texture2D>("CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon").Value,
41 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<AresBody>()]].Value,
42 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType<EidolonWyrmHeadHuge>()]].Value,
43 => TextureAssets.NpcHeadBoss[38].Value, // Queen Slime
44 => TextureAssets.NpcHeadBoss[37].Value, // Empress of Light
45 => TextureAssets.NpcHeadBoss[39].Value, // Deerclops
_ => null
};
}
}
+108 -63
View File
@@ -1,8 +1,9 @@
using CalamityMod.CalPlayer;
using System;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using ReLogic.Content;
using Terraria;
using Terraria.ModLoader;
@@ -10,88 +11,132 @@ namespace CalamityMod.UI
{
public class StealthUI
{
public static Vector2 DrawPosition = new Vector2(CalamityConfig.Instance.StealthMeterPosX, CalamityConfig.Instance.StealthMeterPosY);
public static Vector2 Offset = DrawPosition;
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
internal const float DefaultStealthPosX = 50.104603f;
internal const float DefaultStealthPosY = 55.765408f;
private const float MouseDragEpsilon = 0.05f; // 0.05%
private static Vector2? dragOffset = null;
private static Texture2D edgeTexture, indicatorTexture, barTexture, fullBarTexture;
internal static void Load()
{
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeter", AssetRequestMode.ImmediateLoad).Value;
indicatorTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator", AssetRequestMode.ImmediateLoad).Value;
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBar", AssetRequestMode.ImmediateLoad).Value;
fullBarTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBarFull", AssetRequestMode.ImmediateLoad).Value;
Reset();
}
internal static void Unload()
{
Reset();
edgeTexture = indicatorTexture = barTexture = fullBarTexture = null;
}
private static void Reset() => dragOffset = null;
public static void Draw(SpriteBatch spriteBatch, Player player)
{
if (DrawPosition.X <= 60f && DrawPosition.Y <= 20f)
{
DrawPosition.X = Main.screenWidth / 2f;
DrawPosition.Y = Main.screenHeight / 2 + Main.LocalPlayer.height / 2f + 24f;
}
// Sanity check the planned position before drawing
Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.StealthMeterPosX, CalamityConfig.Instance.StealthMeterPosY);
if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f)
screenRatioPosition.X = DefaultStealthPosX;
if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f)
screenRatioPosition.Y = DefaultStealthPosY;
// Convert the screen ratio position to an absolute position in pixels
// Cast to integer to prevent blurriness which results from decimal pixel positions
float uiScale = Main.UIScale;
Vector2 screenPos = screenRatioPosition;
screenPos.X = (int)(screenPos.X * 0.01f * Main.screenWidth);
screenPos.Y = (int)(screenPos.Y * 0.01f * Main.screenHeight);
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthBar || modPlayer.rogueStealthMax <= 0f || !modPlayer.wearingRogueArmor)
// If not drawing the stealth meter, save its latest position to config and leave.
if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthMeter || modPlayer.rogueStealthMax <= 0f || !modPlayer.wearingRogueArmor)
{
if (CalamityConfig.Instance.StealthMeterPosX != DrawPosition.X)
bool changed = false;
if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X)
{
CalamityConfig.Instance.StealthMeterPosX = DrawPosition.X;
CalamityMod.SaveConfig(CalamityConfig.Instance);
CalamityConfig.Instance.StealthMeterPosX = screenRatioPosition.X;
changed = true;
}
if (CalamityConfig.Instance.StealthMeterPosY != DrawPosition.Y)
if (CalamityConfig.Instance.StealthMeterPosY != screenRatioPosition.Y)
{
CalamityConfig.Instance.StealthMeterPosY = DrawPosition.Y;
CalamityMod.SaveConfig(CalamityConfig.Instance);
CalamityConfig.Instance.StealthMeterPosY = screenRatioPosition.Y;
changed = true;
}
if (changed)
CalamityMod.SaveConfig(CalamityConfig.Instance);
return;
}
Texture2D edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeter").Value;
Texture2D indicatorTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator").Value;
Texture2D barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBar").Value;
Texture2D fullBarTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBarFull").Value;
float uiScale = Main.UIScale;
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
spriteBatch.Draw(edgeTexture, screenPos, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
// If SS is available, display the explicit indication thereof
if (modPlayer.StealthStrikeAvailable())
{
spriteBatch.Draw(indicatorTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
}
spriteBatch.Draw(indicatorTexture, screenPos, null, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
float completionRatio = modPlayer.rogueStealth / modPlayer.rogueStealthMax;
float completionRatio = modPlayer.rogueStealthMax <= 0f ? 0f : modPlayer.rogueStealth / modPlayer.rogueStealthMax;
Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width);
bool full = modPlayer.rogueStealth >= modPlayer.rogueStealthMax;
spriteBatch.Draw(full ? fullBarTexture : barTexture, DrawPosition + new Vector2(offset * uiScale, 0), barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
bool full = (modPlayer.rogueStealthMax > 0f) && (modPlayer.rogueStealth >= modPlayer.rogueStealthMax);
spriteBatch.Draw(full ? fullBarTexture : barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle stealthBar = Utils.CenteredRectangle(DrawPosition, edgeTexture.Size() * uiScale);
Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle stealthBar = Utils.CenteredRectangle(screenPos, edgeTexture.Size() * uiScale);
if (stealthBar.Intersects(mouse))
// If the mouse is on top of the meter, show the player's exact numeric stealth.
if (stealthBar.Intersects(mouseHitbox) && modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f)
{
if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f)
{
Main.LocalPlayer.mouseInterface = true;
int stealthInt = (int)Math.Round(modPlayer.rogueStealth * 100f);
int maxStealthInt = (int)Math.Round(modPlayer.rogueStealthMax * 100f);
//only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol.
Main.instance.MouseText("Stealth: " + stealthInt + "/" + maxStealthInt + "", 0, 0, -1, -1, -1, -1);
modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f);
}
Main.LocalPlayer.mouseInterface = true;
string stealthStr = (100f * modPlayer.rogueStealth).ToString("n2");
string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2");
Main.instance.MouseText($"Stealth: {stealthStr}/{maxStealthStr}", 0, 0, -1, -1, -1, -1);
modPlayer.stealthUIAlpha = MathHelper.Lerp(modPlayer.stealthUIAlpha, 0.25f, 0.035f);
}
// Handle mouse dragging
if (!CalamityConfig.Instance.MeterPosLock)
{
if (stealthBar.Intersects(mouse))
Vector2 newScreenRatioPosition = screenRatioPosition;
if (stealthBar.Intersects(mouseHitbox))
{
if (Mouse.GetState().LeftButton == ButtonState.Pressed)
{
Offset = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
DrawPosition.X = Offset.X;
DrawPosition.Y = Offset.Y;
}
if (Mouse.GetState().LeftButton == ButtonState.Released)
{
DrawPosition.X = Offset.X;
DrawPosition.Y = Offset.Y;
}
}
MouseState ms = Mouse.GetState();
Vector2 mousePos = new Vector2(ms.X, ms.Y);
if (CalamityConfig.Instance.StealthMeterPosX != DrawPosition.X)
{
CalamityConfig.Instance.StealthMeterPosX = DrawPosition.X;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
if (CalamityConfig.Instance.StealthMeterPosY != DrawPosition.Y)
{
CalamityConfig.Instance.StealthMeterPosY = DrawPosition.Y;
CalamityMod.SaveConfig(CalamityConfig.Instance);
// As long as the mouse button is held down, drag the meter along with an offset.
if (ms.LeftButton == ButtonState.Pressed)
{
// If the drag offset doesn't exist yet, create it.
if (!dragOffset.HasValue)
dragOffset = mousePos - screenPos;
// Given the mouse's absolute current position, compute where the corner of the stealth bar should be based on the original drag offset.
Vector2 newCorner = mousePos - dragOffset.GetValueOrDefault(Vector2.Zero);
// Convert the new corner position into a screen ratio position.
newScreenRatioPosition.X = (100f * newCorner.X) / Main.screenWidth;
newScreenRatioPosition.Y = (100f * newCorner.Y) / Main.screenHeight;
}
// Compute the change in position. If it is large enough, actually move the meter
Vector2 delta = newScreenRatioPosition - screenRatioPosition;
if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon)
{
CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X;
CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y;
}
// When the mouse is released, save the config and destroy the drag offset.
if (ms.LeftButton == ButtonState.Released)
{
dragOffset = null;
CalamityMod.SaveConfig(CalamityConfig.Instance);
}
}
}
}
-1
View File
@@ -535,7 +535,6 @@ namespace CalamityMod.World
#endregion
#region Planetoid Lab
public static void FillPlanetoidLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic)
{
int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion);