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

◆ SpawnHallucination()

void Terraria.Player.SpawnHallucination ( Item item)
inlineprivate

Definition at line 11971 of file Player.cs.

11972 {
11973 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
11974 //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
11975 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)
11976 //IL_007b: Unknown result type (might be due to invalid IL or missing references)
11977 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
11978 if (whoAmI != Main.myPlayer)
11979 {
11980 return;
11981 }
11982 insanityShadowCooldown = Utils.Clamp(insanityShadowCooldown - 1, 0, 100);
11983 if (insanityShadowCooldown > 0)
11984 {
11985 return;
11986 }
11987 insanityShadowCooldown = Main.rand.Next(20, 101);
11988 float num = 500f;
11989 int damage = 18;
11991 for (int i = 0; i < 200; i++)
11992 {
11993 NPC nPC = Main.npc[i];
11994 if (nPC.CanBeChasedBy(this) && !(Distance(nPC.Center) > num) && Collision.CanHitLine(position, width, height, nPC.position, nPC.width, nPC.height))
11995 {
11997 }
11998 }
11999 if (_hallucinationCandidates.Count != 0)
12000 {
12001 Projectile.RandomizeInsanityShadowFor(Main.rand.NextFromCollection(_hallucinationCandidates), isHostile: false, out var spawnposition, out var spawnvelocity, out var ai, out var ai2);
12002 Projectile.NewProjectile(new EntitySource_ItemUse(this, item), spawnposition, spawnvelocity, 964, damage, 0f, whoAmI, ai, ai2);
12003 }
12004 }
Use the interface, T:Terraria.DataStructures.IEntitySource_WithStatsFromItem instead when checking en...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:275
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
int insanityShadowCooldown
Definition Player.cs:1323
static List< NPC > _hallucinationCandidates
Definition Player.cs:3149

References Terraria.Player._hallucinationCandidates, Terraria.Collision.CanHitLine(), Terraria.Entity.Distance(), Terraria.Entity.height, Terraria.Player.insanityShadowCooldown, Terraria.Main.myPlayer, Terraria.Projectile.NewProjectile(), Terraria.Main.npc, Terraria.Entity.position, Terraria.Main.rand, Terraria.Projectile.RandomizeInsanityShadowFor(), Terraria.Entity.whoAmI, and Terraria.Entity.width.

Referenced by Terraria.Player.GrantArmorBenefits().

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