This commit is contained in:
Dreitone committed 2025-12-31 15:36:30 -06:00
commit eea9bdce1b
36 files changed
+506 -525

No files matched your search

+57 -3
View File
@@ -13,6 +13,7 @@ using CalamityMod.DataStructures;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.FluidSimulation;
using CalamityMod.Graphics;
using CalamityMod.Items;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
@@ -54,6 +55,7 @@ using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Boss;
@@ -249,7 +251,9 @@ namespace CalamityMod.CalPlayer
#endregion
#region External variables -- Not used by Calamity, only via Mod.Call or reflection
[Obsolete("No longer does anything in the new abyss light system")]
public int externalAbyssLight = 0;
public float externalBreathTickBoost = 0f;
public float externalFlightTimeMultBoost = 0f;
@@ -737,6 +741,18 @@ namespace CalamityMod.CalPlayer
public int abyssLifeLostAtZeroBreathStat = 0;
/// <summary> The amount which defense is reduced while in the Abyss. </summary>
public int abyssDefenseLossStat = 0;
//These stats are for the abyss darkness system.
public float abyssDarkness = 0f;
public float abyssPlayerGlowMultiplier = 1f;
public float abyssFlashlightWidthMultiplier = 1f;
#endregion
#region Light System
public float darknessIntensity = 0;
public Vector2? lastDeerclopsPosition;
#endregion
#region Permanent Buff
@@ -2092,7 +2108,6 @@ namespace CalamityMod.CalPlayer
DashID = string.Empty;
externalAbyssLight = 0;
externalBreathTickBoost = 0f;
externalFlightTimeMultBoost = 0f;
externalRageEnabled = externalAdrenalineEnabled = null;
@@ -2896,7 +2911,15 @@ namespace CalamityMod.CalPlayer
disablePerfCystSpawns = false;
disableVoodooSpawns = false;
EnchantHeldItemEffects(Player, Player.Calamity(), Player.HeldItem);
#region Abyss
abyssDarkness = 0;
abyssPlayerGlowMultiplier = 1;
abyssFlashlightWidthMultiplier = 1;
darknessIntensity = MathHelper.Max(darknessIntensity-0.05f,0);
#endregion
EnchantHeldItemEffects(Player, Player.Calamity(), Player.HeldItem);
}
#endregion
@@ -3024,7 +3047,6 @@ namespace CalamityMod.CalPlayer
rOfResilienceEffect = 0;
demonSwordKillMode = false;
externalAbyssLight = 0;
externalBreathTickBoost = 0f;
externalFlightTimeMultBoost = 0f;
externalColdImmunity = externalHeatImmunity = false;
@@ -4869,6 +4891,38 @@ namespace CalamityMod.CalPlayer
public override void PostUpdate()
{
if (ZoneAbyss && Main.netMode != NetmodeID.Server)
{
//Main aura
EnhancedDarknessSystem.lights.Add(new(center: Player.Center, scale: 4 * abyssPlayerGlowMultiplier));
//Flashlight
//Due to being in postUpdate we need to adjust the mousepos for the player's movement that will have happened
var mouseworld = Main.MouseWorld + Player.position - Player.oldPosition;
EnhancedDarknessSystem.lights.Add(new(center: Player.Center + Player.DirectionTo(mouseworld) * 750f, rotation: Player.DirectionTo(mouseworld).ToRotation() - MathHelper.PiOver2, vectorScale: new Vector2(0.75f * abyssFlashlightWidthMultiplier, 0.75f), texture: Request<Texture2D>("CalamityMod/Particles/BloomLineFade")));
}
if (lastDeerclopsPosition.HasValue)
{
//While deer is alive and the player is nearby, make it dark
if (Main.npc.Any(x => x.active && x.type == NPCID.Deerclops) && Player.DistanceSQ(lastDeerclopsPosition.Value) < 10240000) //3200^2, or 00 tiles
{
darknessIntensity = MathHelper.Min(Main.LocalPlayer.Calamity().darknessIntensity + 0.06f, 1f); ;
}
//Add the main light circle for the arena
DeerclopsAI.ArenaTex ??= ModContent.Request<Texture2D>(DeerclopsAI.ArenaTexPath);
EnhancedDarknessSystem.lights.Add(new(lastDeerclopsPosition.Value, scale: DeerclopsAI.borderScale, texture: DeerclopsAI.ArenaTex));
//we draw light around the player when far away so they have some visibility, although very small. This is especially nice in multiplayer. we scale opacity with distance bc it looks better
EnhancedDarknessSystem.lights.Add(new EnhancedDarknessSystem.LightSource(scale: 0.75f, opacity: MathHelper.Clamp(Main.LocalPlayer.DistanceSQ(lastDeerclopsPosition.Value) / (409600 /*640^2*/), 0, 1)));
if (darknessIntensity == 0)
{
lastDeerclopsPosition = null;
}
}
//reset the stored Y value for red wine's increased vertical speed
if (redWine && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f))
{
+9 -63
View File
@@ -3030,7 +3030,7 @@ namespace CalamityMod.CalPlayer
#region Abyss Effects
private void AbyssEffects()
{
int lightStrength = Player.GetCurrentAbyssLightLevel();
Player.SetAbyssLightLevels();
if (ZoneAbyss)
{
@@ -3048,42 +3048,7 @@ namespace CalamityMod.CalPlayer
double depthRatioFromAbyssLayer1 = playerAbyssDepthFromLayer1 / totalAbyssDepthFromLayer1;
// Darkness strength scales smoothly with how deep you are.
float darknessStrength = (float)depthRatio;
// Reduce the power of abyss darkness based on your light level.
float multiplier = 1f;
switch (lightStrength)
{
case 0:
break;
case 1:
multiplier = 0.85f;
break;
case 2:
multiplier = 0.7f;
break;
case 3:
multiplier = 0.55f;
break;
case 4:
multiplier = 0.4f;
break;
case 5:
multiplier = 0.25f;
break;
case 6:
multiplier = 0.15f;
break;
case 7:
multiplier = 0.1f;
break;
default:
multiplier = 0.05f;
break;
}
// Modify darkness variable
caveDarkness = darknessStrength * multiplier;
darknessIntensity = abyssDarkness + (float)depthRatio * 3;
// Nebula Headcrab darkness effect
if (!Player.headcovered)
@@ -3223,26 +3188,6 @@ namespace CalamityMod.CalPlayer
// Reduce the power of Signus darkness based on your light level.
float multiplier = 1f;
switch (Main.LocalPlayer.GetCurrentAbyssLightLevel())
{
case 0:
break;
case 1:
case 2:
multiplier = 0.75f;
break;
case 3:
case 4:
multiplier = 0.5f;
break;
case 5:
case 6:
multiplier = 0.25f;
break;
default:
multiplier = 0f;
break;
}
float signusDarkness = signusLifeRatio * multiplier;
darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f);
@@ -3301,7 +3246,7 @@ namespace CalamityMod.CalPlayer
// Aquatic Emblem bonus
if (aquaticEmblem)
{
if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet && !Player.mount.Active)
if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet)
{
if (aquaticBoost < AquaticEmblem.TimeToReachMaxBoost)
{
@@ -3319,12 +3264,13 @@ namespace CalamityMod.CalPlayer
aquaticBoost--;
if (aquaticBoost <= 0f)
aquaticBoost = 0f;
if (Player.mount.Active)
aquaticBoost = 0f;
}
Player.statDefense += (int)Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxDefenseBoost);
Player.moveSpeed -= Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxMoveSpeedReduction);
//Because mounts are unchanged by move speed we also don'y let them have the defense.
if (!Player.mount.Active)
{
Player.statDefense += (int)Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxDefenseBoost);
Player.moveSpeed -= Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxMoveSpeedReduction);
}
}
else
aquaticBoost = 0f;
+8 -4
View File
@@ -204,7 +204,6 @@ namespace CalamityMod.Effects
#region Amber's Shaders
internal static Asset<Effect> PrimitiveClearShader;
internal static Asset<Effect> HolyInfernoShader;
internal static Asset<Effect> DeerclopsShadowShader;
#endregion
#region YuH's Shaders
@@ -213,6 +212,11 @@ namespace CalamityMod.Effects
#region Doze's Shaders
/// <summary>
/// The shader used for Abyss's custom light system.
/// Basically works by turning textures into an opacity mask
/// </summary>
internal static Asset<Effect> DozeLightingShader;
/// <summary>
/// Flips the screen. Used for Gravity Globe.
/// </summary>
internal static Asset<Effect> FlipScreenShader;
@@ -460,9 +464,6 @@ namespace CalamityMod.Effects
HolyInfernoShader = LoadShader("ScreenShaders/HolyInfernoShader");
RegisterMiscShader(HolyInfernoShader, "InfernoPass", "HolyInfernoShader");
DeerclopsShadowShader = LoadShader("ScreenShaders/DeerclopsShadowShader");
RegisterMiscShader(DeerclopsShadowShader, "ShadowPass", "DeerclopsShadowShader");
#endregion
#region Loading YuH's Shaders
@@ -471,6 +472,9 @@ namespace CalamityMod.Effects
#endregion
#region Loading Doze's Shaders
DozeLightingShader = LoadShader("DozeLightingShader");
RegisterMiscShader(DozeLightingShader, "ShadowPass", "DozeLightingShader");
FlipScreenShader = LoadShader("ScreenShaders/FlipScreen");
RegisterScreenShader(FlipScreenShader, "FlipTheScreen", "FlipScreen",EffectPriority.VeryHigh);
+15
View File
@@ -0,0 +1,15 @@
sampler uImage0 : register(s0);
float uOpacity;
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
float4 baseColor = tex2D(uImage0, coords);
return float4(0, 0, 0, (1 - baseColor.x) * uOpacity);
}
technique Technique1
{
pass ShadowPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
@@ -1,52 +0,0 @@
float minRadius;
float maxRadius;
float maxOpacity;
float2 screenPosition;
float2 screenSize;
float2 anchorPoint;
float InverseLerp(float a, float b, float t)
{
return saturate((t - a) / (b - a));
}
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 uv : TEXCOORD0) : COLOR0
{
float2 worldUV = screenPosition + screenSize * uv;
float2 deerclopsUV = anchorPoint / screenSize;
float worldDistance = distance(worldUV, anchorPoint);
// Get the distance to the pixel from Deerclops
float distToDeerclops = distance(anchorPoint, worldUV);
// And get the correct opacity based on it.
float opacity = InverseLerp(0, maxRadius, distToDeerclops);
// Define the border and mix the shadow and light for a smoother transition
bool border = worldDistance < minRadius && opacity > 0;
float colorMult = 1;
if (worldDistance > minRadius && worldDistance < maxRadius)
opacity = lerp(opacity, maxOpacity, InverseLerp(minRadius, maxRadius, distToDeerclops));
opacity = clamp(opacity, 0, maxOpacity);
if (border)
{
colorMult = InverseLerp(minRadius * 0.94, minRadius, worldDistance);
}
// If the color multi has not been changed (not border pixel) and opacity is 0 OR it's within
if (colorMult == 1 && (opacity == 0 || worldDistance < minRadius))
return sampleColor;
return float4(0, 0, 0, 1) * colorMult * opacity;
}
technique Technique1
{
pass ShadowPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
+116
View File
@@ -0,0 +1,116 @@
using System.Collections.Generic;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Light;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
namespace CalamityMod.Graphics
{
public class EnhancedDarknessSystem : ModSystem
{
public class LightSource
{
public Asset<Texture2D> texture;
public float scale = 1;
public Vector2 vectorScale = Vector2.One;
public Vector2 center = Main.LocalPlayer.Center;
public float rotation = 0;
public float opacity = 1;
public LightSource() { }
public LightSource(Vector2? center = null, Asset<Texture2D> texture = null, float scale = 1, float rotation = 0, Vector2? vectorScale = null, float opacity = 1)
{
this.texture = texture ?? ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
this.scale = scale;
this.vectorScale = vectorScale ?? Vector2.One;
this.center = center ?? Main.LocalPlayer.Center;
this.rotation = rotation;
this.opacity = opacity;
}
}
public static List<LightSource> lights = new();
public override void OnModLoad()
{
On_OverlayManager.Draw += DrawShadowOverlay;
On_LightingEngine.UpdateLightDecay += AdjustTransmissiveness;
}
private void DrawShadowOverlay(On_OverlayManager.orig_Draw orig, OverlayManager self, SpriteBatch spriteBatch, RenderLayers layer, bool beginSpriteBatch)
{
orig(self, spriteBatch, layer, beginSpriteBatch);
//This ensures that the shadows only draw
// - In the world
// - Right before UI is drawn (and right before the hideUI check), as that's where RenderLayers.All is drawn
// -
if (Main.gameMenu || layer != RenderLayers.All || Main.LocalPlayer.Calamity().darknessIntensity <= 0)
return;
var mp = Main.LocalPlayer.Calamity();
var device = Main.instance.GraphicsDevice;
using var lease = RenderTargetPool.Shared.Rent(
device,
Main.screenWidth / 2,
Main.screenHeight / 2,
RenderTargetDescriptor.Default
);
using (lease.Scope(clearColor: Color.Black))
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
foreach (var item in lights)
{
Main.spriteBatch.Draw(item.texture.Value, (item.center - Main.screenPosition) * 0.5f, null, Color.White * item.opacity, item.rotation, item.texture.Size() * 0.5f, item.vectorScale * item.scale * 0.5f, SpriteEffects.None, 0);
}
Main.spriteBatch.End();
}
using (Main.spriteBatch.Scope())
{
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
var shader = GameShaders.Misc["CalamityMod:DozeLightingShader"];
shader.UseOpacity(mp.darknessIntensity);
shader.Apply();
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 2, 0, 0);
spriteBatch.End();
}
}
private const float VanillaWaterLightMult = 0.91f; //Vanilla water light multiplier.
private void AdjustTransmissiveness(On_LightingEngine.orig_UpdateLightDecay orig, LightingEngine self)
{
orig(self);
var mp = Main.LocalPlayer.Calamity();
LightMap map = self._workingLightMap;
if (mp.ZoneAbyss)
{
//This converts the light decay amount from the amount it normally is in water into the amount it normally is in air, depending on the intensity of the abyss darkness.
//This is to offset the abyss darkness system to make the parts that are supposed to be visible easier to see.
//Dividing by 0.91 brings the water back to 100% transmissiveness with the original color
map.LightDecayThroughWater = Vector3.Lerp(map.LightDecayThroughWater, (map.LightDecayThroughWater / VanillaWaterLightMult) * 0.95f, MathHelper.Clamp(mp.darknessIntensity, 0, 1));
}
}
public override void OnWorldUnload()
{
lights.Clear();
}
public override void PreUpdateEntities()
{
//Every frame, the light sources are determined by what was added on that frame only. Therefore, we reset the light list every frame.
lights.Clear();
}
}
}
+6 -3
View File
@@ -51,10 +51,13 @@ public abstract class BaseRenderer : ModType
public sealed override void SetStaticDefaults()
{
Main.QueueMainThreadAction(() =>
if (!Main.dedServ)
{
MainTarget = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice);
});
Main.QueueMainThreadAction(() =>
{
MainTarget = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice);
});
}
}
/// <summary>
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories
player.npcTypeNoAggro[NPCID.PinkJellyfish] = true;
player.npcTypeNoAggro[NPCID.Crab] = true;
player.npcTypeNoAggro[NPCID.Squid] = true;
if (player.IsUnderwater())
if (player.Calamity().countsAsAnyWet)
player.gills = true;
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.bloodPact = true; // This applies the +25% health boost.
modPlayer.healingPotionMultiplier += 0.25f;
modPlayer.healingPotionMultiplier += 0.33f;
//Grants immunity to most Bleeding debuffs
player.buffImmune[BuffID.Bleeding] = true;
player.buffImmune[ModContent.BuffType<BurningBlood>()] = true;
+3 -1
View File
@@ -221,7 +221,9 @@ namespace CalamityMod.Items.Accessories
// Detailed Abyss stats only render if the player is in the Abyss.
string stats4 = "\n" + (!modPlayer.ZoneAbyss ? this.GetLocalizedValue("AbyssStatsHidden") : this.GetLocalization("AbyssStats").Format(
player.GetCurrentAbyssLightLevel(),
modPlayer.abyssDarkness,
modPlayer.abyssPlayerGlowMultiplier,
modPlayer.abyssFlashlightWidthMultiplier,
TwoPlaces(modPlayer.abyssBreathLossRateStat),
modPlayer.abyssLifeLostAtZeroBreathStat,
modPlayer.abyssDefenseLossStat));
+17
View File
@@ -22,6 +22,9 @@ namespace CalamityMod.Items.Accessories.Wings
public override float BaseAscent => 0.125f;
public static int wingSlot = 0;
// How powerful the acceleration increase is while pressing UP
// This also affects the flight time tick rate
public static float BoostPower = 2f;
public override void SetStaticDefaults()
{
ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f);
@@ -153,6 +156,20 @@ namespace CalamityMod.Items.Accessories.Wings
// Mirrors the +5% luck from Lucky Horseshoe (vanilla behavior).
player.Calamity().calamityBonusLuck += 0.05f;
}
public override void AdditionalFlightMovement(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
{
if (player.TryingToHoverUp)
{
ascentWhenFalling *= BoostPower;
ascentWhenRising *= BoostPower;
maxCanAscendMultiplier *= BoostPower;
maxAscentMultiplier *= BoostPower;
constantAscend *= BoostPower;
player.wingTime -= BoostPower - 1f;
}
}
public override void AddRecipes()
{
CreateRecipe().
+5 -13
View File
@@ -607,23 +607,15 @@ namespace CalamityMod.Items
// Applies to various item categories which carry their light/breath effects into the Abyss
#region Abyss Light/Breath
// +1 to Abyss light level
if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace ||
if (item.type == ItemID.JellyfishNecklace ||
item.type == ItemID.MiningHelmet || item.type == ItemID.UltrabrightHelmet)
EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1"));
if (item.type == ItemID.JellyfishDivingGear || item.type == ItemID.Magiluminescence)
EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel1"));
EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssGlow"));
if (item.type == ItemID.JellyfishDivingGear)
EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssGlow"));
// +2 to Abyss light level
if (item.type == ItemID.ShinePotion)
EditTooltipByName("BuffTime", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel2"));
if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost)
EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel2"));
// +3 to Abyss light level
if (item.type == ItemID.WispinaBottle || item.type == ItemID.PumpkingPetItem || item.type == ItemID.GolemPetItem || item.type == ItemID.FairyQueenPetItem)
EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel3"));
if (item.type == ItemID.SuspiciousLookingTentacle)
EditTooltipByNum(1, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssLightLevel3"));
EditTooltipByName("BuffTime", (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.AbyssGlow"));
// Moderate breath boost
if (item.type == ItemID.DivingHelmet)
@@ -1,7 +1,7 @@
// Put their internal name here
NPCName: {
Guide: Once tasked with shepherding the Wall of Flesh, the Guide is a godlike figure in Demon folklore. However, the former warlock apprentice now savors a humble life, mentoring adventurers with his sharp intuition.
Dryad: Dryads practice the art of Life Magic, pioneered by Silva. She is connected with nature and can analyze its purity worldwide. She sells seeds, too!
Dryad: The Dryad practices the art of Life Magic, pioneered by Silva. She is connected with nature and can analyze its purity worldwide. She sells seeds, too!
Mechanic: The Mechanic was imprisoned for sticking her nose where she shouldn't. She sells wiring and tools for putting together anything imaginable.
EmpressButterfly: These familiars conjured by the Empress draw power from their surroundings and later bring it to their master. They remind her of a lost loved one, and should one perish in the chaos of night, she shall unleash her full fury upon the attacker.
DemonEye: "{$CommonEntries.DemonEye}"
@@ -58,7 +58,7 @@ NPCName: {
DungeonGuardian: The Old Man is cursed to never leave nor enter the Dungeon, much less die. Whoever crosses paths with him and dares to descend into those halls shall not pass!
BoneSerpentHead: Mighty serpentine beasts ruled hell since before history, later led by the exiled Flame Dragon. For said alliance, their obsidian scales were turned to Ash shortly after his demise. Now their skeletal husks remain, forced to protect the demonic territory using stolen Azafurian spells.
Demon: Despite being a primitive civilization, demons populate most of the underworld. Unlike their lesser brothers, they cast shadow magic rather than hell magic.
VoodooDemon: Demons have several religious practices, specially sacrifices. They worship the Wall of Flesh ever since it started roaming the underworld, using offerings to draw it closer.
VoodooDemon: Demons have several religious practices, especially sacrifices. They worship the Wall of Flesh ever since it started roaming the underworld, using offerings to draw it closer.
RedDevil: Conjuring potent spears of dark magic, these elite demons look after the adventurer that destroyed their perceived deity.
WyvernHead: Deeply in tune with the magic of the world, these serpentine dragons guard the skyward ruins of Chrysadia on behalf of the Storm Dragon. Now, their duty calls louder as divine essence surges through the land.
Harpy: Winged, demi-human creatures from distant southward mountains who came to inhabit Chrysadia after its tragic downfall. They defend their new territory fiercely against invaders with their razor-sharp feathers.
@@ -73,7 +73,7 @@ NPCName: {
PirateCaptain: A pirate captain's love for riches is only rivaled by his desire to explore! Word that the Crusade had seemingly ended spread fast across the world, and abundances to plunder in this continent attracted this sea dweller and his motley crew.
MartianSaucerCore: Following the destruction of their planet by otherworldly creatures, the Martians' military evolved at an unprecedented rate. They were prepared to fight back any future threats, and also pillage any other worlds they could find.
TorchGod: An unknown entity responsible for a torch's eternal flicker, however easily angered by the unsightly, ungrateful abuse of torch placement.
EyeofCthulhu: A gargantuan monster of unknown origins, responsible for plaguing the night with Demon Eyes. It was given the title of "Cthulhu", which means "Great Beast" in the language of dragons.
EyeofCthulhu: A gargantuan monster of unknown origins, responsible for plaguing the night with Demon Eyes. Beasts of such caliber are often given the title of "Cthulhu", a word that meant "great beast" in the language of dragons.
BrainofCthulhu: The death of a god often birthed great monsters due to the volatile nature of godly essence. The culling of such abominations used to be cause for songs and festivities, but now, they only give birth to disappointments.
SkeletronHead: A demonic construct that bursts out of the Old Man when necessary and the most dangerous part of the curse laid by the Dragon Cult. They hoped to stop all intruders with it, but one was too cunning even for them.
WallofFlesh: Originally created by Azafurian mages as a gambit to seal away godly essence, the towering wall broke free after the city's destruction. Its existence was problematic, but its demise has ushered even greater instability upon the world.
@@ -100,7 +100,7 @@ CommonEntries: {
SandShark: Sand Sharks lived in the shallow waters of Ilmeris, hiding beneath the sand. They were thankfully well equipped to deal with the fallout of the Incineration.
AngryBones: Cursed with undeath, the former prisoners of the Dungeon roam endlessly through its halls, seeking a victim for their unending fury.
BlueArmoredBones: Mercenaries hired by Yharim to guard the Dungeon, the Marching Blues were disciplined and relentless, sundering any escapees that decided to rise against their jailors.
HellArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Azafure, the fiery glow of the Molten Legion is unmistakable. If anyone ever tried to hide, their red-hot armaments would melt the hideout immediately.
HellArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Azafure, the fiery glow of the Molten Legion is unmistakable. When the halls of the Dungeon lit up, every prisoner knew hell would be let loose.
RustyArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Underground factions, the Rusted Company's weapons are jagged and rough through use and neglect. The brutality they employed on the field was enough to make many prisoners give up on freedom.
Diabolist: Mages of Azafure who bear the Diabolic Sigil, a certificate of their prowess, wielding flames as intense as any in the underworld. They were effective at blocking passageways and at making prisoners talk.
Necromancer: These sorcerers were trained in Azafure and bore the Necromantic Sign, a certificate of their prowess. Much like they terrorized prisoners with the bodies of their friends, so do they terrorize the Dungeon now.
@@ -13,9 +13,9 @@ DoubleTapDown: Double tap {0}
AggroBoost: Enemies are more likely to target you
AggroReduction: Enemies are less likely to target you
KnockbackImmunity: Grants immunity to knockback
AbyssLightLevel1: Provides a small amount of light in the abyss
AbyssLightLevel2: Provides a moderate amount of light in the abyss
AbyssLightLevel3: Provides a large amount of light in the abyss
AbyssLightLevel: Reduces the darkness intensity of the abyss
AbyssFlashlight: Increases flashlight width in the abyss
AbyssGlow: Increases visibily range in the abyss
AbyssBreathLevel1: Slightly reduces breath loss in the abyss
AbyssBreathLevel2: Moderately reduces breath loss in the abyss
AbyssBreathLevel3: Greatly reduces breath loss in the abyss
@@ -51,6 +51,7 @@ MOAB: {
Tooltip:
'''
{$CommonItemTooltip.FlightAndSlowfall}
{$CommonItemTooltip.PressUpToBooster}
32% increased jump speed and allows auto-jump
Grants the player cloud, blizzard, and sandstorm mid-air jumps
[c/aaaaaa:Shift-<right> this item in your inventory to toggle the] [i:Jetpack] [c/aaaaaa:jetpack]
@@ -185,7 +185,7 @@ AquaticHeart: {
'''
Wow, you can swim now!
Being underwater increases max speed and acceleration by {0}%
Greatly reduces breath loss and provides a small amount of light in the abyss
Greatly reduces breath loss and reduces the darkness intensity in the abyss
Attackers are inflicted with [cbuff:CalamityMod/GlacialState]
Gain a fragile ice barrier that grants {1}% damage reduction for one hit
The ice shield regenerates after {2} seconds
@@ -304,7 +304,6 @@ BlazingCore: {
Upon shattering, holy stars spiral outwards and damage taken is negated
After shattering, this damage reduction effect goes on cooldown
Damage parried whilst on cooldown summons additional healing stars, and will not be reduced
{$Common.AbyssLightLevel2}
'''
}
@@ -324,7 +323,7 @@ BloodPact: {
'''
Increases max HP by 25%
Grants immunity to Bleeding, Burning Blood and Heavy Bleeding
Healing Potions are 25% more effective
Healing Potions are 33% more effective
'''
}
@@ -855,7 +854,8 @@ GiantPearl: {
'''
You have a light aura around you
Enemies within the aura are slowed down
{$Common.AbyssLightLevel1}
Enemies that remain within the aura are bombarded by homing prism shards
{$Common.AbyssGlow}
'''
}
@@ -1823,10 +1823,10 @@ StatMeter: {
MiscStats: Aggro: {0} | Luck: {1}%
AbyssStats:
'''
Abyss Light Strength: {0}
Breath Loss Rate: {1}
Life Lost Per Tick at Zero Breath: {2}
Defense Lost From Pressure: {3}
Abyss Darkness: {0} | Player Glow: {1}x | Flashlight Width: {2}x
Breath Loss Rate: {3}
Life Lost Per Tick at Zero Breath: {4}
Defense Lost From Pressure: {5}
'''
AbyssStatsHidden: Abyss stats are only displayed while in the Abyss
}
@@ -1907,7 +1907,7 @@ TheCamper: {
You deal 50% less damage unless stationary
Standing still grants buffs depending on held item, and creates a damaging aura around you
While moving, you regenerate health as if standing still
{$Common.AbyssLightLevel1}
{$Common.AbyssGlow} when standing still
'In rest may we find victory'
'''
}
@@ -166,6 +166,7 @@ FathomSwarmerVisage: {
{$CommonItemTooltip.IncreasesMaxMinionsBy}
{$CommonItemTooltip.PercentIncreasedSummonDamage@1}
Provides breathing and light underwater
Greatly enhances visibility in the abyss
'''
SetBonus:
'''
@@ -445,7 +446,7 @@ ReaverHeadExplore: {
'''
Emits light and shows the location of treasure and ore
{$Common.AggroReduction} and grants underwater breathing
These have a moderate effect while in the Abyss
Greatly enhances visibility in the abyss
Increased block placement & tool range by {0}
Increases pickup range for items
'''
@@ -178,8 +178,9 @@ RustedJingleBell: {
DisplayName: Rusted Jingle Bell
Tooltip:
'''
Summons a baby ghost bell light pet
Summons a baby ghost bell to light the way for you
Provides a moderate amount of light while underwater
{$Common.AbyssLightLevel}
'''
}
@@ -36,7 +36,6 @@ ChromaticOrb: {
Tooltip:
'''
Summons an ancient dragon light pet that highlights nearby enemies and danger sources
{$Common.AbyssLightLevel1}
'It glows warmly in your hand'
'''
}
@@ -56,7 +55,6 @@ EnchantedButterfly: {
Tooltip:
'''
Summons a mysterious dragonfly light pet
{$Common.AbyssLightLevel1}
'Feed him butterflies to keep him strong!'
'''
}
@@ -80,7 +78,6 @@ FrostyBatBottle: {
Tooltip:
'''
Summons an icy bat to light your way that flies towards your cursor when you dash
{$Common.AbyssLightLevel1}
[c/6ECAC3:'All the world's bats are prime to squeak!']
'''
}
@@ -116,7 +113,7 @@ LittleLight: {
Tooltip:
'''
Summons a small construct that follows you and provides a great amount of light
{$Common.AbyssLightLevel3}
{$Common.AbyssLightLevel}
'It's been looking for you for a long time'
'''
}
@@ -146,7 +143,6 @@ RadiatingCrystal: {
Tooltip:
'''
Summons a radiator light pet
{$Common.AbyssLightLevel1}
'The crystal contains traces of holothurin'
'''
}
@@ -167,6 +163,7 @@ StrangeOrb: {
'''
Summons a miniature Ocean Spirit light pet
Provides a large amount of light while underwater
{$Common.AbyssLightLevel}
'''
}
@@ -194,7 +191,6 @@ ThiefsDime: {
Tooltip:
'''
Summons Goldie the rogue coin to collect nearby coins and light your way
{$Common.AbyssLightLevel1}
'Once worthless treasure, now a relic of a thief's companionship'
'''
}
@@ -204,7 +200,6 @@ ToastyBatBottle: {
Tooltip:
'''
Summons a fiery bat to light your way that leaves a trail of glowing embers
{$Common.AbyssLightLevel1}
[c/CF6454:'Guaranteed to NOT knock you off your hellbridge']
'''
}
+13 -11
View File
@@ -662,12 +662,17 @@ namespace CalamityMod
#endregion
#region Other Player Stats
public static int GetLightStrength(Player p) => p?.GetCurrentAbyssLightLevel() ?? 0;
public static void AddAbyssLightStrength(Player p, int add)
public static float GetDarknessIntensity(Player p)
{
if (p != null)
p.Calamity().externalAbyssLight += add;
return p.Calamity().darknessIntensity;
return 0;
}
public static void AddAbyssLightStrength(Player p, float add)
{
if (p != null)
p.Calamity().abyssDarkness -= add;
}
public static void AddBreathTick(Player p, float add)
@@ -1195,17 +1200,14 @@ namespace CalamityMod
return null;
}
case "GetLight":
case "GetLightLevel":
case "GetLightStrength":
case "GetAbyssLight":
case "GetAbyssLightLevel":
case "GetAbyssLightStrength":
case "GetDarkness":
case "GetAbyssDarkness":
case "GetDarknessIntensity":
if (args.Length < 2)
return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player).");
if (!isValidPlayerArg(args[1]))
return new ArgumentException("ERROR: The argument to \"GetLightStrength\" must be a Player or an int.");
return GetLightStrength(castPlayer(args[1]));
return GetDarknessIntensity(castPlayer(args[1]));
case "AddLight":
case "AddLightLevel":
+118 -90
View File
@@ -1248,112 +1248,150 @@ namespace CalamityMod.NPCs
#region Revengeance and Death Mode Stat Changes
private void RevDeathStatChanges(NPC npc, Mod mod)
{
// Health changes (disabled in Boss Rush)
if (!BossRushEvent.BossRushActive)
{
switch (npc.type)
{
case NPCID.KingSlime:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
break;
case NPCID.EyeofCthulhu:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
break;
case NPCID.ServantofCthulhu:
npc.lifeMax *= 4;
break;
case NPCID.BrainofCthulhu:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.75);
break;
case NPCID.Creeper:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.1);
break;
case NPCID.QueenBee:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
break;
case NPCID.Bee:
case NPCID.BeeSmall:
if (CalamityPlayer.areThereAnyDamnBosses)
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
break;
case NPCID.Deerclops:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
break;
case NPCID.SkeletronHand:
npc.lifeMax = (int)Math.Round(npc.lifeMax * (CalamityWorld.death ? 0.5 : 0.75));
break;
case NPCID.WallofFlesh:
case NPCID.WallofFleshEye:
npc.lifeMax *= 2;
break;
case NPCID.QueenSlimeBoss:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
break;
case NPCID.Retinazer:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
break;
case NPCID.Spazmatism:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.3);
break;
case NPCID.Probe:
if (CalamityWorld.death)
npc.lifeMax *= 2;
break;
case NPCID.SkeletronPrime:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
break;
case NPCID.PrimeCannon:
case NPCID.PrimeSaw:
case NPCID.PrimeVice:
case NPCID.PrimeLaser:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65);
break;
case NPCID.Plantera:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.85);
break;
case NPCID.PlanterasTentacle:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5);
break;
case NPCID.Golem:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.2);
break;
case NPCID.GolemHead:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.28);
break;
case NPCID.GolemFistLeft:
case NPCID.GolemFistRight:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.75);
break;
case NPCID.DukeFishron:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.3);
break;
case NPCID.Sharkron:
case NPCID.Sharkron2:
npc.lifeMax *= 5;
break;
case NPCID.HallowBoss:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7);
break;
case NPCID.CultistBoss:
npc.lifeMax *= 3;
break;
case NPCID.AncientCultistSquidhead:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
break;
case NPCID.MoonLordCore:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.2);
break;
case NPCID.MoonLordHand:
case NPCID.MoonLordHead:
case NPCID.MoonLordLeechBlob:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
break;
}
if (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail)
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.4);
}
else if (CalamityNPCTypeSets.Destroyer.Contains(npc.type))
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25);
}
else if (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type))
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
}
}
// Other stat changes
switch (npc.type)
{
case NPCID.KingSlime:
npc.scale = CalamityWorld.death ? (Main.getGoodWorld ? 6f : 2.5f) : (Main.getGoodWorld ? 3f : 1.5f);
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
break;
case NPCID.EyeofCthulhu:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
break;
case NPCID.ServantofCthulhu:
npc.lifeMax *= 4;
break;
case NPCID.BrainofCthulhu:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.75);
break;
case NPCID.Creeper:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.1);
break;
case NPCID.QueenBee:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
npc.defense = 14;
npc.defDefense = npc.defense;
break;
case NPCID.Bee:
case NPCID.BeeSmall:
if (CalamityPlayer.areThereAnyDamnBosses)
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5);
npc.scale *= 1.25f;
}
break;
case NPCID.Deerclops:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
break;
case NPCID.SkeletronHand:
npc.lifeMax = (int)Math.Round(npc.lifeMax * (CalamityWorld.death ? 0.5 : 0.75));
break;
case NPCID.WallofFlesh:
case NPCID.WallofFleshEye:
npc.lifeMax *= 2;
break;
case NPCID.QueenSlimeBoss:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
break;
case NPCID.Retinazer:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
break;
case NPCID.Spazmatism:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.3);
break;
case NPCID.Probe:
if (CalamityWorld.death)
npc.lifeMax *= 2;
npc.scale *= Main.zenithWorld ? 2f : 1.2f;
break;
case NPCID.SkeletronPrime:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
break;
case NPCID.PrimeCannon:
case NPCID.PrimeSaw:
case NPCID.PrimeVice:
case NPCID.PrimeLaser:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65);
npc.scale *= 1.15f;
break;
case NPCID.Plantera:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.85);
break;
case NPCID.PlanterasTentacle:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5);
break;
case NPCID.Golem:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.2);
break;
case NPCID.GolemHead:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.28);
break;
case NPCID.GolemFistLeft:
case NPCID.GolemFistRight:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.75);
npc.scale *= 1.15f;
break;
case NPCID.DukeFishron:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.3);
break;
case NPCID.Sharkron:
case NPCID.Sharkron2:
npc.lifeMax *= 5;
break;
case NPCID.HallowBoss:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7);
break;
case NPCID.CultistBoss:
npc.lifeMax *= 3;
break;
case NPCID.AncientCultistSquidhead:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.8);
break;
case NPCID.MoonLordCore:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.2);
break;
case NPCID.MoonLordHand:
case NPCID.MoonLordHead:
case NPCID.MoonLordLeechBlob:
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2);
break;
case NPCID.Mothron:
npc.scale *= 1.25f;
break;
@@ -1369,18 +1407,12 @@ namespace CalamityMod.NPCs
break;
}
if (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail)
if (CalamityNPCTypeSets.Destroyer.Contains(npc.type))
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.4);
}
else if (CalamityNPCTypeSets.Destroyer.Contains(npc.type))
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25);
npc.scale *= Main.zenithWorld ? 2f : 1.2f;
}
else if (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type))
{
npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4);
if (CalamityWorld.death)
npc.scale *= 1.1f;
}
@@ -4725,10 +4757,6 @@ namespace CalamityMod.NPCs
if (npc.type == NPCID.Deerclops)
{
DeerclopsAI.hasTargetBeenInRange = false;
DeerclopsAI.borderDelay = 7f * 60f;
DeerclopsAI.borderScalar = 0f;
DeerclopsAI.innerBorder = DeerclopsAI.MaxDRIncreaseDistance * 5f;
DeerclopsAI.outerBorder = DeerclopsAI.MaxDRIncreaseDistance * 5f;
}
// Despawn Blazing Wheels and Spike Balls when a boss spawns so they're not annoying and stay in the arena
+1
View File
@@ -293,6 +293,7 @@ namespace CalamityMod.NPCs
"Aeroni", // <@!348174404984766465> (aeroni) (previously: toxin)
"Mixcoatl", // <@!284775927294984203> (.sharzz)
"Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard)
"Tequila", // <@!889175547744239677> (thecrispistofnuggets)
];
private static readonly string[] WizardNames =
[
+3 -3
View File
@@ -2822,7 +2822,7 @@ namespace CalamityMod.NPCs.DevourerofGods
int DialogueIndex;
if (target.statLife - hurtInfo.Damage <= 0)
{
DialogueGroup = "DevourerOfGods.Death";
DialogueGroup = "Mods.CalamityMod.DevourerOfGods.Death";
if (counter == 0)
if (NPC.GetLifePercent() <= 0.25f)
DialogueIndex = 4;// text = "Mods.CalamityMod.Status.Boss.DoGHeadDeath5"; //All that running just to die to a single touch?
@@ -2841,7 +2841,7 @@ namespace CalamityMod.NPCs.DevourerofGods
{
if (counter == 0 && Phase2Started)
{
DialogueGroup = "DevourerOfGods.Running";
DialogueGroup = "Mods.CalamityMod.DevourerOfGods.Running";
if (NPC.GetLifePercent() <= 0.25f)
DialogueIndex = 1;// text = "Mods.CalamityMod.Status.Boss.DoGHeadRunning2"; //WHAT'S THE PROBLEM?! CAN'T RUN ANYMORE?!
else
@@ -2849,7 +2849,7 @@ namespace CalamityMod.NPCs.DevourerofGods
}
else
{
DialogueGroup = "DevourerOfGods.Head";
DialogueGroup = "Mods.CalamityMod.DevourerOfGods.Head";
if (counter > 9)
DialogueIndex = Main.rand.Next(10, 13);// text = headHitKeys[Main.rand.Next(10, 13)]; //DogHead11-13
else if (counter == 9)
+5 -9
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.HiveMind
{
string normalIconPath = "CalamityMod/NPCs/HiveMind/HiveMind_Head_Boss";
string phase2IconPath = "CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss";
normalIconIndex = CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1);
phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1);
}
@@ -277,10 +277,6 @@ namespace CalamityMod.NPCs.HiveMind
frameHeight = frameHeight_P2;
}
// Update NPC Size accordingly
NPC.width = frameWidth;
NPC.height = frameHeight - 2; //Phase 1 Sprite have 2 pixel margin
NPC.frameCounter += 1.0; // Update each 6 ticks
if (NPC.frameCounter >= 6.0)
{
@@ -416,6 +412,10 @@ namespace CalamityMod.NPCs.HiveMind
public override void AI()
{
// Update NPC Size according to Phase Changes
NPC.width = frameWidth;
NPC.height = frameHeight - 2; //Phase 1 Sprite have 2 pixel margin
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
@@ -803,10 +803,6 @@ namespace CalamityMod.NPCs.HiveMind
// Use an attack sooner if being hit
if (NPC.justHit)
phase2timer -= 4;
// Use an attack sooner if target is close
if (NPC.Distance(player.Center) < 160f)
phase2timer -= 2;
}
if (phase2timer <= -180) // No stalling drift mode forever
@@ -1,9 +1,11 @@
using System;
using CalamityMod.Events;
using CalamityMod.Graphics;
using CalamityMod.Systems.Graphic;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -18,15 +20,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
public class DeerclopsAI : VanillaAIOverride
{
public static bool shouldDrawEnrageBorder = true;
public static bool hasTargetBeenInRange = true;
public const float IncreaseDRTriggerDistance = 750f;
public const float MaxDRIncreaseDistance = 1200f;
public static float borderDelay = 10f * 60f;
public static float innerBorder = 750f;
public static float outerBorder = 1200f;
public static float borderScalar = 0f;
public static Vector2 lastDeerclopsPosition;
public static float borderScale = 5f;
public static string ArenaTexPath = "CalamityMod/Particles/LargeBloom";
// Vanilla values
public static int DebrisDamage = 18; // 72
@@ -35,66 +33,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
public static int IceSpikeDamage = 16; // 64 (buffed from 52)
public static int HandDamage = 13; // 52 (buffed from 40)
public override void Load()
{
GeneralDrawLayerSystem.OnAfterEverything += DrawDeerclopsShadow;
}
public override void Unload()
{
GeneralDrawLayerSystem.OnAfterEverything -= DrawDeerclopsShadow;
}
private static void DrawDeerclopsShadow()
{
if (Main.gameMenu)
return;
bool shouldDraw;
var deerclopsInactive = false;
if (NPC.deerclopsBoss >= 0 && NPC.deerclopsBoss.WithinBounds(Main.npc.Length))
{
shouldDraw = Main.npc[NPC.deerclopsBoss].HasValidTarget;
}
else
{
shouldDraw = borderScalar > 0f;
deerclopsInactive = true;
}
if (shouldDraw)
{
var minRadius = innerBorder;
var maxRadius = outerBorder;
// Begin drawing the shadow
var blackTile = TextureAssets.MagicPixel;
var shader = GameShaders.Misc["CalamityMod:DeerclopsShadowShader"].Shader;
shader.Parameters["minRadius"].SetValue(minRadius);
shader.Parameters["maxRadius"].SetValue(maxRadius);
shader.Parameters["anchorPoint"].SetValue(lastDeerclopsPosition);
shader.Parameters["screenPosition"].SetValue(Main.screenPosition);
shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2());
shader.Parameters["maxOpacity"].SetValue(borderScalar);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shader, Main.Transform);
Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight);
Main.spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f);
// Shadow drawing complete
Main.spriteBatch.End();
}
if (deerclopsInactive)
{
// Push the border away and fade out when deerclops is deadge
borderScalar = MathHelper.Clamp(borderScalar - 0.015f, 0f, 1f);
innerBorder += 30f;
outerBorder += 30f;
}
}
public static Asset<Texture2D> ArenaTex;
public override bool AI(Mod mod)
{
@@ -116,7 +55,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (NPC.target.WithinBounds(Main.player.Length) && Main.player[NPC.target].dead)
{
hasTargetBeenInRange = false;
borderScalar = 0.9f;
}
// Target data
@@ -134,8 +72,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
float dustAndDRScalar = Utils.Remap(NPC.localAI[3], 0f, 30f, 0f, 1f);
calamityGlobalNPC.DR = MathHelper.Lerp(0f, 0.9f, dustAndDRScalar);
if (borderDelay > 0f)
borderDelay -= 1f;
if (dustAndDRScalar > 0f)
{
@@ -150,29 +86,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
// Target entered the border for the first time
hasTargetBeenInRange = true;
if (borderDelay > 120f)
borderDelay = 120f;
}
if (innerBorder != IncreaseDRTriggerDistance || MaxDRIncreaseDistance != outerBorder)
{
// Adjust the border IF the new value is lower (helps prevent jumping if you enter the border early while it's on screen but not finished zooming in)
var LerpValue = Utils.GetLerpValue(hasTargetBeenInRange ? 120f : 180f, 0f, borderDelay, true);
var newInner = MathHelper.Lerp(MaxDRIncreaseDistance * 5f, IncreaseDRTriggerDistance, LerpValue);
if (newInner < innerBorder)
innerBorder = newInner;
var newOuter = MathHelper.Lerp(MaxDRIncreaseDistance * 5f, MaxDRIncreaseDistance, LerpValue);
if (newOuter < outerBorder)
outerBorder = newOuter;
}
if ((hasTargetBeenInRange && borderScalar < 1f) || borderDelay > 0f)
{
// Fade in, with full opacity only available after being inside the border for the first time
borderScalar = MathHelper.Clamp(borderScalar + 0.015f, 0f, hasTargetBeenInRange ? 1f : 0.9f);
}
shouldDrawEnrageBorder = CalamityWorld.revenge || CalamityWorld.death;
// Set the last deerclops position (used only for post-death border shenanigans)
lastDeerclopsPosition = NPC.Center;
Main.LocalPlayer.Calamity().lastDeerclopsPosition = NPC.Center;
// Spawn settings
if (NPC.homeTileX == -1 && NPC.homeTileY == -1)
+6
View File
@@ -54,6 +54,7 @@ using Terraria.Utilities;
using Terraria.WorldBuilding;
using static Terraria.ModLoader.ModContent;
using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech;
using CalamityMod.Graphics;
namespace CalamityMod.Projectiles
{
@@ -426,6 +427,11 @@ namespace CalamityMod.Projectiles
#region Pre AI
public override bool PreAI(Projectile projectile)
{
//Light Pets will add light to the abyss darkness.
//This uses local player on purpose, as the abyss darkness system is entirely client side.
if (ProjectileID.Sets.LightPet[projectile.type] && Main.LocalPlayer.Calamity().ZoneAbyss)
EnhancedDarknessSystem.lights.Add(new() { center = projectile.Center, texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle"), scale = 1 });
///Apply Hybrid iframes
if (hybridIframes)
{
+4
View File
@@ -1,4 +1,6 @@
using CalamityMod.CalPlayer;
using CalamityMod.Graphics;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -46,6 +48,8 @@ namespace CalamityMod.Projectiles.Pets
underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir);
if (underwater)
{
if (Main.LocalPlayer.Calamity().ZoneAbyss)
EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 3, texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle") });
Lighting.AddLight(Projectile.Center, 0.3f, 0.9f, 1.5f);
}
else
+5 -1
View File
@@ -1,5 +1,7 @@
using CalamityMod.CalPlayer;
using CalamityMod.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -73,9 +75,11 @@ namespace CalamityMod.Projectiles.Pets
Projectile.frame = sleepy ? 16 : 8;
}
}
underwater = player.IsUnderwater();
underwater = player.Calamity().countsAsAnyWet;
if (underwater)
{
if (Main.LocalPlayer.Calamity().ZoneAbyss)
EnhancedDarknessSystem.lights.Add(new() { center = Projectile.Center, rotation = 0, scale = 6, texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle") });
if (Projectile.frame == 16)
Projectile.frame = 0;
if (sleepyTimer > 0)
+3 -3
View File
@@ -235,9 +235,9 @@ namespace CalamityMod.Systems.Collections
{ NPCType<KingSlimeJewelRuby>(), 21000 },
{ NPCID.EyeofCthulhu, 450000 }, // 30 seconds
{ NPCID.ServantofCthulhu, 6000 },
{ NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start
{ NPCID.EaterofWorldsBody, 10000 },
{ NPCID.EaterofWorldsTail, 10000 },
{ NPCID.EaterofWorldsHead, 15000 }, // 30 seconds + immunity timer at start
{ NPCID.EaterofWorldsBody, 15000 },
{ NPCID.EaterofWorldsTail, 15000 },
{ NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers
{ NPCID.Creeper, 10000 },
{ NPCID.QueenBee, 315000 }, // 30 seconds
-21
View File
@@ -34,28 +34,7 @@ namespace CalamityMod.Systems
{
float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax);
// Reduce the power of Signus darkness based on your light level.
float multiplier = 1f;
switch (Main.LocalPlayer.GetCurrentAbyssLightLevel())
{
case 0:
break;
case 1:
case 2:
multiplier = 0.75f;
break;
case 3:
case 4:
multiplier = 0.5f;
break;
case 5:
case 6:
multiplier = 0.25f;
break;
default:
multiplier = 0f;
break;
}
// Total darkness
float signusDarkness = signusLifeRatio * multiplier;
+30 -53
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Utilities.Daybreak;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -147,35 +148,27 @@ namespace CalamityMod.UI.ResourceSets
}
if (drawType == 0) //bars
{
int width = snapshot.AmountOfLifeHearts * 12;
float pixelsPerLife = 12f / snapshot.LifePerSegment;
int deadPixels = (int)MathF.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife);
int bleedPixels = (int)MathF.Ceiling((float)bleed * pixelsPerLife);
bleedPixels = Math.Min(bleedPixels, width - deadPixels);
// This works by dynamically creating a texture that it then draws over the life bar.
int width = 12 * snapshot.AmountOfLifeHearts;
GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice;
var barOverlay = new Texture2D(_graphicsDevice, width, 12);
Color[] barTextureData = new Color[12 * 12];
CalamityUIResourceSets.HPChaliceBleed.Bar.Value.GetData(barTextureData);
var pixelsPerLife = 12f / snapshot.LifePerSegment;
int deadPixels = (int)Math.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife);
var bleedPixels = Math.Round(bleed * pixelsPerLife);
if (bleedPixels < 0)
return;
Color[] textureData = new Color[width * 12];
int barMaxStatX = (int)position.X - width;
int drawX = barMaxStatX + deadPixels;
// doze 19MAR2025 - I don't know if I could optimize this any further without switching to shaders.
// I don't expect performance issues, but at some point might be worth adding a config to disable the indicator in case of lag or accessibility concerns
for (int i = 0; i < textureData.Length; i++)
{
var i_MOD_width = i % width; //minor optimization, calculated here once instead of twice in the loop.
var bleedCol = Color.Transparent;
if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels))
{
bleedCol = barTextureData[((i % 12) + (i / width) * 12)];
}
textureData[i] = bleedCol;
}
barOverlay.SetData(textureData);
Main.spriteBatch.Draw(barOverlay, position, null, Color.White, 0, new Vector2(width, 0), 1, SpriteEffects.None, 1);
using (Main.spriteBatch.Scope())
{
var bleedDrawPos = new Vector2(drawX, position.Y);
var bleedDrawRect = new Rectangle(deadPixels % 12, 0, bleedPixels, 12);
var bleedDrawOrigin = new Vector2(0, 0);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix);
Main.spriteBatch.Draw(CalamityUIResourceSets.HPChaliceBleed.Bar.Value, bleedDrawPos, bleedDrawRect, Color.White, 0, bleedDrawOrigin, 1, SpriteEffects.None, 1);
Main.spriteBatch.End();
}
}
else if (drawType == 1) //default heart
{
@@ -244,37 +237,21 @@ namespace CalamityMod.UI.ResourceSets
}
if (drawType == 0) //bars
{
float pixelsPerStar = 12f / snapshot.ManaPerSegment;
int bleedPixels = (int)MathF.Ceiling((float)mana * pixelsPerStar);
// This works by dynamically creating a texture that it then draws over the life bar.
int width = 12 * stars;
if (width < 1)
width = 1;
GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice;
var barOverlay = new Texture2D(_graphicsDevice, width, 12);
Color[] barTextureData = new Color[12 * 12];
manaSet.Bar.Value.GetData(barTextureData);
var pixelsPerLife = 12f / snapshot.ManaPerSegment;
int deadPixels = (int)Math.Floor((snapshot.ManaMax + snapshot.Mana) * pixelsPerLife);
var bleedPixels = Math.Round(mana * pixelsPerLife);
if (bleedPixels < 0)
return;
Color[] textureData = new Color[width * 12];
// doze 19MAR2025 - I don't know if I could optimize this any further without switching to shaders.
// I don't expect performance issues, but at some point might be worth adding a config to disable the indicator in case of lag or accessibility concerns
for (int i = 0; i < textureData.Length; i++)
using (Main.spriteBatch.Scope())
{
var i_MOD_width = i % width; //minor optimization, calculated here once instead of twice in the loop.
var bleedCol = Color.Transparent;
if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels))
{
bleedCol = barTextureData[((i % 12) + (i / width) * 12)];
}
textureData[i] = bleedCol;
var bleedDrawPos = new Vector2(position.X, position.Y);
var bleedDrawRect = new Rectangle(-(bleedPixels % 12), 0, bleedPixels, 12);
var bleedDrawOrigin = new Vector2(bleedPixels, 0);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix);
Main.spriteBatch.Draw(CalamityUIResourceSets.MPManaBurn.Bar.Value, bleedDrawPos, bleedDrawRect, Color.White, 0, bleedDrawOrigin, 1, SpriteEffects.None, 1);
Main.spriteBatch.End();
}
barOverlay.SetData(textureData);
Main.spriteBatch.Draw(barOverlay, position, null, Color.White, 0, new Vector2(width, 0), 1, SpriteEffects.None, 1);
}
else if (drawType == 1) //default heart
{
+19 -14
View File
@@ -18,33 +18,38 @@ namespace CalamityMod.UI
if (Main.dedServ)
return;
// the other method involving some terraria intrinsic function didn't work, so i'm just ignoring it
var vanillaTitles = Language.FindAll(new Regex("^GameTitle\\.")).ToList();
var customTitles = Language.FindAll(new Regex("^Mods\\.CalamityMod\\.UI\\.WindowTitle\\.")).ToList();
Main.QueueMainThreadAction(() =>
{
// the other method involving some terraria intrinsic function didn't work, so i'm just ignoring it
var vanillaTitles = Language.FindAll(new Regex("^GameTitle\\.")).ToList();
var customTitles = Language.FindAll(new Regex("^Mods\\.CalamityMod\\.UI\\.WindowTitle\\.")).ToList();
var allTitles = new List<LocalizedText>();
allTitles.AddRange(vanillaTitles);
allTitles.AddRange(customTitles);
_calamityModifiedText ??= allTitles[Main.rand.Next(allTitles.Count)];
// this is what vanilla terraria does to set it's title, so i'm replicating that here
Platform.Get<IWindowService>().SetUnicodeTitle(Main.instance.Window, _calamityModifiedText.Value);
Platform.Get<IWindowService>().SetIcon(Main.instance.Window);
var allTitles = new List<LocalizedText>();
allTitles.AddRange(vanillaTitles);
allTitles.AddRange(customTitles);
loaded = true;
_calamityModifiedText ??= allTitles[Main.rand.Next(allTitles.Count)];
// this is what vanilla terraria does to set it's title, so i'm replicating that here
Platform.Get<IWindowService>().SetUnicodeTitle(Main.instance.Window, _calamityModifiedText.Value);
Platform.Get<IWindowService>().SetIcon(Main.instance.Window);
loaded = true;
});
}
public override void Unload()
{
if (Main.dedServ)
return;
Main.QueueMainThreadAction(() =>
{
Platform.Get<IWindowService>().SetUnicodeTitle(Main.instance.Window, Lang.GetRandomGameTitle());
Platform.Get<IWindowService>().SetIcon(Main.instance.Window);
_calamityModifiedText = null;
loaded = false;
});
base.Unload();
}
}
+6 -1
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CalamityMod.Balancing;
@@ -89,6 +90,9 @@ namespace CalamityMod
// Generally this doesn't need to be set to true, as bosses will never have collideX or collideY set to true.
public bool forceNetUpdate = false;
// Player indexes put into this list will not be considered for targetting.
public HashSet<int> excludedPlayers = [];
public CalamityTargetingParameters()
{
}
@@ -410,9 +414,10 @@ namespace CalamityMod
continue;
// ForceSwitch targeting. If the same player from last time is iterated over, just ignore them.
// Player exclusion. If the player is to be excluded, do not consider them.
bool sameTargetAsLastTime = p.whoAmI == npc.oldTarget;
bool notSinglePlayer = Main.netMode != NetmodeID.SinglePlayer;
if (options.targetType == NPCTargetType.ForceSwitch && notSinglePlayer && sameTargetAsLastTime)
if (notSinglePlayer && (options.excludedPlayers.Contains(p.whoAmI) || (options.targetType == NPCTargetType.ForceSwitch && sameTargetAsLastTime)))
continue;
//
+26 -64
View File
@@ -168,82 +168,44 @@ namespace CalamityMod
/// Calculates and returns the player's total light strength. This is used for Abyss darkness, among other things.<br/>
/// The Stat Meter also reports this stat.
/// </summary>
/// <returns>The player's total light strength.</returns>
public static int GetCurrentAbyssLightLevel(this Player player)
public static void SetAbyssLightLevels(this Player player)
{
CalamityPlayer mp = player.Calamity();
int light = mp.externalAbyssLight;
bool underwater = player.IsUnderwater();
bool miningHelmet = player.head == ArmorIDs.Head.MiningHelmet || player.head == ArmorIDs.Head.UltraBrightHelmet;
// The campfire bonus does not apply while in the Abyss.
if (!mp.ZoneAbyss && (player.HasBuff(BuffID.Campfire) || Main.SceneMetrics.HasCampfire))
light += 1;
if (mp.camper) // inherits Campfire so it is +2 in practice
light += 1;
//Things that include darkness multipliers
if (mp.camper)
mp.abyssPlayerGlowMultiplier += Utils.Remap(player.velocity.Length(), 0, 5, 1, 0);
if (miningHelmet)
light += 1;
if (player.hasMagiluminescence)
light += 1;
if (player.lightOrb)
light += 1;
if (player.crimsonHeart)
light += 1;
if (player.magicLantern)
light += 1;
mp.abyssPlayerGlowMultiplier += 0.2f;
if (player.nightVision)
mp.abyssDarkness -= 0.4f;
if (mp.giantPearl)
light += 1;
if (mp.radiator)
light += 1;
if (mp.bendyPet)
light += 1;
if (mp.sparks)
light += 1;
if (mp.thiefsDime)
light += 1;
mp.abyssPlayerGlowMultiplier += 0.2f;
if (mp.fathomSwarmerVisage)
light += 1;
{
mp.abyssDarkness -= 0.2f;
mp.abyssPlayerGlowMultiplier += 0.2f;
mp.abyssFlashlightWidthMultiplier += 0.5f;
}
if (mp.aquaticHeart)
light += 1;
if (mp.purity) // does not stack with downgrades
light += 2;
else if (mp.rOoze || mp.aAmpoule) // the two "yellow lights" do not stack with each other
light += 1;
if (mp.aquaticEmblem && underwater)
light += 1;
if (player.arcticDivingGear && underwater) // inherited by abyssal diving gear/suit. jellyfish necklace is inherited so arctic diving gear is really +2
light += 1;
mp.abyssDarkness -= 0.1f;
if (mp.jellyfishNecklace && underwater) // inherited by jellyfish diving gear and higher
light += 1;
mp.abyssPlayerGlowMultiplier += 0.2f;
if (mp.reaverExplore)
light += 2;
{
mp.abyssDarkness -= 0.2f;
mp.abyssPlayerGlowMultiplier += 0.2f;
mp.abyssFlashlightWidthMultiplier += 0.5f;
}
if (mp.shine)
light += 2;
if (mp.blazingCore)
light += 2;
if (player.redFairy || player.greenFairy || player.blueFairy)
light += 2;
if (mp.babyGhostBell)
light += underwater ? 2 : 1;
if (player.petFlagDD2Ghost)
light += 2;
if (mp.sirenPet)
light += underwater ? 3 : 1;
if (player.petFlagPumpkingPet)
light += 3;
if (player.petFlagGolemPet)
light += 3;
if (player.petFlagFairyQueenPet)
light += 3;
if (player.wisp)
light += 3;
if (player.suspiciouslookingTentacle)
light += 3;
mp.abyssPlayerGlowMultiplier += 0.2f;
if (mp.babyGhostBell && underwater)
mp.abyssDarkness -= 0.1f;
if (mp.sirenPet && underwater)
mp.abyssDarkness -= 0.2f;
if (mp.littleLightPet)
light += 3;
if (mp.profanedCrystalBuffs && !mp.ZoneAbyss)
light += (Main.dayTime || player.lavaWet) ? 2 : 1; // not sure how you'd be in lava in the abyss but go ham I guess
return light;
mp.abyssDarkness -= 0.4f;
}
/// <summary>