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

◆ UpdateNPC_BuffApplyDOTs()

void Terraria.NPC.UpdateNPC_BuffApplyDOTs ( )
inlineprivate

Definition at line 88284 of file NPC.cs.

88285 {
88286 if (dontTakeDamage)
88287 {
88288 return;
88289 }
88291 if (poisoned)
88292 {
88293 if (lifeRegen > 0)
88294 {
88295 lifeRegen = 0;
88296 }
88297 lifeRegen -= 12;
88298 }
88299 if (onFire)
88300 {
88301 if (lifeRegen > 0)
88302 {
88303 lifeRegen = 0;
88304 }
88305 lifeRegen -= 8;
88306 }
88307 if (onFire3)
88308 {
88309 if (lifeRegen > 0)
88310 {
88311 lifeRegen = 0;
88312 }
88313 lifeRegen -= 30;
88314 if (num < 5)
88315 {
88316 num = 5;
88317 }
88318 }
88319 if (onFrostBurn)
88320 {
88321 if (lifeRegen > 0)
88322 {
88323 lifeRegen = 0;
88324 }
88325 lifeRegen -= 16;
88326 if (num < 2)
88327 {
88328 num = 2;
88329 }
88330 }
88331 if (onFrostBurn2)
88332 {
88333 if (lifeRegen > 0)
88334 {
88335 lifeRegen = 0;
88336 }
88337 lifeRegen -= 50;
88338 if (num < 10)
88339 {
88340 num = 10;
88341 }
88342 }
88343 if (onFire2)
88344 {
88345 if (lifeRegen > 0)
88346 {
88347 lifeRegen = 0;
88348 }
88349 lifeRegen -= 48;
88350 if (num < 10)
88351 {
88352 num = 10;
88353 }
88354 }
88355 if (venom)
88356 {
88357 if (lifeRegen > 0)
88358 {
88359 lifeRegen = 0;
88360 }
88361 lifeRegen -= 60;
88362 if (num < 15)
88363 {
88364 num = 15;
88365 }
88366 }
88367 if (shadowFlame)
88368 {
88369 if (lifeRegen > 0)
88370 {
88371 lifeRegen = 0;
88372 }
88373 lifeRegen -= 30;
88374 if (num < 5)
88375 {
88376 num = 5;
88377 }
88378 }
88380 {
88381 if (lifeRegen > 0)
88382 {
88383 lifeRegen = 0;
88384 }
88385 lifeRegen -= 50;
88386 if (num < 10)
88387 {
88388 num = 10;
88389 }
88390 }
88391 if (javelined)
88392 {
88393 if (lifeRegen > 0)
88394 {
88395 lifeRegen = 0;
88396 }
88397 int num2 = 0;
88398 int num3 = 1;
88399 for (int i = 0; i < 1000; i++)
88400 {
88401 if (Main.projectile[i].active && Main.projectile[i].type == 598 && Main.projectile[i].ai[0] == 1f && Main.projectile[i].ai[1] == (float)whoAmI)
88402 {
88403 num2++;
88404 }
88405 }
88406 lifeRegen -= num2 * 2 * 3;
88407 if (num < num2 * 3 / num3)
88408 {
88409 num = num2 * 3 / num3;
88410 }
88411 }
88412 if (tentacleSpiked)
88413 {
88414 if (lifeRegen > 0)
88415 {
88416 lifeRegen = 0;
88417 }
88418 int num4 = 0;
88419 int num5 = 1;
88420 for (int j = 0; j < 1000; j++)
88421 {
88422 if (Main.projectile[j].active && Main.projectile[j].type == 971 && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)whoAmI)
88423 {
88424 num4++;
88425 }
88426 }
88427 lifeRegen -= num4 * 2 * 3;
88428 if (num < num4 * 3 / num5)
88429 {
88430 num = num4 * 3 / num5;
88431 }
88432 }
88433 if (bloodButchered)
88434 {
88435 if (lifeRegen > 0)
88436 {
88437 lifeRegen = 0;
88438 }
88439 int num6 = 0;
88440 int num7 = 1;
88441 for (int k = 0; k < 1000; k++)
88442 {
88443 if (Main.projectile[k].active && Main.projectile[k].type == 975 && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == (float)whoAmI)
88444 {
88445 num6++;
88446 }
88447 }
88448 lifeRegen -= num6 * 2 * 4;
88449 if (num < num6 * 4 / num7)
88450 {
88451 num = num6 * 4 / num7;
88452 }
88453 }
88454 if (daybreak)
88455 {
88456 if (lifeRegen > 0)
88457 {
88458 lifeRegen = 0;
88459 }
88460 int num8 = 0;
88461 int num9 = 4;
88462 for (int l = 0; l < 1000; l++)
88463 {
88464 if (Main.projectile[l].active && Main.projectile[l].type == 636 && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)whoAmI)
88465 {
88466 num8++;
88467 }
88468 }
88469 if (num8 == 0)
88470 {
88471 num8 = 1;
88472 }
88473 lifeRegen -= num8 * 2 * 100;
88474 if (num < num8 * 100 / num9)
88475 {
88476 num = num8 * 100 / num9;
88477 }
88478 }
88479 if (celled)
88480 {
88481 if (lifeRegen > 0)
88482 {
88483 lifeRegen = 0;
88484 }
88485 int num10 = 0;
88486 for (int m = 0; m < 1000; m++)
88487 {
88488 if (Main.projectile[m].active && Main.projectile[m].type == 614 && Main.projectile[m].ai[0] == 1f && Main.projectile[m].ai[1] == (float)whoAmI)
88489 {
88490 num10++;
88491 }
88492 }
88493 lifeRegen -= num10 * 2 * 20;
88494 if (num < num10 * 20)
88495 {
88496 num = num10 * 20 / 2;
88497 }
88498 }
88499 if (dryadBane)
88500 {
88501 int num11 = 4;
88502 float num12 = 1f;
88503 if (lifeRegen > 0)
88504 {
88505 lifeRegen = 0;
88506 }
88507 if (downedBoss1)
88508 {
88509 num12 += 0.1f;
88510 }
88511 if (downedBoss2)
88512 {
88513 num12 += 0.1f;
88514 }
88515 if (downedBoss3)
88516 {
88517 num12 += 0.1f;
88518 }
88519 if (downedQueenBee)
88520 {
88521 num12 += 0.1f;
88522 }
88523 if (Main.hardMode)
88524 {
88525 num12 += 0.4f;
88526 }
88527 if (downedMechBoss1)
88528 {
88529 num12 += 0.15f;
88530 }
88531 if (downedMechBoss2)
88532 {
88533 num12 += 0.15f;
88534 }
88535 if (downedMechBoss3)
88536 {
88537 num12 += 0.15f;
88538 }
88539 if (downedPlantBoss)
88540 {
88541 num12 += 0.15f;
88542 }
88543 if (downedGolemBoss)
88544 {
88545 num12 += 0.15f;
88546 }
88548 {
88549 num12 += 0.15f;
88550 }
88551 if (Main.expertMode)
88552 {
88553 num12 *= Main.GameModeInfo.TownNPCDamageMultiplier;
88554 }
88555 num11 = (int)((float)num11 * num12);
88556 lifeRegen -= 2 * num11;
88557 if (num < num11)
88558 {
88559 num = num11 / 3;
88560 }
88561 }
88562 if (soulDrain && realLife == -1)
88563 {
88564 if (lifeRegen > 0)
88565 {
88566 lifeRegen = 0;
88567 }
88568 lifeRegen -= 50;
88569 if (num < 5)
88570 {
88571 num = 5;
88572 }
88573 }
88574 if (lifeRegen <= -240 && num < 2)
88575 {
88576 num = 2;
88577 }
88579 while (lifeRegenCount >= 120)
88580 {
88581 lifeRegenCount -= 120;
88582 if (!immortal)
88583 {
88584 if (life < lifeMax)
88585 {
88586 life++;
88587 }
88588 if (life > lifeMax)
88589 {
88590 life = lifeMax;
88591 }
88592 }
88593 }
88594 if (num > 0)
88595 {
88596 while (lifeRegenCount <= -120 * num)
88597 {
88598 lifeRegenCount += 120 * num;
88599 int num13 = whoAmI;
88600 if (realLife >= 0)
88601 {
88602 num13 = realLife;
88603 }
88604 if (!Main.npc[num13].immortal)
88605 {
88606 Main.npc[num13].life -= num;
88607 }
88608 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, num, dramatic: false, dot: true);
88609 if (Main.npc[num13].life > 0 || Main.npc[num13].immortal)
88610 {
88611 continue;
88612 }
88613 Main.npc[num13].life = 1;
88614 if (Main.netMode != 1)
88615 {
88616 Main.npc[num13].StrikeNPCNoInteraction(9999, 0f, 0);
88617 if (Main.netMode == 2)
88618 {
88619 NetMessage.SendData(28, -1, -1, null, num13, 9999f);
88620 }
88621 }
88622 }
88623 return;
88624 }
88625 while (lifeRegenCount <= -120)
88626 {
88627 lifeRegenCount += 120;
88628 int num14 = whoAmI;
88629 if (realLife >= 0)
88630 {
88631 num14 = realLife;
88632 }
88633 if (!Main.npc[num14].immortal)
88634 {
88635 Main.npc[num14].life--;
88636 }
88637 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, 1, dramatic: false, dot: true);
88638 if (Main.npc[num14].life > 0 || Main.npc[num14].immortal)
88639 {
88640 continue;
88641 }
88642 Main.npc[num14].life = 1;
88643 if (Main.netMode != 1)
88644 {
88645 Main.npc[num14].StrikeNPCNoInteraction(9999, 0f, 0);
88646 if (Main.netMode == 2)
88647 {
88648 NetMessage.SendData(28, -1, -1, null, num14, 9999f);
88649 }
88650 }
88651 }
88652 }
Vector2 position
Definition Entity.cs:14
bool dryadBane
Definition NPC.cs:275
bool immortal
Definition NPC.cs:261
static bool downedMechBoss2
Definition NPC.cs:425
bool onFire2
Definition NPC.cs:227
bool venom
Definition NPC.cs:239
bool soulDrain
Definition NPC.cs:243
static bool downedBoss2
Definition NPC.cs:347
bool poisoned
Definition NPC.cs:235
int lifeMax
Definition NPC.cs:479
int lifeRegenExpectedLossPerSecond
Definition NPC.cs:251
bool oiled
Definition NPC.cs:283
static bool downedBoss1
Definition NPC.cs:345
bool dontTakeDamage
Definition NPC.cs:527
static bool downedMechBoss3
Definition NPC.cs:427
bool onFire
Definition NPC.cs:225
int lifeRegen
Definition NPC.cs:247
static bool downedQueenBee
Definition NPC.cs:351
bool bloodButchered
Definition NPC.cs:271
bool tentacleSpiked
Definition NPC.cs:269
static bool downedGolemBoss
Definition NPC.cs:365
bool celled
Definition NPC.cs:273
bool javelined
Definition NPC.cs:267
static bool downedAncientCultist
Definition NPC.cs:381
static bool downedBoss3
Definition NPC.cs:349
int life
Definition NPC.cs:477
static bool downedPlantBoss
Definition NPC.cs:363
bool shadowFlame
Definition NPC.cs:241
bool onFrostBurn2
Definition NPC.cs:233
bool daybreak
Definition NPC.cs:277
bool onFire3
Definition NPC.cs:229
int realLife
Definition NPC.cs:173
bool onFrostBurn
Definition NPC.cs:231
static bool downedMechBoss1
Definition NPC.cs:423
int lifeRegenCount
Definition NPC.cs:249

References Terraria.Main.expertMode, Terraria.Main.GameModeInfo, Terraria.Main.hardMode, Terraria.CombatText.LifeRegenNegative, Terraria.Main.netMode, Terraria.CombatText.NewText(), Terraria.Main.npc, Terraria.Main.projectile, and Terraria.NetMessage.SendData().