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

◆ AI_137_LightningAura()

void Terraria.Projectile.AI_137_LightningAura ( )
inlineprivate

Definition at line 58120 of file Projectile.cs.

58121 {
58122 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
58123 int num = 10;
58124 int num2 = 999;
58125 int num3 = 30;
58126 int num4 = 40;
58127 int num5 = 4;
58128 knockBack = 0f;
58129 if (Main.player[owner].setMonkT2)
58130 {
58131 num3 -= 5;
58132 }
58133 if (Main.player[owner].setMonkT3)
58134 {
58135 num = 14;
58136 num5 = 8;
58137 }
58138 ai[0] += 1f;
58139 if (ai[0] >= (float)num3)
58140 {
58141 ai[0] = 0f;
58142 }
58143 if (ai[0] == 0f)
58144 {
58145 bool flag = false;
58146 for (int i = 0; i < 200; i++)
58147 {
58148 NPC nPC = Main.npc[i];
58149 if (nPC.CanBeChasedBy(this) && nPC.Hitbox.Distance(base.Center) < (float)(width / 2) && Colliding(base.Hitbox, nPC.Hitbox))
58150 {
58151 flag = true;
58152 break;
58153 }
58154 }
58155 if (flag)
58156 {
58158 }
58159 }
58160 if (localAI[0] == 0f)
58161 {
58162 localAI[0] = 1f;
58164 Point origin = base.Center.ToTileCoordinates();
58165 bool flag2 = true;
58167 {
58168 flag2 = false;
58169 position.Y += 16f;
58170 return;
58171 }
58173 {
58174 result2 = new Point(origin.X, origin.Y - num - 1);
58175 }
58176 int num6 = 0;
58177 if (flag2 && Main.tile[result.X, result.Y] != null && Main.tile[result.X, result.Y].blockType() == 1)
58178 {
58179 num6 += 8;
58180 }
58181 Vector2 center = result.ToWorldCoordinates(8f, num6);
58182 Vector2 vector = result2.ToWorldCoordinates(8f, 0f);
58183 base.Size = new Vector2(1f, center.Y - vector.Y);
58184 if (height > num * 16)
58185 {
58186 height = num * 16;
58187 }
58188 if (height < num5 * 16)
58189 {
58190 height = num5 * 16;
58191 }
58192 height *= 2;
58193 width = (int)((float)height * 1f);
58194 if (width > num2)
58195 {
58196 width = num2;
58197 }
58198 base.Center = center;
58199 }
58200 if (++frameCounter >= 8)
58201 {
58202 frameCounter = 0;
58203 if (++frame >= Main.projFrames[type])
58204 {
58205 frame = 0;
58206 }
58207 }
58208 DelegateMethods.v3_1 = new Vector3(0.2f, 0.7f, 1f);
58209 Utils.PlotTileLine(base.Center + Vector2.UnitX * -40f, base.Center + Vector2.UnitX * 40f, 80f, DelegateMethods.CastLightOpen);
58210 Vector2 vector2 = new Vector2(base.Top.X, position.Y + (float)num4);
58211 for (int j = 0; j < 4; j++)
58212 {
58213 if (Main.rand.Next(6) != 0)
58214 {
58215 continue;
58216 }
58217 Vector2 vector3 = Main.rand.NextVector2Unit();
58218 if (!(Math.Abs(vector3.X) < 0.12f))
58219 {
58220 Vector2 targetPosition = base.Center + vector3 * new Vector2((height - num4) / 2);
58221 if (!WorldGen.SolidTile((int)targetPosition.X / 16, (int)targetPosition.Y / 16) && AI_137_CanHit(targetPosition))
58222 {
58223 Dust dust = Dust.NewDustDirect(targetPosition, 0, 0, 226, 0f, 0f, 100);
58224 dust.position = targetPosition;
58225 dust.velocity = (vector2 - dust.position).SafeNormalize(Vector2.Zero);
58226 dust.scale = 0.7f;
58227 dust.fadeIn = 1f;
58228 dust.noGravity = true;
58229 dust.noLight = true;
58230 }
58231 }
58232 }
58233 for (int k = 0; k < 0; k++)
58234 {
58235 if (Main.rand.Next(10) != 0)
58236 {
58237 continue;
58238 }
58239 Vector2 vector4 = Main.rand.NextVector2Unit();
58240 if (!(Math.Abs(vector4.X) < 0.12f))
58241 {
58242 Vector2 targetPosition2 = base.Center + vector4 * new Vector2((height - num4) / 2) * Main.rand.NextFloat();
58243 if (!WorldGen.SolidTile((int)targetPosition2.X / 16, (int)targetPosition2.Y / 16) && AI_137_CanHit(targetPosition2))
58244 {
58245 Dust dust2 = Dust.NewDustDirect(targetPosition2, 0, 0, 226, 0f, 0f, 100);
58246 dust2.velocity *= 0.6f;
58247 dust2.velocity += Vector2.UnitY * -2f;
58248 dust2.noGravity = true;
58249 dust2.noLight = true;
58250 }
58251 }
58252 }
58253 for (int l = 0; l < 4; l++)
58254 {
58255 if (Main.rand.Next(10) == 0)
58256 {
58257 Dust dust3 = Dust.NewDustDirect(vector2 - new Vector2(8f, 0f), 16, height / 2 - 40, 226, 0f, 0f, 100);
58258 dust3.velocity *= 0.6f;
58259 dust3.velocity += Vector2.UnitY * -2f;
58260 dust3.scale = 0.7f;
58261 dust3.noGravity = true;
58262 dust3.noLight = true;
58263 }
58264 }
58265 tileCollide = true;
58266 velocity.Y += 0.2f;
58267 }
static double Abs(double value)
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static readonly LegacySoundStyle DD2_LightningAuraZap
Definition SoundID.cs:794
static Conditions.NotNull _cachedConditions_notNull
static Conditions.IsSolid _cachedConditions_solid
bool Colliding(Rectangle myRect, Rectangle targetRect)
bool AI_137_CanHit(Vector2 targetPosition)
static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
Definition Searches.cs:123
static bool Find(Point origin, GenSearch search, out Point result)
Definition WorldUtils.cs:27

References System.Math.Abs(), Terraria.DelegateMethods.CastLightOpen(), Terraria.WorldBuilding.Searches.Chain(), Terraria.ID.SoundID.DD2_LightningAuraZap, Terraria.WorldBuilding.WorldUtils.Find(), Terraria.Dust.NewDustDirect(), Terraria.Main.npc, Terraria.Main.player, Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Utils.PlotTileLine(), Terraria.Dust.position, Terraria.Main.projFrames, Terraria.Main.rand, Terraria.WorldGen.SolidTile(), Terraria.Main.tile, System.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Point.Y, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.