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

◆ AI_177_IceWhipSlicer()

void Terraria.Projectile.AI_177_IceWhipSlicer ( )
inlineprivate

Definition at line 37092 of file Projectile.cs.

37093 {
37094 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
37095 //IL_0085: Unknown result type (might be due to invalid IL or missing references)
37096 //IL_008a: Unknown result type (might be due to invalid IL or missing references)
37097 //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
37098 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
37099 Player player = Main.player[owner];
37100 if (type == 917 && (!player.active || player.dead))
37101 {
37102 player.coolWhipBuff = false;
37103 Kill();
37104 return;
37105 }
37106 if (type == 917 && player.coolWhipBuff)
37107 {
37108 timeLeft = 2;
37109 }
37110 if (type == 969)
37111 {
37112 SlotId val;
37113 if (soundDelay == 0)
37114 {
37115 soundDelay = -1;
37116 float[] array = localAI;
37118 array[1] = ((SlotId)(ref val)).ToFloat();
37119 }
37121 if (activeSound != null)
37122 {
37123 activeSound.Position = base.Center;
37124 activeSound.Volume = 1f - Math.Max(ai[1] - 555f, 0f) / 15f;
37125 }
37126 else
37127 {
37128 float[] array2 = localAI;
37129 val = SlotId.Invalid;
37130 array2[1] = ((SlotId)(ref val)).ToFloat();
37131 }
37132 ai[1] += 1f;
37133 if (ai[1] > 560f)
37134 {
37135 alpha = (int)MathHelper.Lerp(0f, 250f, (ai[1] - 560f) / 10f);
37136 }
37137 if (ai[1] >= 570f)
37138 {
37139 Kill();
37140 }
37141 float num = 555f;
37142 for (int i = 0; i < 1000; i++)
37143 {
37144 if (i != whoAmI && Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].type == type && timeLeft > Main.projectile[i].timeLeft && Main.projectile[i].ai[1] < num)
37145 {
37146 Main.projectile[i].ai[1] = num;
37147 Main.projectile[i].netUpdate = true;
37148 }
37149 }
37150 }
37151 int num2 = (int)ai[0] - 1;
37152 if (num2 != -1 && (!Main.npc[num2].CanBeChasedBy(this) || localNPCImmunity[num2] > 0))
37153 {
37154 ai[0] = 0f;
37155 num2 = -1;
37156 }
37157 if (num2 == -1)
37158 {
37159 bool checkCanHit = false;
37160 if (type == 969)
37161 {
37162 checkCanHit = true;
37163 }
37165 if (nPC != null)
37166 {
37167 num2 = nPC.whoAmI;
37168 ai[0] = num2 + 1;
37169 netUpdate = true;
37170 }
37171 }
37172 float num3 = 18f;
37173 float amount = 0.1f;
37174 float num4 = 0f;
37175 if (type == 969)
37176 {
37177 num3 = 8f;
37178 amount = 0.075f;
37179 num4 = 25f;
37180 }
37181 if (num2 != -1)
37182 {
37183 NPC nPC2 = Main.npc[num2];
37184 float num5 = Distance(nPC2.Center);
37185 if (num3 > num5)
37186 {
37187 num3 = num5;
37188 }
37189 Vector2 vector = DirectionTo(nPC2.Center);
37190 if (!vector.HasNaNs() && num5 >= num4)
37191 {
37193 }
37194 }
37195 else if (type == 969)
37196 {
37198 if (!vector2.HasNaNs())
37199 {
37201 }
37202 }
37203 else
37204 {
37205 velocity *= 0.92f;
37206 }
37207 if (type == 969)
37208 {
37209 rotation = velocity.X * 0.0125f;
37210 if (++frameCounter > 4)
37211 {
37212 frameCounter = 0;
37213 frame++;
37214 if (frame >= Main.projFrames[type])
37215 {
37216 frame = 0;
37217 }
37218 }
37219 if (timeLeft % 3 == 0)
37220 {
37221 int num6 = Dust.NewDust(position, width, height, 16, velocity.X, velocity.Y, 120, default(Color), 0.5f);
37222 Main.dust[num6].noGravity = true;
37223 Main.dust[num6].fadeIn = 0.9f;
37224 Main.dust[num6].velocity = Main.rand.NextVector2Circular(2f, 2f) + new Vector2(0f, -2f) + velocity * 0.75f;
37225 for (int j = 0; j < 2; j++)
37226 {
37227 Dust dust = Dust.NewDustDirect(position, width, height, 16, velocity.X, velocity.Y, 60, default(Color), 0.5f);
37228 dust.noGravity = true;
37229 dust.fadeIn = 0.7f;
37230 dust.velocity = Main.rand.NextVector2Circular(2f, 2f) * 0.2f + new Vector2(0f, -0.4f) + velocity * 1.5f;
37231 dust.position -= velocity * 3f;
37232 }
37233 }
37234 }
37235 else
37236 {
37237 rotation += 0.020943953f + Math.Abs(velocity.X) * 0.2f;
37238 if (Main.rand.Next(3) == 0)
37239 {
37240 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 43, velocity.X, velocity.Y, 254, Color.White, 0.5f);
37241 Vector2 vector3 = Main.rand.NextVector2Circular(1f, 1f);
37242 dust2.position = base.Center + vector3 * 10f;
37243 dust2.velocity = vector3;
37244 }
37245 }
37246 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Abs(double value)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static ActiveSound GetActiveSound(SlotId id)
Vector2 velocity
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:187
Vector2 position
Definition Entity.cs:14
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
static readonly LegacySoundStyle DD2_BookStaffTwisterLoop
Definition SoundID.cs:936
NPC FindTargetWithinRange(float maxRange, bool checkCanHit=false)
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80

References System.Math.Abs(), Terraria.Entity.active, System.array, Terraria.Player.coolWhipBuff, Terraria.ID.SoundID.DD2_BookStaffTwisterLoop, Terraria.Player.dead, Terraria.Main.dust, ReLogic.Utilities.SlotId.FromFloat(), Terraria.Audio.SoundEngine.GetActiveSound(), ReLogic.Utilities.SlotId.Invalid, Microsoft.Xna.Framework.MathHelper.Lerp(), Microsoft.Xna.Framework.Vector2.Lerp(), System.Math.Max(), Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Main.npc, Terraria.Main.player, Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Main.projectile, Terraria.Main.projFrames, Terraria.Main.rand, System.type, and Microsoft.Xna.Framework.Color.White.