public override void AI() { if (projectile.localAI[0] == 0) { for (int i = 0; i < 5; i++) { int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.5f); Main.dust[d].velocity *= 6f; } } if (++projectile.localAI[0] > 30 && projectile.localAI[0] < 120) { projectile.velocity *= projectile.ai[0]; } if (projectile.localAI[0] > 60 && projectile.localAI[0] < 180) { if (EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.ShadowChampion>())) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[Main.npc[EModeGlobalNPC.championBoss].target].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, projectile.ai[1])); } } projectile.rotation = projectile.velocity.ToRotation() + (float)Math.PI / 2; }
public override void AI() { if (projectile.ai[1] > -1f && projectile.ai[1] < 200f) { NPC npc = Main.npc[(int)projectile.ai[1]]; if (npc.CanBeChasedBy(projectile)) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = npc.Center - projectile.Center; if (vel.Length() < 20f) { projectile.Kill(); return; } float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.008f)); } else { projectile.ai[1] = -1f; projectile.netUpdate = true; } } projectile.alpha -= 40; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.frameCounter++; if (projectile.frameCounter > 2) { projectile.frameCounter = 0; projectile.frame++; if (projectile.frame > 3) { projectile.frame = 0; } } Lighting.AddLight(projectile.Center, 1.1f, 0.9f, 0.4f); projectile.rotation = projectile.velocity.ToRotation() + (float)Math.PI / 2; ++projectile.localAI[0]; if ((double)projectile.localAI[0] == 12.0) //loads of vanilla dust :echprime: { projectile.localAI[0] = 0.0f; for (int index1 = 0; index1 < 12; ++index1) { Vector2 vector2 = (Vector2.UnitX * (float)-projectile.width / 2f + -Vector2.UnitY.RotatedBy((double)index1 * 3.14159274101257 / 6.0, new Vector2()) * new Vector2(8f, 16f)).RotatedBy((double)projectile.rotation - 1.57079637050629, new Vector2()); int index2 = Dust.NewDust(projectile.Center, 0, 0, 6, 0.0f, 0.0f, 160, new Color(), 1f); Main.dust[index2].scale = 1.1f; Main.dust[index2].noGravity = true; Main.dust[index2].position = projectile.Center + vector2; Main.dust[index2].velocity = projectile.velocity * 0.1f; Main.dust[index2].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[index2].position) * 1.25f; } } if (Main.rand.Next(4) == 0) { for (int index1 = 0; index1 < 1; ++index1) { Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index2].velocity *= 0.1f; Main.dust[index2].position = projectile.Center + vector2 * (float)projectile.width / 2f; Main.dust[index2].fadeIn = 0.9f; } } if (Main.rand.Next(32) == 0) { for (int index1 = 0; index1 < 1; ++index1) { Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f); Main.dust[index2].velocity *= 0.3f; Main.dust[index2].position = projectile.Center + vector2 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[index2].fadeIn = 1.4f; } } } if (Main.rand.Next(2) == 0) { for (int index1 = 0; index1 < 2; ++index1) { Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0.0f, 0.0f, 0, new Color(), 1.2f); Main.dust[index2].velocity *= 0.3f; Main.dust[index2].noGravity = true; Main.dust[index2].position = projectile.Center + vector2 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[index2].fadeIn = 1.4f; } } } }
public override void AI() { if (projectile.localAI[0] == 0) { Main.PlayTrackedSound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center); } if (++projectile.localAI[0] < 120) { projectile.velocity *= 1.033f; float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)projectile.ai[0]].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.02f)); } projectile.alpha = projectile.alpha - 30; if (projectile.alpha < 0) { projectile.alpha = 0; } if (++projectile.frameCounter >= 3) { projectile.frameCounter = 0; if (++projectile.frame >= 3) { projectile.frame = 0; } } Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.4f, 0.85f, 0.9f); projectile.rotation = projectile.velocity.ToRotation(); }
public override void AI() { base.AI(); int ai0 = (int)projectile.ai[0]; if (ai0 > -1 && ai0 < Main.maxNPCs && Main.npc[ai0].active && Main.npc[ai0].CanBeChasedBy()) { if (++projectile.ai[1] < 60) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.npc[ai0].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.05f)); } } else { float maxRange = 750f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile) && Collision.CanHit(projectile.Center, 0, 0, Main.npc[i].Center, 0, 0)) { if (projectile.Distance(Main.npc[i].Center) <= maxRange) { maxRange = projectile.Distance(Main.npc[i].Center); projectile.ai[0] = i; } } } } if (projectile.ai[0] < 60) { projectile.velocity *= 1.065f; } }
public override void AI() { projectile.spriteDirection = projectile.direction; projectile.velocity *= 1.0005f; if (projectile.alpha >= 120) { projectile.alpha -= 10; } int num4324; int num; for (int num20 = 0; num20 < 4; num20 = num4324 + 1) { float num21 = projectile.velocity.X / 4f * (float)num20; float num22 = projectile.velocity.Y / 4f * (float)num20; int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 91, 0f, 0f, 0, default(Color), 0.6f); Main.dust[num23].position.X = projectile.Center.X - num21; Main.dust[num23].position.Y = projectile.Center.Y - num22; Dust dust3 = Main.dust[num23]; dust3.velocity *= 0f; Main.dust[num23].scale = 0.68f; Main.dust[num23].velocity *= 0.68f; Main.dust[num23].noGravity = true; Main.dust[num23].fadeIn = 0.4f; num4324 = num20; } if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item91, projectile.position); } else if (projectile.ai[1] == 1f && Main.netMode != 1) { int num3 = -1; float num4 = 2000f; for (int k = 0; k < 255; k = num + 1) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float num5 = Vector2.Distance(center, projectile.Center); if ((num5 < num4 || num3 == -1) && Collision.CanHit(projectile.Center, 1, 1, center, 1, 1)) { num4 = num5; num3 = k; } } num = k; } if (num4 < 20f) { projectile.Kill(); return; } if (num3 != -1) { projectile.ai[1] = 21f; projectile.ai[0] = (float)num3; projectile.netUpdate = true; } } else if (projectile.ai[1] > 20f && projectile.ai[1] < 200f) { projectile.ai[1] += 1f; int num6 = (int)projectile.ai[0]; if (!Main.player[num6].active || Main.player[num6].dead) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.netUpdate = true; } else { float num7 = projectile.velocity.ToRotation(); Vector2 vector2 = Main.player[num6].Center - projectile.Center; if (vector2.Length() < 20f) { projectile.Kill(); return; } float targetAngle = vector2.ToRotation(); if (vector2 == Vector2.Zero) { targetAngle = num7; } float num8 = num7.AngleLerp(targetAngle, 0.016f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy((double)num8, default(Vector2)); } if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) { projectile.ai[1] += 1f; if (projectile.ai[1] == 20f) { projectile.ai[1] = 1f; } } projectile.alpha -= 40; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.spriteDirection = projectile.direction; } }
public override void AI() { if (projectile.localAI[0] == 0) { projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } for (int index1 = 0; index1 < 2; ++index1) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(), 2f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity.X *= 0.3f; Main.dust[index2].velocity.Y *= 0.3f; } if (--projectile.ai[0] > 0) { float speed = projectile.velocity.Length(); speed += projectile.ai[1]; projectile.velocity = Vector2.Normalize(projectile.velocity) * speed; } else if (projectile.ai[0] == 0) { projectile.ai[1] = Player.FindClosest(projectile.Center, 0, 0); if (projectile.ai[1] != -1 && Main.player[(int)projectile.ai[1]].active && !Main.player[(int)projectile.ai[1]].dead) { projectile.velocity = projectile.DirectionTo(Main.player[(int)projectile.ai[1]].Center); projectile.netUpdate = true; } else { projectile.Kill(); } } else { projectile.tileCollide = true; if (++projectile.localAI[1] < 90) //accelerate { projectile.velocity *= 1.04f; } if (projectile.localAI[1] < 120) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)projectile.ai[1]].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.025f)); } /*if (projectile.velocity.Y <= 0) //don't home upwards ever * { * projectile.velocity = projectile.oldVelocity; * if (projectile.localAI[1] < 90) * projectile.velocity *= 1.04f; * }*/ } }
public override void AI() { if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item20, projectile.position); projectile.localAI[0] = 1f; projectile.ai[1] = -1f; } int dust = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(244, 66, 113), 1f); Main.dust[dust].velocity *= 0.1f; if (projectile.velocity == Vector2.Zero) { Main.dust[dust].velocity.Y -= 1f; Main.dust[dust].scale = 1.2f; } else { Main.dust[dust].velocity += projectile.velocity * 0.2f; } /*Main.dust[dust].position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); * Main.dust[dust].position.Y = projectile.Center.Y + Main.rand.Next(-2, 3);*/ Main.dust[dust].noGravity = true; if (projectile.ai[1] > -1f && projectile.ai[1] < 200f) //has target { NPC npc = Main.npc[(int)projectile.ai[1]]; if (npc.CanBeChasedBy(projectile)) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = npc.Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.008f)); } else { projectile.ai[1] = -1f; projectile.netUpdate = true; } } else //currently has no target { if (--projectile.localAI[1] < 0) { projectile.localAI[1] = 10; projectile.ai[1] = HomeOnTarget(); if (projectile.ai[1] != -1) { projectile.netUpdate = true; } } } }
public override void AI() { if (projectile.localAI[1] == 0) { projectile.localAI[1] = 1; Main.PlaySound(SoundID.Item17, projectile.Center); } if (projectile.ai[1] == 0) { float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)projectile.ai[0]].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, projectile.localAI[0])); if (projectile.localAI[0] < 0.5f) projectile.localAI[0] += 1f / 3000f; if (vel.Length() < 250 || !Main.player[(int)projectile.ai[0]].active || Main.player[(int)projectile.ai[0]].dead || Main.player[(int)projectile.ai[0]].ghost) { projectile.ai[1] = 1; projectile.netUpdate = true; projectile.timeLeft = 180; projectile.velocity.Normalize(); } } else if (projectile.ai[1] > 0) { if (++projectile.ai[1] < 120) { projectile.velocity *= 1.03f; float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)projectile.ai[0]].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.025f)); } } else //ai1 below 0 rn { projectile.ai[1]++; } for (int i = 0; i < 3; i++) //vanilla dusts { for (int j = 0; j < 3; ++j) { int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 170, 0.0f, 0.0f, 100, default, 1f);
public override bool PreAI() { if (projectile.ai[0] == 0) { projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); projectile.ai[0] = 1; } else { projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f * (float)projectile.direction; if (projectile.ai[1] == 0 && Main.netMode != NetmodeID.MultiplayerClient) { target = -1; float distance = 320; for (int k = 0; k < 200; k++) { if (Main.npc[k].active && Main.npc[k].CanBeChasedBy(projectile, false) && Collision.CanHitLine(projectile.Center, 1, 1, Main.npc[k].Center, 1, 1)) { Vector2 center = Main.npc[k].Center; float currentDistance = Vector2.Distance(center, projectile.Center); if (currentDistance < distance || target == -1) { distance = currentDistance; target = k; } } } if (target != -1) { projectile.ai[1] = 1; projectile.netUpdate = true; } } else { NPC targetNPC = Main.npc[this.target]; if (!targetNPC.active || !targetNPC.CanBeChasedBy(projectile, false) || !Collision.CanHitLine(projectile.Center, 1, 1, targetNPC.Center, 1, 1)) { this.target = -1; projectile.ai[1] = 0; projectile.netUpdate = true; } else { float currentRot = projectile.velocity.ToRotation(); Vector2 direction = targetNPC.Center - projectile.Center; float targetAngle = direction.ToRotation(); if (direction == Vector2.Zero) { targetAngle = currentRot; } float desiredRot = currentRot.AngleLerp(targetAngle, 0.04f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(desiredRot, default(Vector2)); } } } if (projectile.timeLeft <= 30) { projectile.Opacity -= 0.032F; } return(false); }
public override void AI() { for (int i = 0; i < 3; i++) { int dust; dust = Dust.NewDust(projectile.Center + projectile.velocity, 0, 0, 173, 0f, 0f); Main.dust[dust].scale = 1.2f; Main.dust[dust].velocity *= i / 3; } int num; if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; } else if (projectile.ai[1] == 1f && Main.netMode != 1) { int num3 = -1; float num4 = 2000f; for (int k = 0; k < 255; k = num + 1) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float num5 = Vector2.Distance(center, projectile.Center); if ((num5 < num4 || num3 == -1)) { num4 = num5; num3 = k; } } num = k; } if (num3 != -1) { projectile.ai[1] = 21f; projectile.ai[0] = (float)num3; projectile.netUpdate = true; } } else if (projectile.ai[1] > 20f && projectile.ai[1] < 300f) { projectile.ai[1] += 1f; int num6 = (int)projectile.ai[0]; if (!Main.player[num6].active || Main.player[num6].dead) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.netUpdate = true; } else { float num7 = projectile.velocity.ToRotation(); Vector2 vector2 = Main.player[num6].Center - projectile.Center; float targetAngle = vector2.ToRotation(); if (vector2 == Vector2.Zero) { targetAngle = num7; } float num8 = num7.AngleLerp(targetAngle, 0.008f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy((double)num8, default(Vector2)); } } if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) { projectile.ai[1] += 1f; if (projectile.ai[1] == 20f) { projectile.ai[1] = 1f; } } }
public static void UpdateUI(bool draw = false) { int treecount = SkillManager.SkillTreeColors.Length; float maxsize = 600; float minsize = 64; float thesize = SKillUI.PercentLerp((float)Main.LocalPlayer.SGAPly().ExpertiseCollectedTotal, minsize, maxsize, SkillManager.skillmax); Vector3 loc = new Vector3(Main.screenWidth / 2, Main.screenHeight / 2f, 0); if (!draw) { Main.LocalPlayer.mouseInterface = true; } if (draw) { Main.spriteBatch.Draw(Main.blackTileTexture, Vector2.Zero, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), (Color.Purple * 1f), 0, Vector2.Zero, new Vector2(1f, 1f), SpriteEffects.None, 0f); Matrix DrawMatrix = Matrix.CreateScale(1f, 1f, 1f); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, DrawMatrix); basicEffect.World = WVP.World(); basicEffect.View = WVP.View(new Vector2(1f, 1f)); basicEffect.Projection = WVP.Projection(); basicEffect.VertexColorEnabled = true; int detail = 60; int polys = 1; VertexPositionColor[] vertices = new VertexPositionColor[detail * (polys * 3)]; float ripplecount = 20; float ripplesize = 1f; float overallradius = thesize * (1f - (1f / (1f + SKillUI.SkillUITimer / 10f))); Random rand = new Random(0); float[] previous = { 90000f, 90000f }; float[] starts = { 0f, 0f }; for (int tree = 0; tree < treecount; tree += 1) { for (int i = 0; i < vertices.Length - 3; i += (polys * 3)) { float adder = UIAngle + MathHelper.ToRadians(((float)tree / (float)treecount) * 360f); float maxdegre = (360f / (float)treecount); float rad1 = (((float)i / (vertices.Length - (polys * 3))) * 360f) * ripplecount; float rad2 = (((float)(i + (polys * 3)) / (vertices.Length - (polys * 3))) * 360f) * ripplecount; if (previous[0] > 89999f) { previous[0] = (float)rand.NextDouble() * 10f; starts[0] = previous[0]; previous[1] = (float)rand.NextDouble(); starts[1] = previous[1]; } float radius = overallradius + (float)Math.Sin(MathHelper.ToRadians(rad1 + Main.GlobalTime * (90f + previous[0]))) * ((0.50f + previous[1]) * ripplesize); previous[0] = (float)rand.NextDouble() * 10f; previous[1] = (float)rand.NextDouble(); if (i + 3 >= vertices.Length) { previous = starts; } float radius2 = overallradius + (float)Math.Sin(MathHelper.ToRadians(rad2 + Main.GlobalTime * (90f + previous[0]))) * ((0.50f + previous[1]) * ripplesize); float angle = -(adder + MathHelper.ToRadians(((float)i / (vertices.Length - (polys * 3))) * maxdegre)); Vector3 theplace = new Vector3((float)Math.Cos(angle), (float)Math.Sin(angle), 0) * radius; float angle2 = angle - (MathHelper.ToRadians(((float)(polys * 3) / (vertices.Length - (polys * 3))) * maxdegre)); Vector3 theplace2 = new Vector3((float)Math.Cos(angle2), (float)Math.Sin(angle2), 0) * radius2; //Color thecolor = SkillManager.SkillTreeColors[(int)(((float)i / (float)vertices.Length) * (float)treecount)]; Color thecolor = SkillManager.SkillTreeColors[tree]; vertices[0 + (i)] = new VertexPositionColor(loc, Color.White); vertices[1 + (i)] = new VertexPositionColor(loc + theplace2, thecolor); vertices[2 + (i)] = new VertexPositionColor(loc + theplace, thecolor); } SKillUI.vertexBuffer = new VertexBuffer(Main.graphics.GraphicsDevice, typeof(VertexPositionColor), vertices.Length, BufferUsage.WriteOnly); SKillUI.vertexBuffer.SetData <VertexPositionColor>(vertices); Main.graphics.GraphicsDevice.SetVertexBuffer(vertexBuffer); RasterizerState rasterizerState = new RasterizerState(); rasterizerState.CullMode = CullMode.None; Main.graphics.GraphicsDevice.RasterizerState = rasterizerState; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); Main.graphics.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, polys * detail); } } } Vector2 loc2 = new Vector2(loc.X, loc.Y); if (draw) { //Lines and stuff for (int i = 0; i < treecount; i += 1) { Main.spriteBatch.Draw(Main.blackTileTexture, loc2, new Rectangle(0, 0, 10, 10), Color.Black, -UIAngle + MathHelper.ToRadians(((float)i / (float)treecount) * 360f), new Vector2(0f, 5f), new Vector2(maxsize / 10f, 1f), SpriteEffects.None, 0f); } for (int i = 0; i < treecount; i += 1) { Main.spriteBatch.Draw(Main.blackTileTexture, loc2, new Rectangle(0, 0, 10, 6), Color.Gray, -UIAngle + MathHelper.ToRadians(((float)i / (float)treecount) * 360f), new Vector2(0f, 3f), new Vector2(maxsize / 10f, 1f), SpriteEffects.None, 0f); } for (int i = 0; i < treecount; i += 1) { Main.spriteBatch.Draw(Main.blackTileTexture, loc2, new Rectangle(0, 0, 10, 4), Color.White, -UIAngle + MathHelper.ToRadians(((float)i / (float)treecount) * 360f), new Vector2(0f, 2f), new Vector2(maxsize / 10f, 1f), SpriteEffects.None, 0f); } } foreach (Skill skill in Main.LocalPlayer.SGAPly().skillMananger.Skills) { //float angle1 = MathHelper.ToRadians((skill.treelocation.Y / (float)treecount) * 360f); //angle1 += MathHelper.ToRadians(skill.treelocation.X * (360f/(float)treecount)); //Vector2 loc3 = new Vector2(SKillUI.PercentLerp(skill.unlockcost, minsize, maxsize, SkillManager.skillmax),0).RotatedBy(-angle1); Vector2 loc3 = SKillUI.CircleLocation(skill.treelocation.X, skill.treelocation.Y, skill.unlockcost, minsize, maxsize); if (draw) { Main.spriteBatch.Draw(Main.blackTileTexture, loc2 + loc3, skill.skillBox, Color.Black * 0.75f, 0, skill.skillBox.Size() / 2f, new Vector2(1f, 1f), SpriteEffects.None, 0f); } } if (draw) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix); } if (!draw) { UIAngle = UIAngle.AngleLerp(UIAngleTo, 0.1f); } }
public override void AI() { if (projectile.timeLeft <= 195) { for (int index1 = 0; index1 < 5; ++index1) { float num1 = projectile.velocity.X / 3f * (float)index1; float num2 = projectile.velocity.Y / 3f * (float)index1; int num3 = 4; int index2 = Dust.NewDust(new Vector2(projectile.position.X + (float)num3, projectile.position.Y + (float)num3), projectile.width - num3 * 2, projectile.height - num3 * 2, 20, 0.0f, 0.0f, 100, new Color(), 1.4f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 0.1f; Main.dust[index2].velocity += projectile.velocity * 0.1f; Main.dust[index2].position.X -= num1; Main.dust[index2].position.Y -= num2; Main.dust[index2].scale = 1.1f; } } int num; if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; } else if (projectile.ai[1] == 1f && Main.netMode != 1) { int num3 = -1; float num4 = 2000f; for (int k = 0; k < 255; k = num + 1) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float num5 = Vector2.Distance(center, projectile.Center); if ((num5 < num4 || num3 == -1)) { num4 = num5; num3 = k; } } num = k; } if (num3 != -1) { projectile.ai[1] = 21f; projectile.ai[0] = (float)num3; projectile.netUpdate = true; } } else if (projectile.ai[1] > 20f && projectile.ai[1] < 100f) { projectile.ai[1] += 1f; int num6 = (int)projectile.ai[0]; if (!Main.player[num6].active || Main.player[num6].dead) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.netUpdate = true; } else { float num7 = projectile.velocity.ToRotation(); Vector2 vector2 = Main.player[num6].Center - projectile.Center; float targetAngle = vector2.ToRotation(); if (vector2 == Vector2.Zero) { targetAngle = num7; } float num8 = num7.AngleLerp(targetAngle, 0.01f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy((double)num8, default(Vector2)); } } if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) { projectile.ai[1] += 1f; if (projectile.ai[1] == 20f) { projectile.ai[1] = 1f; } } }
public override bool PreAI() { if (npc.ai[1] == 0f) { npc.ai[1] = 1f; Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); } else if (npc.ai[1] == 1f && Main.netMode != 1) { int target = -1; float distance = 2000f; for (int k = 0; k < 255; k++) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float currentDistance = Vector2.Distance(center, npc.Center); if ((currentDistance < distance || target == -1) && Collision.CanHit(npc.Center, 1, 1, center, 1, 1)) { distance = currentDistance; target = k; } } } if (target != -1) { npc.ai[1] = 21f; npc.ai[0] = target; npc.netUpdate = true; } } else if (npc.ai[1] > 20f && npc.ai[1] < 200f) { npc.ai[1] += 1f; int target = (int)npc.ai[0]; if (!Main.player[target].active || Main.player[target].dead) { npc.ai[1] = 1f; npc.ai[0] = 0f; npc.netUpdate = true; } else { float num6 = npc.velocity.ToRotation(); Vector2 vector2 = Main.player[target].Center - npc.Center; float targetAngle = vector2.ToRotation(); if (vector2 == Vector2.Zero) { targetAngle = num6; } float num7 = num6.AngleLerp(targetAngle, 0.008f); npc.velocity = new Vector2(npc.velocity.Length(), 0f).RotatedBy((double)num7, default(Vector2)); } } if (npc.ai[1] >= 1f && npc.ai[1] < 20f) { npc.ai[1] += 1f; if (npc.ai[1] == 20f) { npc.ai[1] = 1f; } } if (npc.alpha <= 0) { npc.alpha = 0; } else { npc.alpha -= 40; } npc.spriteDirection = npc.direction; npc.localAI[0] += 1f; if (npc.localAI[0] == 12f) { npc.localAI[0] = 0f; for (int j = 0; j < 12; j++) { Vector2 vector2 = Vector2.UnitX * -npc.width / 2f; vector2 += -Utils.RotatedBy(Vector2.UnitY, ((float)j * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); vector2 = Utils.RotatedBy(vector2, (npc.rotation - 1.57079637f), default(Vector2)); int num8 = Dust.NewDust(npc.Center, 0, 0, 27, 0f, 0f, 160, default(Color), 1f); Main.dust[num8].scale = 1.1f; Main.dust[num8].noGravity = true; Main.dust[num8].position = npc.Center + vector2; Main.dust[num8].velocity = npc.velocity * 0.1f; Main.dust[num8].velocity = Vector2.Normalize(npc.Center - npc.velocity * 3f - Main.dust[num8].position) * 1.25f; } } if (Main.rand.Next(4) == 0) { for (int k = 0; k < 1; k++) { Vector2 value = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.19634954631328583), Utils.ToRotation(npc.velocity), default(Vector2)); int num9 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), 1f); Main.dust[num9].velocity *= 0.1f; Main.dust[num9].position = npc.Center + value * npc.width / 2f; Main.dust[num9].fadeIn = 0.9f; } } if (Main.rand.Next(32) == 0) { for (int l = 0; l < 1; l++) { Vector2 value2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.39269909262657166), Utils.ToRotation(npc.velocity), default(Vector2)); int num10 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 155, default(Color), 0.8f); Main.dust[num10].velocity *= 0.3f; Main.dust[num10].position = npc.Center + value2 * npc.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num10].fadeIn = 1.4f; } } } if (Main.rand.Next(2) == 0) { for (int m = 0; m < 2; m++) { Vector2 value3 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.78539818525314331), Utils.ToRotation(npc.velocity), default(Vector2)); int num11 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 0, default(Color), 1.2f); Main.dust[num11].velocity *= 0.3f; Main.dust[num11].noGravity = true; Main.dust[num11].position = npc.Center + value3 * npc.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num11].fadeIn = 1.4f; } } } Lighting.AddLight(npc.Center, 1.1f, 0.3f, 1.1f); return(false); }
public override void AI() { base.AI(); if (Projectile.ai[1] == 0) { bool playerExists = Projectile.ai[0] > -1 && Projectile.ai[0] < Main.maxPlayers; bool proceed = false; if (playerExists) { float rotation = Projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)Projectile.ai[0]].Center - Projectile.Center; float targetAngle = vel.ToRotation(); Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.2f)); if (vel.Length() < 300 || vel.Length() > 3000 || !Main.player[(int)Projectile.ai[0]].active || Main.player[(int)Projectile.ai[0]].dead || Main.player[(int)Projectile.ai[0]].ghost) { proceed = true; } } if (!playerExists || proceed) { Projectile.ai[1] = 1; Projectile.netUpdate = true; Projectile.timeLeft = 180; Projectile.velocity.Normalize(); } } else if (Projectile.ai[1] > 0) { if (Projectile.ai[0] > -1 && Projectile.ai[0] < Main.maxPlayers) //homing mode { if (++Projectile.ai[1] < 100) { Projectile.velocity *= 1.035f; float rotation = Projectile.velocity.ToRotation(); Vector2 vel = Main.player[(int)Projectile.ai[0]].Center - Projectile.Center; float targetAngle = vel.ToRotation(); Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.035f)); } } else //straight accel mode { if (++Projectile.ai[1] < 75) { Projectile.velocity *= 1.06f; } } } else //ai1 below 0 rn { Projectile.ai[1]++; } }
public override bool PreAI() { for (int i = 0; i < 16; i++) { float x = projectile.Center.X - projectile.velocity.X / 10f * (float)i; float y = projectile.Center.Y - projectile.velocity.Y / 10f * (float)i; int num = Dust.NewDust(new Vector2(x, y), 26, 26, 6, 0f, 0f, 0, default(Color), 1f); Main.dust[num].alpha = projectile.alpha; Main.dust[num].position.X = x; Main.dust[num].position.Y = y; Main.dust[num].velocity *= 0f; Main.dust[num].noGravity = true; } if (projectile.ai[0] == 0 && Main.netMode != 1) { target = -1; float distance = 2000f; for (int k = 0; k < 255; k++) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float currentDistance = Vector2.Distance(center, projectile.Center); if (currentDistance < distance || target == -1) { distance = currentDistance; target = k; } } } if (target != -1) { projectile.ai[0] = 1; projectile.netUpdate = true; } } else if (target >= 0 && target < Main.maxPlayers) { Player targetPlayer = Main.player[target]; if (!targetPlayer.active || targetPlayer.dead) { target = -1; projectile.ai[0] = 0; projectile.netUpdate = true; } else { float currentRot = projectile.velocity.ToRotation(); Vector2 direction = targetPlayer.Center - projectile.Center; float targetAngle = direction.ToRotation(); if (direction == Vector2.Zero) { targetAngle = currentRot; } float desiredRot = currentRot.AngleLerp(targetAngle, 0.1f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(desiredRot, default(Vector2)); } } return(true); }
public override void AI() { int ai0 = (int)projectile.ai[0]; if (ai0 > -1 && ai0 < Main.maxNPCs && Main.npc[ai0].active && Main.npc[ai0].CanBeChasedBy()) { if (projectile.localAI[1] < 1f) { float rotation = projectile.velocity.ToRotation(); //homing Vector2 vel = Main.npc[ai0].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, projectile.localAI[1])); projectile.localAI[1] += 1f / 300f; } else { projectile.velocity = projectile.DirectionTo(Main.npc[ai0].Center) * projectile.velocity.Length(); //f**k it homing } } else { if (++projectile.localAI[0] > 6f) { projectile.localAI[0] = 1f; float maxDistance = 1500f; int possibleTarget = -1; for (int i = 0; i < 200; i++) { NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(projectile))// && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) { float npcDistance = projectile.Distance(npc.Center); if (npcDistance < maxDistance) { maxDistance = npcDistance; possibleTarget = i; } } } if (possibleTarget >= 0) { projectile.ai[0] = possibleTarget; projectile.netUpdate = true; } } } if (++projectile.localAI[0] < 300) { projectile.velocity *= 1.005f; } if (projectile.localAI[0] == 0) { projectile.localAI[0] = 1; projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); projectile.rotation = Main.rand.NextFloat((float)Math.PI * 2); Main.PlaySound(SoundID.Item92, projectile.Center); } projectile.rotation += 0.15f * Math.Sign(projectile.velocity.X); if (++projectile.frameCounter > 2) { projectile.frameCounter = 0; if (++projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } } }
public override void AI() { int index = Dust.NewDust(Projectile.Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noLight = true; Main.dust[index].noGravity = true; Main.dust[index].velocity = Projectile.velocity; Main.dust[index].position -= Vector2.One * 4f; Main.dust[index].scale = 0.8f; /*if (++Projectile.frameCounter >= 12 * 12) * { * Projectile.frameCounter = 0; * if (++Projectile.frame >= 5) * Projectile.frame = 0; * }*/ if (FargoSoulsWorld.EternityMode && FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.CosmosChampion>())) { float rotation = Projectile.velocity.ToRotation(); Vector2 vel = Main.player[Main.npc[EModeGlobalNPC.championBoss].target].Center - Projectile.Center; float targetAngle = vel.ToRotation(); Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.001f)); } }
public override bool PreAI() { projectile.rotation = projectile.velocity.ToRotation() + 1.57F; if (projectile.ai[0] == 0 && Main.netMode != 1) { target = -1; float distance = 2000f; for (int k = 0; k < 255; k++) { if (Main.player[k].active && !Main.player[k].dead) { Vector2 center = Main.player[k].Center; float currentDistance = Vector2.Distance(center, projectile.Center); if (currentDistance < distance || target == -1) { distance = currentDistance; target = k; } } } if (target != -1) { projectile.ai[0] = 1; projectile.netUpdate = true; } } else { Player targetPlayer = Main.player[this.target]; if (!targetPlayer.active || targetPlayer.dead) { this.target = -1; projectile.ai[0] = 0; projectile.netUpdate = true; } else { float currentRot = projectile.velocity.ToRotation(); Vector2 direction = targetPlayer.Center - projectile.Center; float targetAngle = direction.ToRotation(); if (direction == Vector2.Zero) { targetAngle = currentRot; } float desiredRot = currentRot.AngleLerp(targetAngle, 0.1f); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(desiredRot, default(Vector2)); } } if (projectile.timeLeft <= 60) { projectile.alpha -= 4; } int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 135, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); Main.dust[dust].scale = 0.5f; return(false); }
public override void AI() { if (Projectile.localAI[0] == 0) { SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); for (int i = 0; i < 5; i++) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, Projectile.velocity.X, Projectile.velocity.Y, 0, default(Color), 1.5f); Main.dust[d].velocity *= 6f; } } if (++Projectile.localAI[0] > 30 && Projectile.localAI[0] < 120) { Projectile.velocity *= Projectile.ai[0]; } if (Projectile.localAI[0] > 60 && Projectile.localAI[0] < 180) { if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.SpiritChampion>())) { float rotation = Projectile.velocity.ToRotation(); Vector2 vel = Main.player[Main.npc[EModeGlobalNPC.championBoss].target].Center - Projectile.Center; float targetAngle = vel.ToRotation(); Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, Projectile.ai[1])); } } Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0 ? -1 : 1; Projectile.rotation = Projectile.velocity.ToRotation(); if (Projectile.spriteDirection < 0) { Projectile.rotation += (float)Math.PI; } Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 54, 0f, 0f, 0, default(Color), 2f)].noGravity = true; }
public override void AI() { if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item20, projectile.position); projectile.localAI[0] = 1f; projectile.ai[1] = -1f; } int dust = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(244, 66, 113), 1f); Main.dust[dust].velocity *= 0.1f; if (projectile.velocity == Vector2.Zero) { Main.dust[dust].velocity.Y -= 1f; Main.dust[dust].scale = 1.2f; } else { Main.dust[dust].velocity += projectile.velocity * 0.2f; } /*Main.dust[dust].position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); * Main.dust[dust].position.Y = projectile.Center.Y + Main.rand.Next(-2, 3);*/ Main.dust[dust].noGravity = true; NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1]); if (npc != null) //has target { float rotation = projectile.velocity.ToRotation(); Vector2 vel = npc.Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, 0.008f)); } else //currently has no target { if (--projectile.localAI[1] < 0) { projectile.localAI[1] = 10; projectile.ai[1] = FargoSoulsUtil.FindClosestHostileNPC(projectile.Center, 2000); if (projectile.ai[1] != -1) { projectile.netUpdate = true; } } } }
public override void AI() //vanilla code echprimebegone { if (++projectile.localAI[1] < 45 * projectile.MaxUpdates && EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.CosmosChampion>()) && Main.npc[EModeGlobalNPC.championBoss].HasValidTarget) //home { float rotation = projectile.velocity.ToRotation(); Vector2 vel = Main.player[Main.npc[EModeGlobalNPC.championBoss].target].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, projectile.ai[0])); } float num1 = 5f; float num2 = 250f; float num3 = 6f; Vector2 vector2_1 = new Vector2(8f, 10f); float num4 = 1.2f; Vector3 rgb = new Vector3(0.7f, 0.1f, 0.5f); int num5 = 4 * projectile.MaxUpdates; int Type1 = Utils.SelectRandom <int>(Main.rand, new int[5] { 242, 73, 72, 71, (int)byte.MaxValue }); int Type2 = (int)byte.MaxValue; if ((double)projectile.ai[1] == 0.0) { projectile.ai[1] = 1f; projectile.localAI[0] = (float)-Main.rand.Next(48); Main.PlaySound(SoundID.Item34, projectile.position); } else if ((double)projectile.ai[1] == 1.0 && projectile.owner == Main.myPlayer) { } else if ((double)projectile.ai[1] > (double)num1) { } if ((double)projectile.ai[1] >= 1.0 && (double)projectile.ai[1] < (double)num1) { ++projectile.ai[1]; if ((double)projectile.ai[1] == (double)num1) { projectile.ai[1] = 1f; } } projectile.alpha = projectile.alpha - 40; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.spriteDirection = projectile.direction; projectile.frameCounter = projectile.frameCounter + 1; if (projectile.frameCounter >= num5) { projectile.frame = projectile.frame + 1; projectile.frameCounter = 0; if (projectile.frame >= 4) { projectile.frame = 0; } } Lighting.AddLight(projectile.Center, rgb); projectile.rotation = projectile.velocity.ToRotation(); ++projectile.localAI[0]; if ((double)projectile.localAI[0] == 48.0) { projectile.localAI[0] = 0.0f; } else if (projectile.alpha == 0) { for (int index1 = 0; index1 < 2; ++index1) { Vector2 vector2_2 = Vector2.UnitX * -30f; Vector2 vector2_3 = -Vector2.UnitY.RotatedBy((double)projectile.localAI[0] * 0.130899697542191 + (double)index1 * 3.14159274101257, new Vector2()) * vector2_1 - projectile.rotation.ToRotationVector2() * 10f; int index2 = Dust.NewDust(projectile.Center, 0, 0, Type2, 0.0f, 0.0f, 160, new Color(), 1f); Main.dust[index2].scale = num4; Main.dust[index2].noGravity = true; Main.dust[index2].position = projectile.Center + vector2_3 + projectile.velocity * 2f; Main.dust[index2].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[index2].position) * 2f + projectile.velocity * 2f; } } if (Main.rand.Next(12) == 0) { for (int index1 = 0; index1 < 1; ++index1) { Vector2 vector2_2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index2].velocity *= 0.1f; Main.dust[index2].position = projectile.Center + vector2_2 * (float)projectile.width / 2f + projectile.velocity * 2f; Main.dust[index2].fadeIn = 0.9f; } } if (Main.rand.Next(64) == 0) { for (int index1 = 0; index1 < 1; ++index1) { Vector2 vector2_2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f); Main.dust[index2].velocity *= 0.3f; Main.dust[index2].position = projectile.Center + vector2_2 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[index2].fadeIn = 1.4f; } } } if (Main.rand.Next(4) == 0) { for (int index1 = 0; index1 < 2; ++index1) { Vector2 vector2_2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Type1, 0.0f, 0.0f, 0, new Color(), 1.2f); Main.dust[index2].velocity *= 0.3f; Main.dust[index2].noGravity = true; Main.dust[index2].position = projectile.Center + vector2_2 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[index2].fadeIn = 1.4f; } } } if (Main.rand.Next(12) == 0 && projectile.type == 634) { Vector2 vector2_2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, Type2, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].velocity *= 0.3f; Main.dust[index].position = projectile.Center + vector2_2 * (float)projectile.width / 2f; Main.dust[index].fadeIn = 0.9f; Main.dust[index].noGravity = true; } if (Main.rand.Next(3) == 0 && projectile.type == 635) { Vector2 vector2_2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, Type2, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].velocity *= 0.3f; Main.dust[index].position = projectile.Center + vector2_2 * (float)projectile.width / 2f; Main.dust[index].fadeIn = 1.2f; Main.dust[index].scale = 1.5f; Main.dust[index].noGravity = true; } }
public override void AI() { int ai0 = (int)projectile.ai[0]; if (ai0 > -1 && ai0 < Main.maxNPCs && Main.npc[ai0].active && Main.npc[ai0].CanBeChasedBy()) { if (projectile.localAI[1] < 1f) { float rotation = projectile.velocity.ToRotation(); //homing Vector2 vel = Main.npc[ai0].Center - projectile.Center; float targetAngle = vel.ToRotation(); projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, projectile.localAI[1])); projectile.localAI[1] += 1f / 300f; } else { projectile.velocity = projectile.DirectionTo(Main.npc[ai0].Center) * projectile.velocity.Length(); //f**k it homing } } else { if (++projectile.localAI[0] > 6f) { projectile.localAI[0] = 1f; projectile.ai[0] = FargoSoulsUtil.FindClosestHostileNPCPrioritizingMinionFocus(projectile, 1500f); projectile.netUpdate = true; } } if (++projectile.localAI[0] < 300) { projectile.velocity *= 1.005f; } if (projectile.localAI[0] == 0) { projectile.localAI[0] = 1; projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); projectile.rotation = Main.rand.NextFloat((float)Math.PI * 2); Main.PlaySound(SoundID.Item92, projectile.Center); } projectile.rotation += 0.15f * Math.Sign(projectile.velocity.X); if (++projectile.frameCounter > 2) { projectile.frameCounter = 0; if (++projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } } }