TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ ScaleStats()

void Terraria.NPC.ScaleStats ( int? activePlayersCount,
GameModeData gameModeData,
float? strengthOverride )
inline

Definition at line 13077 of file NPC.cs.

13078 {
13079 if ((!NPCID.Sets.NeedsExpertScaling.IndexInRange(type) || !NPCID.Sets.NeedsExpertScaling[type]) && (lifeMax <= 5 || damage == 0 || friendly || townNPC))
13080 {
13081 return;
13082 }
13083 float num = 1f;
13084 if (strengthOverride.HasValue)
13085 {
13086 num = strengthOverride.Value;
13087 }
13088 else if (gameModeData.IsJourneyMode)
13089 {
13091 if (power != null && power.GetIsUnlocked())
13092 {
13093 num = power.StrengthMultiplierToGiveNPCs;
13094 }
13095 }
13096 float num2 = num;
13097 if (gameModeData.IsJourneyMode && Main.getGoodWorld)
13098 {
13099 num += 1f;
13100 }
13101 NPCStrengthHelper nPCStrengthHelper = new NPCStrengthHelper(gameModeData, num, Main.getGoodWorld);
13102 if (nPCStrengthHelper.IsExpertMode)
13103 {
13105 }
13106 ScaleStats_ApplyGameMode(gameModeData);
13107 if (Main.getGoodWorld && nPCStrengthHelper.ExtraDamageForGetGoodWorld)
13108 {
13109 damage += damage / 3;
13110 }
13111 if (nPCStrengthHelper.IsExpertMode)
13112 {
13113 int num3 = 1;
13116 float bossAdjustment = 1f;
13117 if (nPCStrengthHelper.IsMasterMode)
13118 {
13119 bossAdjustment = 0.85f;
13120 }
13122 }
13125 if ((type < 0 || !NPCID.Sets.ProjectileNPC[type]) && lifeMax < 6)
13126 {
13127 lifeMax = 6;
13128 }
13129 life = lifeMax;
13130 defDamage = damage;
13132 }
static bool[] NeedsExpertScaling
If true for a given NPC type (F:Terraria.NPC.type), then that NPC will receive stat scaling in Expert...
Definition NPCID.cs:357
static bool[] ProjectileNPC
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is treated specially for difficulty...
Definition NPCID.cs:365
void ScaleStats_ApplyGameMode(GameModeData gameModeData)
Definition NPC.cs:13268
int defense
How resistant to damage this NPC is. The List of NPCs wiki pagecan be useful for finding appropriat...
Definition NPC.cs:1033
int damage
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done...
Definition NPC.cs:1027
void ScaleStats_ApplyExpertTweaks()
Definition NPC.cs:13217
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
int defDefense
Stores the value of F:Terraria.NPC.defense at the end of SetDefaults. Useful for scaling defense in A...
Definition NPC.cs:1043
float strengthMultiplier
Definition NPC.cs:1172
bool friendly
Indicates that an NPC is friendly to players. If true, a player won't damage the NPC and the NPC won'...
Definition NPC.cs:1197
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
static int GetActivePlayerCount()
Definition NPC.cs:13200
void ScaleStats_ApplyMultiplayerStats(int numPlayers, float balance, float boost, float bossAdjustment)
Definition NPC.cs:13285
int defDamage
Stores the value of F:Terraria.NPC.damage at the end of SetDefaults. Useful for scaling damage in AI ...
Definition NPC.cs:1038
static void GetStatScalingFactors(int numPlayers, out float balance, out float boost)
Definition NPC.cs:13574
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
Definition NPC.cs:1072
void ScaleStats_UseStrengthMultiplier(float strength)
Definition NPC.cs:13134
int statsAreScaledForThisManyPlayers
Definition NPC.cs:1170
bool townNPC
Definition NPC.cs:1174

References Terraria.NPC.damage, Terraria.NPC.defDamage, Terraria.NPC.defDefense, Terraria.NPC.defense, Terraria.NPC.friendly, Terraria.NPC.GetActivePlayerCount(), Terraria.Main.getGoodWorld, Terraria.NPC.GetStatScalingFactors(), Terraria.GameContent.Creative.CreativePowerManager.Instance, Terraria.DataStructures.GameModeData.IsJourneyMode, Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.ID.NPCID.Sets.NeedsExpertScaling, Terraria.ID.NPCID.Sets.ProjectileNPC, Terraria.NPC.ScaleStats_ApplyExpertTweaks(), Terraria.NPC.ScaleStats_ApplyGameMode(), Terraria.NPC.ScaleStats_ApplyMultiplayerStats(), Terraria.NPC.ScaleStats_UseStrengthMultiplier(), Terraria.NPC.statsAreScaledForThisManyPlayers, Terraria.NPC.strengthMultiplier, Terraria.NPC.townNPC, and Terraria.NPC.type.

Referenced by Terraria.NPC.SetDefaults(), and Terraria.NPC.SetDefaultsFromNetId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: