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

◆ ghostHurt()

void Terraria.Projectile.ghostHurt ( int dmg,
Vector2 Position,
Entity victim )
inline

Definition at line 11132 of file Projectile.cs.

11133 {
11134 //IL_0115: Unknown result type (might be due to invalid IL or missing references)
11135 //IL_0124: Unknown result type (might be due to invalid IL or missing references)
11136 //IL_0209: Unknown result type (might be due to invalid IL or missing references)
11137 //IL_020f: Unknown result type (might be due to invalid IL or missing references)
11138 if (!magic || damage <= 0)
11139 {
11140 return;
11141 }
11142 int num = damage;
11143 if (dmg <= 1)
11144 {
11145 return;
11146 }
11147 int num2 = -1;
11148 int num3 = 1500;
11149 if (Main.player[Main.myPlayer].ghostDmg > (float)num3)
11150 {
11151 return;
11152 }
11153 Main.player[Main.myPlayer].ghostDmg += num;
11154 int[] array = new int[200];
11155 int num4 = 0;
11156 _ = new int[200];
11157 int num5 = 0;
11158 for (int i = 0; i < 200; i++)
11159 {
11160 if (!Main.npc[i].CanBeChasedBy(this))
11161 {
11162 continue;
11163 }
11164 float num6 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - position.X + (float)(width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - position.Y + (float)(height / 2));
11165 if (num6 < 800f)
11166 {
11167 if (Collision.CanHit(position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num6 > 50f)
11168 {
11169 array[num5] = i;
11170 num5++;
11171 }
11172 else if (num5 == 0)
11173 {
11174 array[num4] = i;
11175 num4++;
11176 }
11177 }
11178 }
11179 if (num4 != 0 || num5 != 0)
11180 {
11181 num2 = ((num5 <= 0) ? array[Main.rand.Next(num4)] : array[Main.rand.Next(num5)]);
11182 float num7 = Main.rand.Next(-100, 101);
11183 float num8 = Main.rand.Next(-100, 101);
11184 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
11185 num9 = 4f / num9;
11186 num7 *= num9;
11187 num8 *= num9;
11188 NewProjectile(GetProjectileSource_OnHit(victim, 16), Position.X, Position.Y, num7, num8, 356, num, 0f, owner, num2);
11189 }
11190 }
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 owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
IEntitySource GetProjectileSource_OnHit(Entity victim, int projectileSourceId)
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...

References Terraria.Collision.CanHit(), Terraria.Projectile.damage, Terraria.Projectile.GetProjectileSource_OnHit(), Terraria.Entity.height, Terraria.Projectile.magic, Terraria.Main.myPlayer, Terraria.Projectile.NewProjectile(), Terraria.Main.npc, Terraria.Projectile.owner, Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, and Terraria.Entity.width.

Referenced by Terraria.Projectile.Damage().

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