From f29ec26c8bcc9c7cfa4419e7ce0343ccf08a810a Mon Sep 17 00:00:00 2001
From: CongratsIsTrash <1q2w3e4dasd@gmail.com>
Date: Sat, 7 Dec 2024 19:58:18 -0500
Subject: [PATCH] Converted lots of comments for GlobalNPC variables into
summary comments
---
NPCs/CalamityGlobalNPC.cs | 143 ++++++++++++++++++++++----------------
1 file changed, 82 insertions(+), 61 deletions(-)
diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs
index b05b259e64..ef40faa387 100644
--- a/NPCs/CalamityGlobalNPC.cs
+++ b/NPCs/CalamityGlobalNPC.cs
@@ -163,78 +163,98 @@ namespace CalamityMod.NPCs
// Evergreen Gin effect
public bool IncreasedSicknessAndWaterEffects_EvergreenGin = false;
- // Biome enrage timer max
+ /// Constant representing the grace period, in frames, in which a boss can remain outside of its native biome before enraging.
public const int biomeEnrageTimerMax = 300;
- // Variable for certain worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target
- // Currently only used by DoG
+ ///
+ /// Variable for certain worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target.
+ /// Currently only used by DoG.
+ ///
public float velocityPriorToPhaseSwap = 0f;
public const float velocityPriorToPhaseSwapIncrement = 0.1f;
public bool ShouldFallThroughPlatforms;
- ///
- /// Allows hostile NPCs to deal damage to the player's defense stat, used mostly for hard-hitting bosses.
- ///
+ /// Allows hostile NPCs to deal damage to the player's defense stat, used mostly for hard-hitting bosses.
public bool canBreakPlayerDefense = false;
- // Total defense loss from some true melee hits and other things that reduce defense
+ /// Set this value to reduce target defense by a flat amount.
public int miscDefenseLoss = 0;
- // Distance values for when bosses increase velocity to catch up to their target
+ ///
+ /// Constant representing a distance of 200 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target.
+ ///
public const float CatchUpDistance200Tiles = 3200f;
+ ///
+ /// Constant representing a distance of 350 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target.
+ ///
public const float CatchUpDistance350Tiles = 5600f;
+ ///
+ /// Constant representing a distance of 400 tiles in pixel measurement.
+ /// Used as a cap on the distance away from a boss a player can be inflicted with Boss Effects.
+ ///
+ private const float BossZenDistance = 6400f;
///
- /// Destroyer laser colors, used for telegraphs
+ /// Destroyer laser colors, used for telegraphs.
/// None = -1, Red = 0, Green = 1, Cyan = 2
///
public int destroyerLaserColor = -1;
- // Boss Zen distance
- private const float BossZenDistance = 6400f;
-
- // Buff most vanilla enemy HP by 25%
+ ///
+ /// Constant multiplier used to increase vanilla enemy health.
+ ///
private const double EnemyHPMultiplier = 1.25;
-
- // Used to nerf desert prehardmode enemies pre-Desert Scourge
+ ///
+ /// Constant multiplier used to decrease the health and/or damage of pre-Hardmode Desert enemies.
+ ///
private const double DesertEnemyStatMultiplier = 0.75;
-
- // Used to nerf Master Mode boss HP (base is 27.5% more than Expert)
+ ///
+ /// Constant multiplier used to decrease vanilla boss health in Master Mode.
+ /// When combined with the universal health multiplier, results in 27.5% more health than Expert Mode.
+ ///
public const double MasterModeBossHPMultiplier = 0.85;
- // Used to nerf Master Mode enemies
+ /// Constant multiplier used to decrease enemy health in Master Mode.
public const double MasterModeEnemyHPMultiplier = 0.75;
+ /// Constant multiplier used to decrease enemy damage in Master Mode.
public const double MasterModeEnemyDamageMultiplier = 0.9;
-
- // Used to nerf Expert and Master Mode enemies
+ /// Constant multiplier used to decrease enemy knockback resistance.
public const float ExpertModeEnemyKnockbackMultiplier = 0.05f;
+ ///
public const float MasterModeEnemyKnockbackMultiplier = 0.1f;
- // HP and damage multipliers for the Early Hardmode Progression Rework
+ /// Constant multiplier used for decreasing the health and damage of mechanical bosses if the Early Hardmode Progression Rework config is enabled.
public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic = 0.8;
+ ///
public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic = 0.9;
+ ///
public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert = 0.9;
+ ///
public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert = 0.95;
- // Used to increase coin drops in Normal Mode
- private const double NPCValueMultiplier_NormalCalamity = 1.5;
-
- // Used to decrease coin drops in Expert Mode
+ /// Constant multiplier used to increase coin drops in Classic Mode.
+ private const double NPCValueMultiplier_ClassicCalamity = 1.5;
+ /// Constant multiplier used to decrease coin drops in Expert Mode.
private const double NPCValueMultiplier_ExpertVanilla = 2.5;
-
- // Used to change the Expert Mode coin drop multiplier
+ ///
private const double NPCValueMultiplier_ExpertCalamity = 1.5;
// Dash damage immunity timer
public const int maxPlayerImmunities = Main.maxPlayers + 1;
public int[] dashImmunityTime = new int[maxPlayerImmunities];
- // Town NPC shop alert animation variables
+ /// Used to control the animation of the Town NPC Shop Alert icon, if the respective config is enabled.
public int shopAlertAnimTimer = 0;
+ ///
public int shopAlertAnimFrame = 0;
- // Set to false for this NPC to be unable to generate proximity Rage, regardless of other factors
+ ///
+ /// If set to false, prevents this NPC from allowing Rage to be generated by nearby players, regardless of other factors.
+ /// Defaults to true.
+ ///
public bool ProvidesProximityRage = true;
// NewAI
@@ -242,24 +262,21 @@ namespace CalamityMod.NPCs
public float[] newAI = new float[maxAIMod];
public int AITimer = 0;
- // Town NPC Patreon
+ /// Used for allowing Patreon names for Town NPCs.
public bool setNewName = true;
- // Stuff used by the Boss Health UI
+ /// If set to true, the Boss Health Bar for this NPC will count the total health of all individual segments using worm segment logic.
public bool SplittingWorm = false;
+ /// If set to true, allows this NPC to draw a Boss Health Bar, regardless of other factors.
public bool CanHaveBossHealthBar = false;
+ /// If set to true, allows for manually disabling this NPC's Boss Health Bar, even if they are still active.
public bool ShouldCloseHPBar = false;
- // Timer for how long an NPC is immune to certain debuffs
+ /// Constant representing the cooldown, in frames, before a boss can be affected by a slowing debuff.
public const int slowingDebuffResistanceMin = 1800;
+ /// Tracks the current slowing debuff cooldown for this NPC.
public int debuffResistanceTimer = 0;
- // If a boss is affected by knockback and a timer for how long that boss is immune to knockback after being knocked back
- public bool bossCanBeKnockedBack = false;
- public const int knockbackResistanceMin = 180;
- public int knockbackResistanceTimer = 0;
-
-
// Debuffs
public int vaporfied = 0;
public int timeSlow = 0;
@@ -300,14 +317,19 @@ namespace CalamityMod.NPCs
public int cursorFocus = 0;
public const int cursorFocusMax = 300;
- // Used by Septic Skewer to prevent enemies from hurting the player when they are pulled into them
+ ///
+ /// If set to true, prevents this NPC from dealing contact damage.
+ /// Used by Septic Skewer's execution attack.
+ ///
public bool pacified = false;
// Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage
// It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently
+ /// Tracks how many stacks of the Shred debuff this NPC is inflicted with.
public int somaShredStacks = 0;
+ /// Tracks the index of the player that inflicted this NPC with Shred, for the purpose of scaling damage.
public int somaShredApplicator = -1;
- // Reduced by the number of active stacks every frame. If it hits zero, one stack disappears.
+ /// Counter used for removing stacks of Shred. The number of stacks is subtracted every frame, and when it hits zero, it is reset and one stack is removed.
public int somaShredFalloff = Shred.StackFalloffFrames;
public int cDepth = 0;
@@ -398,30 +420,34 @@ namespace CalamityMod.NPCs
// Drawing variables.
public FireParticleSet VulnerabilityHexFireDrawer = null;
- // Boss Enrage variable for use with the boss health UI.
- // The logic behind this is as follows:
- // 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player.
- // 2 - Otherwise, check if the demonshade enrage is active. If it is, register this as true. If not, go to step 3.
- // 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4.
- // 4 - Check if Boss Rush isn't active. If so, set this to true.
+ ///
+ /// Boss Enrage variable for use with the boss health UI.
+ /// The logic behind this is as follows:
+ /// 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player.
+ /// 2 - Check if the Demonshade enrage is active. If it is, register this as true. If not, go to step 3.
+ /// 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4.
+ /// 4 - Check if Boss Rush isn't active. If so, set this to true.
+ ///
public bool CurrentlyEnraged;
- // Increased defense or DR variable for use with the boss health UI.
- // The logic behind this is as follows:
- // 1 - When bosses are transitioning phases they gain a massive DR increase.
- // 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase.
+ ///
+ /// Increased defense or DR variable for use with the boss health UI.
+ /// The logic behind this is as follows:
+ /// 1 - When bosses are transitioning phases they gain a massive DR increase.
+ /// 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase.
+ /// While either of these are occuring, this variable should be set to true.
+ ///
public bool CurrentlyIncreasingDefenseOrDR;
- // Other Boss Rush stuff
+ /// If set to true, this NPC will be ignored by Boss Rush's whitelist and will always be allowed to exist.
public bool DoesNotDisappearInBossRush;
- // On-Kill variables
+ /// Variable used for Gladiator's Locket's on-kill effect to ensure it only triggers once per kill.
public bool gladiatorOnKill = true;
-
- // Variable for if enemy has been recently hit by an ArcZap
+ /// Cooldown variable for Unstable Granite Core's arc zap effect.
public int arcZapCooldown = 0;
- // Animates worms in the bestiary but only when their entry is being looked at
+ /// Timer for animating worm enemies in the bestiary.
public float bestiaryWormTimer = 0;
#endregion
@@ -499,9 +525,6 @@ namespace CalamityMod.NPCs
myClone.debuffResistanceTimer = debuffResistanceTimer;
- myClone.bossCanBeKnockedBack = bossCanBeKnockedBack;
- myClone.knockbackResistanceTimer = knockbackResistanceTimer;
-
myClone.vaporfied = vaporfied;
myClone.timeSlow = timeSlow;
myClone.gState = gState;
@@ -3444,7 +3467,7 @@ namespace CalamityMod.NPCs
// Rebalance coin drops so that Normal Mode enemies and bosses drop an adequate amount of coins.
// Increase Normal Mode coin drops by 1.5x.
- npc.value = (int)(npc.value * NPCValueMultiplier_NormalCalamity);
+ npc.value = (int)(npc.value * NPCValueMultiplier_ClassicCalamity);
// Change the Expert Mode coin drop multiplier.
if (Main.expertMode)
@@ -5487,8 +5510,6 @@ namespace CalamityMod.NPCs
// Debuff decrements
if (debuffResistanceTimer > 0)
debuffResistanceTimer--;
- if (knockbackResistanceTimer > 0)
- knockbackResistanceTimer--;
if (timeSlow > 0)
timeSlow--;