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

◆ ItemCheck_CatchCritters()

Rectangle Terraria.Player.ItemCheck_CatchCritters ( Item sItem,
Rectangle itemRectangle )
inlineprivate

Definition at line 42517 of file Player.cs.

42518 {
42519 bool flag = sItem.type == 3183 || sItem.type == 4821;
42520 for (int i = 0; i < 200; i++)
42521 {
42522 if (!Main.npc[i].active || Main.npc[i].catchItem <= 0)
42523 {
42524 continue;
42525 }
42526 Rectangle value = new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height);
42527 if (!itemRectangle.Intersects(value))
42528 {
42529 continue;
42530 }
42531 if (!flag && ItemID.Sets.IsLavaBait[Main.npc[i].catchItem])
42532 {
42533 if (Main.myPlayer == whoAmI && Hurt(PlayerDeathReason.ByNPC(i), 1, (Main.npc[i].Center.X < base.Center.X) ? 1 : (-1), pvp: false, quiet: false, Crit: false, 3) > 0.0 && !dead)
42534 {
42535 AddBuff(24, 300, quiet: false);
42536 }
42537 }
42538 else if (Main.npc[i].type == 585 || Main.npc[i].type == 583 || Main.npc[i].type == 584)
42539 {
42540 if (Main.npc[i].ai[2] <= 1f)
42541 {
42542 NPC.CatchNPC(i, whoAmI);
42543 }
42544 }
42545 else
42546 {
42547 NPC.CatchNPC(i, whoAmI);
42548 }
42549 }
42550 return itemRectangle;
42551 }
static PlayerDeathReason ByNPC(int index)
static bool[] IsLavaBait
Definition ItemID.cs:1026
double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, bool Crit=false, int cooldownCounter=-1, bool dodgeable=true)
Definition Player.cs:36134
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441

References Terraria.DataStructures.PlayerDeathReason.ByNPC(), Terraria.NPC.CatchNPC(), Terraria.ID.ItemID.Sets.IsLavaBait, Terraria.Main.myPlayer, Terraria.Main.npc, and System.value.