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

◆ LadyBugLuck()

void Terraria.NPC.LadyBugLuck ( int plr,
bool GoldLadyBug = false )
inlineprivate

Definition at line 78331 of file NPC.cs.

78332 {
78333 if (releaseOwner != 255 || Main.player[plr].ladyBugLuckTimeLeft < 0)
78334 {
78335 return;
78336 }
78337 Vector2 vector = base.Center - Main.player[plr].Center;
78338 int num = 800;
78339 if (vector.Length() < (float)num)
78340 {
78341 if (vector.Length() < 30f)
78342 {
78343 vector = default(Vector2);
78344 }
78345 double x = 1.0 - (double)vector.Length() / (double)num;
78346 x = Math.Pow(x, 6.0);
78347 int num2 = (int)((double)ladyBugGoodLuckTime * x);
78348 if (GoldLadyBug)
78349 {
78350 num2 *= 2;
78351 }
78352 if (num2 > Main.player[plr].ladyBugLuckTimeLeft)
78353 {
78354 Main.player[plr].ladyBugLuckTimeLeft = num2;
78355 Main.player[plr].luckNeedsSync = true;
78356 }
78357 }
78358 }
static double Pow(double x, double y)
short releaseOwner
Definition NPC.cs:107
static int ladyBugGoodLuckTime
Definition NPC.cs:626

References Terraria.Main.player, and System.Math.Pow().

Referenced by Terraria.NPC.CheckActive().