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

◆ ScaleStats_ApplyMultiplayerStats()

void Terraria.NPC.ScaleStats_ApplyMultiplayerStats ( int numPlayers,
float balance,
float boost,
float bossAdjustment )
inlineprivate

Definition at line 13285 of file NPC.cs.

13286 {
13287 int num = numPlayers - 1;
13288 if (type == 5)
13289 {
13290 lifeMax = (int)((float)lifeMax * 0.75f * bossAdjustment);
13291 }
13292 if (type == 4)
13293 {
13294 lifeMax = (int)((double)lifeMax * 0.65 * (double)balance * (double)bossAdjustment);
13295 }
13296 if (type >= 13 && type <= 15)
13297 {
13298 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13299 if (type == 13)
13300 {
13301 damage = (int)((double)damage * 1.1);
13302 }
13303 if (type == 14)
13304 {
13305 damage = (int)((double)damage * 0.8);
13306 }
13307 if (type == 15)
13308 {
13309 damage = (int)((double)damage * 0.8);
13310 }
13311 scale *= 1.2f;
13312 defense += 2;
13313 }
13314 if (type == 266 || type == 267)
13315 {
13316 lifeMax = (int)((double)lifeMax * 0.85 * (double)balance * (double)bossAdjustment);
13317 damage = (int)((double)damage * 0.9);
13318 scale *= 1.05f;
13319 for (float num2 = 1f; num2 < balance; num2 += 0.34f)
13320 {
13321 if ((double)knockBackResist < 0.1)
13322 {
13323 knockBackResist = 0f;
13324 break;
13325 }
13326 knockBackResist *= 0.8f;
13327 }
13328 }
13329 if (type == 50)
13330 {
13331 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13332 damage = (int)((double)damage * 0.8);
13333 }
13334 if (type == 471)
13335 {
13336 lifeMax = (int)((double)lifeMax * 0.85 * (double)(balance * 2f + 1f) / 3.0);
13337 }
13338 if (type == 472)
13339 {
13340 lifeMax = (int)((double)lifeMax * 0.85 * (double)(balance + 1f) / 2.0);
13341 damage = (int)((double)damage * 0.8);
13342 }
13343 if (type == 222)
13344 {
13345 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13346 damage = (int)((double)damage * 0.9);
13347 }
13348 if (type == 210 || type == 211)
13349 {
13350 lifeMax = (int)((double)lifeMax * 0.75);
13351 }
13352 if (type == 35)
13353 {
13354 lifeMax = (int)((float)lifeMax * balance * bossAdjustment);
13355 damage = (int)((double)damage * 1.1);
13356 }
13357 else if (type == 36)
13358 {
13359 lifeMax = (int)((double)lifeMax * 1.3 * (double)balance * (double)bossAdjustment);
13360 damage = (int)((double)damage * 1.1);
13361 }
13362 if (type == 668)
13363 {
13364 lifeMax = (int)((double)lifeMax * 0.85 * (double)balance * (double)bossAdjustment);
13365 damage = damage;
13366 }
13367 if (type == 113 || type == 114)
13368 {
13369 defense += 6;
13370 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13371 damage = (int)((double)damage * 1.5);
13372 }
13373 else if (type == 115)
13374 {
13375 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance);
13376 if (numPlayers > 4)
13377 {
13378 knockBackResist = 0f;
13379 }
13380 else if (numPlayers > 1)
13381 {
13382 knockBackResist *= 1f - boost;
13383 }
13384 defense += 6;
13385 }
13386 else if (type == 116)
13387 {
13388 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance);
13389 if (numPlayers > 4)
13390 {
13391 knockBackResist = 0f;
13392 }
13393 else if (numPlayers > 1)
13394 {
13395 knockBackResist *= 1f - boost;
13396 }
13397 }
13398 else if (type == 117 || type == 118 || type == 119)
13399 {
13400 lifeMax = (int)((double)lifeMax * 0.8);
13401 }
13402 if (type == 657)
13403 {
13404 lifeMax = (int)((float)lifeMax * 0.8f * balance * bossAdjustment);
13405 }
13406 if (type >= 658 && type <= 660)
13407 {
13408 lifeMax = (int)((float)lifeMax * 0.75f * balance * bossAdjustment);
13409 }
13410 if (type >= 134 && type <= 136)
13411 {
13412 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13413 if (type == 134)
13414 {
13415 damage *= 2;
13416 }
13417 if (type == 135)
13418 {
13419 damage = (int)((double)damage * 0.85);
13420 }
13421 if (type == 136)
13422 {
13423 damage = (int)((double)damage * 0.85);
13424 }
13425 scale *= 1.05f;
13426 }
13427 else if (type == 139)
13428 {
13429 lifeMax = (int)((double)lifeMax * 0.75 * (double)(balance * 2f + 1f) / 3.0);
13430 damage = (int)((double)damage * 0.8);
13431 scale *= 1.05f;
13432 }
13433 if (type >= 127 && type <= 131)
13434 {
13435 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13436 damage = (int)((double)damage * 0.85);
13437 }
13438 if (type >= 125 && type <= 126)
13439 {
13440 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13441 damage = (int)((double)damage * 0.85);
13442 }
13443 if (type == 262)
13444 {
13445 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13446 damage = (int)((double)damage * 1.15);
13447 }
13448 else if (type == 264)
13449 {
13450 lifeMax = (int)((float)lifeMax * balance * bossAdjustment);
13451 damage = (int)((double)damage * 1.15);
13452 }
13453 if (type == 636)
13454 {
13455 lifeMax = (int)((double)lifeMax * 0.7 * (double)balance * (double)bossAdjustment);
13456 damage = (int)((double)damage * 1.15);
13457 }
13458 if (type >= 245 && type <= 249)
13459 {
13460 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13461 damage = (int)((double)damage * 0.8);
13462 }
13463 if (type == 370)
13464 {
13465 lifeMax = (int)((double)lifeMax * 0.65 * (double)balance * (double)bossAdjustment);
13466 damage = (int)((double)damage * 0.7);
13467 }
13468 else if (type == 371 || type == 372 || type == 373)
13469 {
13470 if (type != 371)
13471 {
13472 lifeMax = (int)((double)lifeMax * 0.75);
13473 }
13474 damage = (int)((double)damage * 0.75);
13475 }
13476 if (type == 439 || type == 440 || (type >= 454 && type <= 459) || type == 522 || type == 523)
13477 {
13478 if (type != 522)
13479 {
13480 lifeMax = (int)((float)lifeMax * 0.75f * balance * bossAdjustment);
13481 }
13482 damage = (int)((double)damage * 0.75);
13483 }
13484 if (type == 397 || type == 396 || type == 398)
13485 {
13486 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13487 damage = (int)((double)damage * 0.75);
13488 }
13489 if (type == 551)
13490 {
13491 lifeMax = (int)((double)lifeMax * 0.75 * (double)balance * (double)bossAdjustment);
13492 damage = (int)((double)damage * 0.65);
13493 }
13495 {
13496 int num3 = 7;
13497 float num4 = (balance * (float)(num3 - 1) + 1f) / (float)num3;
13498 lifeMax = (int)((float)lifeMax * num4 * bossAdjustment);
13499 }
13500 float num5 = 1f + (float)num * 0.2f;
13501 switch (type)
13502 {
13503 case 305:
13504 case 306:
13505 case 307:
13506 case 308:
13507 case 309:
13508 case 310:
13509 case 311:
13510 case 312:
13511 case 313:
13512 case 314:
13513 case 326:
13514 case 329:
13515 case 330:
13516 lifeMax = (int)((double)lifeMax * 0.75 * (double)num5);
13517 damage = (int)((double)damage * 0.75);
13518 break;
13519 case 315:
13520 case 325:
13521 case 327:
13522 lifeMax = (int)((double)lifeMax * 0.65 * (double)bossAdjustment);
13523 damage = (int)((double)damage * 0.75);
13524 break;
13525 }
13526 switch (type)
13527 {
13528 case 338:
13529 case 339:
13530 case 340:
13531 case 341:
13532 case 342:
13533 case 343:
13534 case 347:
13535 case 348:
13536 case 349:
13537 case 350:
13538 case 351:
13539 case 352:
13540 lifeMax = (int)((double)lifeMax * 0.75 * (double)num5);
13541 damage = (int)((double)damage * 0.75);
13542 break;
13543 case 344:
13544 case 345:
13545 case 346:
13546 lifeMax = (int)((double)lifeMax * 0.65 * (double)bossAdjustment);
13547 damage = (int)((double)damage * 0.75);
13548 break;
13549 }
13550 if (Main.getGoodWorld)
13551 {
13552 if (type == 6 && AnyNPCs(13))
13553 {
13554 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
13555 defense += 2;
13556 }
13557 if (type == 32 && AnyNPCs(35))
13558 {
13559 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
13560 defense += 6;
13561 }
13562 if (type == 24 && AnyNPCs(113))
13563 {
13564 lifeMax = (int)((double)lifeMax * 1.5 * (double)bossAdjustment);
13565 defense += 10;
13566 }
13567 }
13570 defDamage = damage;
13571 life = lifeMax;
13572 }
static bool[] BelongsToInvasionOldOnesArmy
If true for a given NPC type (F:Terraria.NPC.type), then that NPC belongs to the Old One's Army event...
Definition NPCID.cs:292
static void ApplyDifficultyAndPlayerScaling(NPC npc, int numPlayers, float balance, float bossAdjustment)
Definition NPCLoader.cs:472
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
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
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 knockBackResist
How much of the knockback it receives will actually apply. 1f: full knockback; 0f: no knockback....
Definition NPC.cs:1110
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
Definition NPC.cs:1104
static bool AnyNPCs(int Type)
Returns true if there are any active NPC in the world of the given NPC type (F:Terraria....
Definition NPC.cs:106615
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
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
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

References Terraria.NPC.AnyNPCs(), Terraria.ModLoader.NPCLoader.ApplyDifficultyAndPlayerScaling(), Terraria.ID.NPCID.Sets.BelongsToInvasionOldOnesArmy, Terraria.NPC.damage, Terraria.NPC.defDamage, Terraria.NPC.defDefense, Terraria.NPC.defense, Terraria.Main.getGoodWorld, Terraria.NPC.knockBackResist, Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.NPC.scale, and Terraria.NPC.type.

Referenced by Terraria.NPC.ScaleStats().

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