public override void AI() { BaseAI.AISkull(npc, ref npc.ai, false, 6f, 350f, 0.6f, 0.15f); Player player = Main.player[npc.target]; bool playerActive = player != null && player.active && !player.dead; if (shootAI < 60) { BaseAI.LookAt(player.Center, npc, 3, 0, .1f, false); } if (Main.netMode != 1 && playerActive) { shootAI++; if (shootAI >= 90) { shootAI = 0; int projType = mod.ProjType("NeutralizerP"); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, projType, (int)(npc.damage * 0.25f), 3f, Main.myPlayer, npc.whoAmI); } } } }
public override void AI() { if (npc.alpha > 0) { npc.alpha -= 5; } else { npc.alpha = 0; } npc.noGravity = true; npc.TargetClosest(true); Player player = Main.player[npc.target]; for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; BaseAI.AISkull(npc, ref npc.ai, true, 10, 350, .03f, .04f); if (npc.ai[1] <= 400f) { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <Fireshot>(), ref npc.ai[2], Main.rand.Next(80, 130), npc.damage / 2, 7, true); } npc.rotation = 0; }
public override void AI() { npc.TargetClosest(true); Player player = Main.player[npc.target]; for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; BaseAI.AISkull(npc, ref npc.ai, true, 4, 250, .2f, .26f); if (npc.ai[1] <= 600f) { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjectileType("CurseFlame"), ref npc.ai[3], 120, npc.damage / 2, 12, false); } if (player.Center.X < npc.Center.X) { npc.direction = npc.spriteDirection = -1; } else { npc.direction = npc.spriteDirection = 1; } }
public override void AI() { BaseAI.AISkull(npc, ref npc.ai, false, 6f, 350f, 0.1f, 0.15f); Player player = Main.player[npc.target]; bool playerActive = player != null && player.active && !player.dead; BaseAI.LookAt(playerActive ? player.Center : (npc.Center + npc.velocity), npc, 0); if (Main.netMode != 1 && playerActive) { npc.ai[2]++; if (npc.ai[2] >= 90) { npc.ai[2] = 0; int projType = mod.ProjType("PurityShot"); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { BaseAI.FireProjectile(player.Center, npc, projType, (int)(npc.damage * 0.25f), 0f, 2f); } npc.netUpdate2 = true; } } if (npc.frameCounter++ > 7) { npc.frameCounter = 0; npc.frame.Y += 26; if (npc.frame.Y > 26 * 2) { npc.frame.Y = 0; } } }
public override void AI() { npc.noGravity = true; npc.TargetClosest(true); Player player = Main.player[npc.target]; for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; BaseAI.AISkull(npc, ref npc.ai, true, 4, 350, .015f, .02f); if (npc.ai[1] <= 600f) { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <Bosses.Observer.Starbeam>(), ref npc.ai[2], 100, npc.damage / 2, 7, true); } if (npc.ai[0] < 200) { BaseAI.LookAt(player.Center, npc, 1); } else { if (npc.timeLeft > 10) { npc.timeLeft = 10; } npc.spriteDirection = -npc.direction; } npc.rotation = 0; }
public override void AI() { dash = false; npc.TargetClosest(true); Player player = Main.player[npc.target]; npc.direction = npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1; switch (npc.ai[2]) { case 0: BaseAI.AISkull(npc, ref npc.ai, false, 4, 250, .011f, .22f); break; case 1: if (++npc.ai[3] > 30) { Vector2 targetPos = player.Center; targetPos.X += 600 * (npc.Center.X < targetPos.X ? -1 : 1); DashMovement(targetPos, 0.8f); if (npc.ai[3] > 180 || Math.Abs(npc.Center.Y - targetPos.Y) < 50) //initiate dash { npc.ai[2]++; npc.ai[3] = 0; npc.netUpdate = true; npc.velocity.X = -30 * (npc.Center.X < player.Center.X ? -1 : 1); npc.velocity.Y *= 0.1f; } } else { npc.velocity *= 0.9f; //decelerate briefly } npc.rotation = 0; break; case 2: //dashing dash = true; if (++npc.ai[3] > 240 || (Math.Sign(npc.velocity.X) > 0 ? npc.Center.X > player.Center.X + 600 : npc.Center.X < player.Center.X - 600)) { npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } break; default: npc.ai[2] = 0; goto case 0; } npc.rotation = 0; }
public override void AI() { Player player = Main.player[npc.target]; BaseAI.AISkull(npc, ref npc.ai, true, 4, 300, .011f, .020f); BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjType("TerraShot"), ref shootAI[0], 120, (int)(npc.damage * (Main.expertMode ? 0.25f : 0.5f)), 3f, true, new Vector2(20f, 15f)); if (npc.alpha != 0) { for (int spawnDust = 0; spawnDust < 2; spawnDust++) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, default, .8f);
public override void AI() { BaseAI.AISkull(npc, ref npc.ai, false, 6f, 350f, 0.1f, 0.15f); Player player = Main.player[npc.target]; bool playerActive = player != null && player.active && !player.dead; BaseAI.LookAt(playerActive ? player.Center : (npc.Center + npc.velocity), npc, 0); if (Main.netMode != 1 && playerActive) { shootAI++; if (shootAI >= 90) { shootAI = 0; int projType = mod.ProjType("Sunbeam"); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { BaseAI.FireProjectile(player.Center, npc, projType, (int)(npc.damage * 0.25f), 0f, 2f); } } } }
public override void AI() { BaseAI.AISkull(npc, ref npc.ai, false, 6f, 350f, 0.1f, 0.15f); Player player = Main.player[npc.target]; bool playerActive = player != null && player.active && !player.dead; BaseAI.Look(npc, ref npc.rotation, ref npc.spriteDirection, 1, 0, 0, true); if (Main.netMode != 1 && playerActive) { shootAI++; if (shootAI >= 120) { shootAI = 0; int projType = mod.ProjType("SockLaser"); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { BaseAI.FireProjectile(player.Center, npc, projType, (int)(npc.damage * 0.25f), 0f, 2f); } } } }
public override void AI() { if ((npc.ai[0] == 4 && NPC.CountNPCS(mod.NPCType("ZeroEcho")) > 0 && !Counterattack) || isCharging) { npc.dontTakeDamage = true; } else { npc.dontTakeDamage = false; } int Repeats; if (npc.life < npc.life * (2 / 3)) { Counter[0]++; Counter[1]++; Repeats = 4; } else if (npc.life < npc.life / 3) { Counter[0]++; Counter[1]++; Repeats = 5; } else { Counter[0] += 2; Counter[1] += 2; Repeats = 3; } npc.TargetClosest(true); Player player = Main.player[npc.target]; if (!AliveCheck(player)) { return; } if (Counter[0] >= 4000) { Counter[0] = 4000; } if (Counter[1] >= 6000) { Counter[1] = 0; isCharging = true; npc.ai[0] = 5; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } if (Main.netMode != 1) { AAWorld.zeroUS = false; } for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; int Changerate = npc.life < npc.lifeMax / 2 ? 150 : 120; if (npc.ai[2]++ > Changerate && !Counterattack) { if (npc.ai[0] != 0) { npc.velocity *= .0f; } switch (npc.ai[0]) { case 0: if (!AliveCheck(player)) { break; } float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - npc.Center); dir *= 12f; float baseSpeed = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y)); double startAngle = Math.Atan2(dir.X, dir.Y) - .1d; double deltaAngle = spread / 6f; if (npc.ai[2] % 30 == 0) { for (int i = 0; i < 3; i++) { if (npc.ai[2] % Main.rand.Next(10) == 0 && Main.rand.Next(2) == 0) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType <StaticSphere>(), npc.damage / 4, 5, Main.myPlayer); } } } if (npc.ai[2] > 271) { AIChange(); } break; case 1: if (!AliveCheck(player)) { break; } if (npc.ai[2] % 30 == 0 && npc.ai[2] < 121) { Teleport(3); } if (npc.ai[2] % 60 == 30) { Attack(Main.rand.Next(4)); } if (npc.ai[3] < Repeats && npc.ai[2] > 280) { npc.ai[3]++; npc.ai[2] = Changerate; } else { AIChange(); } break; case 2: if (!AliveCheck(player)) { break; } npc.velocity *= 0; if (npc.ai[2] == 160) { if (npc.life > npc.lifeMax / 2) { if (Main.rand.Next(2) == 0) { int dirY = player.velocity.Y > 0? 1:-1; int yPos = Math.Abs(player.velocity.Y) > 4f? -300 * dirY : -900 * dirY; for (int z = 0; z < 13; z++) { int a1 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 0f, 0f); int a2 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 1f, 0f); Main.projectile[a1].Center = player.Center + new Vector2(-300, yPos); Main.projectile[a2].Center = player.Center + new Vector2(300, yPos); yPos += 150 * dirY; } } else { int dirX = player.velocity.X > 0? 1:-1; int xPos = Math.Abs(player.velocity.X) > 4f? -300 * dirX : -900 * dirX; for (int z = 0; z < 13; z++) { int h1 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 2f, 0f); int h2 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 3f, 0f); Main.projectile[h1].Center = player.Center + new Vector2(xPos, -300); Main.projectile[h2].Center = player.Center + new Vector2(xPos, 300); xPos += 150 * dirX; } } } else { int dirX = player.velocity.X > 0? 1:-1; int dirY = player.velocity.Y > 0? 1:-1; int xPos = Math.Abs(player.velocity.X) > 4f? -300 * dirX : -900 * dirX; int yPos = Math.Abs(player.velocity.Y) > 4f? -300 * dirY : -900 * dirY; for (int z = 0; z < 13; z++) { int a1 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 0f, 0f); int a2 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 1f, 0f); Main.projectile[a1].Center = player.Center + new Vector2(-300, yPos); Main.projectile[a2].Center = player.Center + new Vector2(300, yPos); yPos += 150 * dirY; } for (int z = 0; z < 13; z++) { int h1 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 2f, 0f); int h2 = Projectile.NewProjectile(new Vector2(player.Center.X, player.Center.Y), Vector2.Zero, mod.ProjectileType("Blast"), damage, 3, Main.myPlayer, 3f, 0f); Main.projectile[h1].Center = player.Center + new Vector2(xPos, -300); Main.projectile[h2].Center = player.Center + new Vector2(xPos, 300); xPos += 150 * dirX; } } } if (npc.ai[2] > 400) { npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; case 3: if (!AliveCheck(player)) { break; } if (npc.ai[2] == (npc.life < npc.lifeMax / 2 ? 200 : 300)) { Teleport(3); int a = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, -12f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[a].Center = npc.Center + new Vector2(-100, 0); int b = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, 12f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[b].Center = npc.Center + new Vector2(100, 0); int c = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-12f, 0), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[c].Center = npc.Center + new Vector2(0, 100); int d = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(12f, 0), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[d].Center = npc.Center + new Vector2(0, -100); if (npc.life < npc.lifeMax / 2) { int a1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, 12f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[a1].Center = npc.Center + new Vector2(-100, 0); int b1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, -12f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[b1].Center = npc.Center + new Vector2(100, 0); int c1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(12f, 0), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[c1].Center = npc.Center + new Vector2(0, 100); int d1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-12f, 0), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[d1].Center = npc.Center + new Vector2(0, -100); int e = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, -8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[e].Center = npc.Center + new Vector2(-80, -80); int e1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, 8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[e1].Center = npc.Center + new Vector2(-80, -80); int f = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, 8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[f].Center = npc.Center + new Vector2(80, 80); int f1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, -8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[f1].Center = npc.Center + new Vector2(80, 80); int g = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, -8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[g].Center = npc.Center + new Vector2(-80, 80); int g1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, 8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[g1].Center = npc.Center + new Vector2(-80, 80); int h = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, 8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[h].Center = npc.Center + new Vector2(80, -80); int h1 = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, -8f), mod.ProjectileType("ProtoStar"), damage, 3); Main.projectile[h1].Center = npc.Center + new Vector2(80, -80); } } if (npc.ai[2] > (npc.life < npc.lifeMax / 2 ? 260 : 360)) { AIChange(); } break; case 4: if (!AliveCheck(player)) { break; } if (npc.ai[2] < (npc.life < npc.lifeMax / 2 ? 360 : 270)) { if (npc.ai[3]++ > 30) { npc.ai[3] = 0; Teleport(0); NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <ZeroEcho>()); } } if (npc.ai[2] == (npc.life < npc.lifeMax / 2 ? 400 : 310)) { npc.ai[1] = 1f; } else { npc.ai[1] = 0f; } if (npc.ai[2] >= (npc.life < npc.lifeMax / 2 ? 480 : 390)) { npc.ai[0] = 1; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; case 5: if (!AliveCheck(player)) { break; } Counterattack = false; if (npc.ai[1]++ == 100) { if (Main.netMode != 1) { AAMod.Chat(Lang.BossChat("ZeroAwakened11"), Color.Red.R, Color.Red.G, Color.Red.B); } if (ShootDir == new Vector2(0, 0)) { ShootDir = npc.DirectionTo(player.Center); } Projectile.NewProjectile(npc.position, 10f * ShootDir, ModContent.ProjectileType <EchoRay>(), 100, 3f, Main.myPlayer, 0, npc.whoAmI); npc.ai[3] = 1f; } else { npc.ai[3] = 0f; } if (npc.ai[1] < 85) { if (npc.ai[2] % (npc.life < npc.lifeMax / 2? 40:60) == 10) { Teleport(3); NPC.NewNPC((int)player.Center.X + 50 * Main.rand.Next(4, 6) * (Main.rand.Next(2) == 0? -1:1), (int)player.Center.Y + 50 * Main.rand.Next(4, 6) * (Main.rand.Next(2) == 0? -1:1), ModContent.NPCType <ZeroMini>()); } npc.rotation = npc.DirectionTo(player.Center).ToRotation() + (float)Math.PI / 2; ShootDir = npc.DirectionTo(player.Center); } if (npc.ai[1] >= 190) { isCharging = false; npc.ai[0] = 1; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; default: if (!AliveCheck(player)) { break; } npc.ai[0] = 0; goto case 0; } } else if (isCharging) { if (npc.ai[2] == 10) { if (Main.netMode != 1) { AAMod.Chat(Lang.BossChat("ZeroAwakened8"), Color.Red.R, Color.Red.G, Color.Red.B); } if (Main.netMode != 1) { AAMod.Chat(Lang.BossChat("ZeroAwakened9"), Color.Red.R, Color.Red.G, Color.Red.B); } } if (npc.ai[2] == 40) { if (Main.netMode != 1) { AAMod.Chat(Lang.BossChat("ZeroAwakened10"), Color.Red.R, Color.Red.G, Color.Red.B); } } if (npc.ai[2] == 110) { if (Main.netMode != 1) { AAMod.Chat(@"[Y]", Color.Red.R, Color.Red.G, Color.Red.B); } } npc.rotation = npc.DirectionTo(player.Center).ToRotation() + (float)Math.PI / 2; if (npc.ai[2] % (npc.life < npc.lifeMax / 2? 40:60) == 10) { Teleport(3); NPC.NewNPC((int)player.Center.X + 50 * Main.rand.Next(4, 6) * (Main.rand.Next(2) == 0? -1:1), (int)player.Center.Y + 50 * Main.rand.Next(4, 6) * (Main.rand.Next(2) == 0? -1:1), ModContent.NPCType <ZeroMini>()); } Counterattack = false; npc.ai[1] = 0f; npc.ai[3] = 0f; } else if (Counterattack) { npc.ai[2]++; npc.position = player.Center - new Vector2(0, 600); npc.velocity *= 0; if (npc.ai[2] == 120) { NPC.NewNPC((int)player.Center.X, (int)player.Center.Y + 300, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 300, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X + 300, (int)player.Center.Y, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X + 300, (int)player.Center.Y + 300, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y - 300, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X + 300, (int)player.Center.Y - 300, ModContent.NPCType <ZeroEcho>()); NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y + 300, ModContent.NPCType <ZeroEcho>()); } if (npc.ai[2] == 300) { npc.ai[1] = 1f; } else { npc.ai[1] = 0f; } if (npc.ai[2] > 400) { Counterattack = false; npc.ai[0] = 2; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } } else { BaseAI.AISkull(npc, ref Move, true, 14, 350, .04f, .05f); int Frequency = Main.rand.Next(30, 50); if (npc.life < npc.lifeMax / 2) { Frequency = Main.rand.Next(20, 50); } if (npc.life < npc.lifeMax / 4) { Frequency = Main.rand.Next(10, 40); } if (Main.rand.Next(2) == 0) { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <GlitchBomb>(), ref npc.ai[3], Frequency, npc.damage / 3, 10, true); } else { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <GlitchRocket>(), ref npc.ai[3], Frequency, npc.damage / 3, 10, true); } } if ((npc.Center - player.Center).Length() > 2000 && !isCharging && !Counterattack) { Teleport(0); } if (npc.ai[0] != 5) { npc.direction = npc.spriteDirection = 1; npc.rotation = 0; } }
public override void AI() { if (body == -1) { int npcID = BaseAI.GetNPC(npc.Center, mod.NPCType("ZeroProtocol"), -1, null); if (npcID >= 0) { body = npcID; } } if (body == -1) { return; } NPC zero = Main.npc[body]; npc.TargetClosest(true); Player player = Main.player[npc.target]; if (npc.ai[0] == 0) { npc.velocity *= 0; } else if (npc.ai[0] == 1) { npc.ai[1]++; if (npc.ai[1] % 180 == 60) { if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, -14f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(0f, 14f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(14f, 0f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-14f, 0f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); } } if (npc.ai[1] % 180 == 120) { if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(10f, -10f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-10f, -10f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-10f, 10f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(10f, 10f), mod.ProjectileType("ProtoStar"), npc.damage / 2, 3); } } } else if (npc.ai[0] == 2) { npc.velocity *= 0; if (Main.netMode != NetmodeID.MultiplayerClient) { int direction = Main.rand.Next(2) == 0? 1:-1; Projectile.NewProjectile(npc.Center + new Vector2(30, 30), new Vector2(10, 10), mod.ProjectileType("EchoRay"), npc.damage / 3, 0f, Main.myPlayer, direction * 6.2831855f / 750f, npc.whoAmI); Projectile.NewProjectile(npc.Center + new Vector2(-30, 30), new Vector2(-10, 10), mod.ProjectileType("EchoRay"), npc.damage / 3, 0f, Main.myPlayer, direction * 6.2831855f / 750f, npc.whoAmI); Projectile.NewProjectile(npc.Center + new Vector2(30, -30), new Vector2(10, -10), mod.ProjectileType("EchoRay"), npc.damage / 3, 0f, Main.myPlayer, direction * 6.2831855f / 750f, npc.whoAmI); Projectile.NewProjectile(npc.Center + new Vector2(-30, -30), new Vector2(-10, -10), mod.ProjectileType("EchoRay"), npc.damage / 3, 0f, Main.myPlayer, direction * 6.2831855f / 750f, npc.whoAmI); } npc.ai[0] = 3; npc.ai[1] = 0; npc.netUpdate = true; } else if (npc.ai[0] == 3) { npc.velocity *= 0; npc.ai[1]++; if (npc.ai[1] >= 90) { npc.ai[1] = 0; npc.ai[0] = 1; npc.netUpdate = true; } return; } else { if (Main.rand.Next(2) == 0) { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjectileType("GlitchBomb"), ref npc.ai[3], 50, npc.damage / 3, 10, true); } else { BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjectileType("GlitchRocket"), ref npc.ai[3], 50, npc.damage / 3, 10, true); } } npc.ai[2]++; if (npc.ai[2] > 360 && npc.ai[0] != 2) { npc.ai[0] = Main.rand.Next(2) == 0? 1:3; npc.netUpdate = true; } if (zero.ai[0] == 5 && zero.ai[3] == 1f) { npc.ai[0] = 2; npc.netUpdate = true; } else if ((npc.ai[2] > 360 && npc.ai[0] != 2) || npc.ai[0] == 2) { npc.ai[0] = Main.rand.Next(2) == 0? 1:3; npc.ai[1] = 0; npc.netUpdate = true; npc.ai[2] = 0; } if (npc.ai[0] != 3 && npc.ai[0] != 2 && npc.ai[0] != 0) { if ((npc.Center - player.Center).Length() > 400f) { MoveToPoint(player.Center); } else { BaseAI.AISkull(npc, ref Move, true, 14, 350, .04f, .05f); } } }
public override void AI() { if (!title) { CSkies.ShowTitle(npc, 3); title = true; } Lighting.AddLight(npc.Center, 0, 0f, .15f); npc.TargetClosest(); if (!Main.dayTime) { if (npc.alpha <= 0) { npc.alpha = 0; } else { npc.alpha -= 5; } } else { if (npc.alpha >= 255) { npc.active = false; } else { npc.alpha += 5; } } if (internalAI[3] == 0 && npc.ai[3] < 1000) { if (Main.netMode != NetmodeID.MultiplayerClient) { for (int m = 0; m < StarCount; m++) { int projectileID = Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("BlackHole"), npc.damage / 4, 4, Main.myPlayer, m); Main.projectile[projectileID].Center = npc.Center; Main.projectile[projectileID].velocity = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble())); Main.projectile[projectileID].velocity *= 8f; } internalAI[3] = 1; npc.netUpdate = true; } } if (internalAI[1] < 120) { internalAI[1] += 2; } else { internalAI[1] = 120; npc.netUpdate = true; } BaseAI.AISkull(npc, ref npc.ai, true, 11, 350, .05f, .07f); if (Main.netMode != NetmodeID.MultiplayerClient) { if (internalAI[2]++ > 200) { FireLaser(npc); internalAI[2] = 0; npc.netUpdate = true; } if (npc.ai[3] == 1200f) { npc.netUpdate = true; } else if (npc.ai[3] < 1200) { npc.ai[3]++; npc.netUpdate = true; if (npc.ai[2]++ == (Main.expertMode ? 400 : 500)) { internalAI[0] += 1; npc.netUpdate = true; } } if (!CUtils.AnyProjectiles(ModContent.ProjectileType <BlackHole>())) { npc.ai[2] = 0; internalAI[0] = 0; internalAI[1] = 0; internalAI[2] = 0; internalAI[3] = 0; npc.netUpdate = true; } } if (npc.ai[3] >= 1200f) { if (npc.ai[3] > (Main.expertMode ? 1500 : 1400)) { npc.ai[3] = 0; npc.netUpdate = true; } else { npc.ai[3]++; } npc.ai[2] = 0; npc.velocity *= .98f; if (VortexScale < 1f) { VortexScale += .01f; } VortexRotation += .3f; for (int u = 0; u < Main.maxPlayers; u++) { Player target = Main.player[u]; if (target.active && Vector2.Distance(npc.Center, target.Center) < 260 * VortexScale) { float num3 = 6f; Vector2 vector = new Vector2(target.position.X + target.width / 4, target.position.Y + target.height / 4); float num4 = npc.Center.X - vector.X; float num5 = npc.Center.Y - vector.Y; float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5); num6 = num3 / num6; num4 *= num6; num5 *= num6; int num7 = 4; target.velocity.X = (target.velocity.X * (num7 - 1) + num4) / num7; target.velocity.Y = (target.velocity.Y * (num7 - 1) + num5) / num7; } } } else { if (VortexScale > 0f) { VortexScale -= .05f; } VortexRotation += .05f; } npc.rotation = 0; for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; }
public override void AI() { Player player = Main.player[npc.target]; MinionType = (int)npc.ai[0]; if (npc.ai[2] == 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[2]++; } if (npc.ai[2] > 30) { npc.ai[2] = 1; npc.netUpdate = true; } } else { if (MinionType <= 7 || MinionType == 9 || MinionType == 10 || MinionType == 11 || MinionType == 12 || MinionType == 13 || MinionType == 14 || MinionType == 15 || MinionType == 17 || MinionType == 18 || MinionType == 19 || MinionType == 24 || MinionType == 25) //If Earlygame ore, Crimtane, Incinerite, Abyssium, Hellstone, Cobalt, Palladium, Mythril, Adamantite, or Titanium, have Melee AI. { float Speed = 3; if (MinionType == 11) { Speed = 5; } if (MinionType == 24) { npc.ai[3]++; for (int m = npc.oldPos.Length - 1; m > 0; m--) { npc.oldPos[m] = npc.oldPos[m - 1]; } npc.oldPos[0] = npc.position; } if (MinionType == 24 && npc.ai[3] > 300) { BaseAI.AITackle(npc, ref npc.ai, Main.player[npc.target].Center, 0.5f, 12f, true, 60); if (npc.ai[3] > 420) { npc.ai[3] = 0; } } else { BaseAI.AIElemental(npc, ref internalAI, ref idleTimer, null, 120, false, true, 400, 200f, 180, Speed); } } else //if Demonite, Oricalcum, Chlorophite, or Technecium, Ranged AI { npc.noTileCollide = true; BaseAI.AISkull(npc, ref internalAI, false, 6, 350, 0.14f, .2f); if (Main.netMode != NetmodeID.MultiplayerClient) { int p; if (MinionType == 8) //Demonite { p = ProjectileID.CursedFlameHostile; ShootPeriodic(npc, player.position, player.width, player.height, p, ref npc.ai[1], 120, npc.damage / 2, 9, false); } else if (MinionType == 20) //Chlorophyte { p = ProjectileID.CrystalLeafShot; ShootPeriodic(npc, player.position, player.width, player.height, p, ref npc.ai[1], 120, npc.damage / 2, 9, false); } else if (MinionType == 22) //Nebula { p = mod.ProjectileType("Nebula"); ShootPeriodic(npc, player.position, player.width, player.height, p, ref npc.ai[1], 200, npc.damage / 2, 9, false); } else if (MinionType == 23) //Vortex { p = 640; ShootPeriodic(npc, player.position, player.width, player.height, p, ref npc.ai[1], 200, npc.damage / 2, 9, false); } else if (MinionType == 16 && npc.ai[1]++ > 180) //Oricalcum { npc.ai[1] = 0; int direction = npc.direction; float num = Main.screenPosition.X; if (direction < 0) { num += Main.screenWidth; } float num2 = Main.screenPosition.Y; num2 += Main.rand.Next(Main.screenHeight); Vector2 vector = new Vector2(num, num2); float num3 = npc.position.X - vector.X; float num4 = npc.position.Y - vector.Y; num3 += Main.rand.Next(-50, 51) * 0.1f; num4 += Main.rand.Next(-50, 51) * 0.1f; int num5 = 24; float num6 = (float)Math.Sqrt(num3 * num3 + num4 * num4); num6 = num5 / num6; num3 *= num6; num4 *= num6; int l = Projectile.NewProjectile(num, num2, num3, num4, 221, 36, 0f, Main.myPlayer, 0f, 0f); Main.projectile[l].friendly = false; Main.projectile[l].hostile = true; npc.netUpdate = true; } } } } if (MinionType == 18) //Titanium Shadow Dodge { shadowDodge = shadowDodgeTimer > 0; if (shadowDodge) { if (Main.netMode != NetmodeID.MultiplayerClient) { if (!npc.dontTakeDamage) { npc.dontTakeDamage = true; npc.netUpdate = true; } shadowDodgeTimer--; } shadowDodgeCount += 1f; if (shadowDodgeCount > 30f) { shadowDodgeCount = 30f; } } else { if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.dontTakeDamage) { npc.dontTakeDamage = false; npc.netUpdate = true; } } npc.dontTakeDamage = false; shadowDodgeCount -= 1f; if (shadowDodgeCount < 0f) { shadowDodgeCount = 0f; } } } if (MinionType == 9 || MinionType == 14) //Regen { npc.ai[3]++; if (npc.ai[3] >= 100) { npc.life++; if (MinionType == 9) { npc.life++; } npc.ai[3] = 0; } } if (MinionType == 21) //Stardust Summon { npc.ai[3]++; if (npc.ai[3] > 400) { npc.ai[3] = 0; int Xint = Main.rand.Next(-400, 400); int Yint = Main.rand.Next(-400, 400); NPC.NewNPC((int)npc.Center.X + Xint, (int)npc.Center.Y + Yint, mod.NPCType("GreedMinion"), 0, Main.rand.Next(29)); for (int i = 0; i < 3; i++) { Dust.NewDust(new Vector2(Xint, Yint), 60, 60, 229, 0f, 0f, 0, Color.White, 1); } } } if (MinionType == 23) //Vortex Stealth { npc.ai[3]++; if (npc.ai[3] == 300) { npc.netUpdate = true; } if (npc.ai[3] > 300) { npc.alpha += 3; if (npc.alpha > 200) { npc.alpha = 200; } } if (npc.ai[3] > 460) { npc.ai[3] = 0; } } npc.rotation = 0; }
public override void AI() { Player player = Main.player[npc.target]; Vector2 targetPos; if (!npc.HasPlayerTarget) { npc.TargetClosest(); } int speed = 16; float interval = .025f; if (npc.life < npc.lifeMax / 2) { if (!Phase2) { npc.velocity *= .92f; PhaseTimer++; if (PhaseTimer == 120) { CombatText.NewText(npc.Hitbox, Color.Purple, "Target threat level underestimated. Engaging melee protocols.", true); } if (PhaseTimer >= 180) { Phase2 = true; internalAI[0] = 6; } return; } speed = 18; interval = .03f; music = mod.GetSoundSlot(Terraria.ModLoader.SoundType.Music, "Sounds/Music/Novacore2"); } if (npc.life < npc.lifeMax / 4) { Lighting.AddLight(npc.Center, Warning.R / 150, Warning.G / 150, Warning.B / 150); if (!WarningText) { CombatText.NewText(npc.Hitbox, Color.Red, "ERROR. DRASTIC PHYSICAL DAMAGE TO CHASSIS! ASTRAL ENERGY LEAKS IMMINENT!", true); WarningText = true; } music = mod.GetSoundSlot(Terraria.ModLoader.SoundType.Music, "Sounds/Music/Pinch"); speed = 20; interval = .03f; if (Main.rand.Next(30) == 0) { Lightning(); } } else { Lighting.AddLight(npc.Center, Color.Purple.R / 150, Color.Purple.G / 150, Color.Purple.B / 150); } if (!MeleeMode) { BaseAI.AISkull(npc, ref npc.ai, true, speed, 280, interval, .05f); } OrbitterDist += 2f; if (OrbitterDist > 300) { OrbitterDist = 300; } CWorld.NovacoreCounter = npc.ai[2]; if (MeleeMode) { internalAI[3]++; switch (internalAI[1]) { #region Diagonal Dashes case 0: if (!AliveCheck(player)) { break; } targetPos = player.Center; targetPos.X += 430 * (npc.Center.X < targetPos.X ? -1 : 1); targetPos.Y -= 430; Movement(targetPos, .7f); if (internalAI[3] > 180 || Math.Abs(npc.Center.Y - targetPos.Y) < 100) //initiate dash { internalAI[1]++; internalAI[3] = 0; npc.netUpdate = true; npc.velocity = npc.DirectionTo(player.Center) * 45; } break; case 1: //dashing if (npc.Center.Y > player.Center.Y + 500 || Math.Abs(npc.Center.X - player.Center.X) > 1000) { npc.velocity.Y *= 0.5f; internalAI[3] = 0; if (++internalAI[2] >= Repeats() - 1) //repeat three times { internalAI[1] = 0; internalAI[2] = 0; internalAI[3] = 0; MeleeMode = false; } else { internalAI[1]--; } npc.netUpdate = true; } break; #endregion #region Horizontal Dash case 2: //prepare for queen bee dashes if (!AliveCheck(player)) { break; } if (internalAI[3] > 60) { targetPos = player.Center; targetPos.X += 400 * (npc.Center.X < targetPos.X ? -1 : 1); Movement(targetPos, 1f); if (internalAI[3] > 180 || Math.Abs(npc.Center.Y - targetPos.Y) < 40) //initiate dash { internalAI[1]++; internalAI[3] = 0; npc.netUpdate = true; npc.velocity.X = -40 * (npc.Center.X < player.Center.X ? -1 : 1); npc.velocity.Y *= 0.1f; } } else { npc.velocity *= 0.9f; //decelerate briefly } break; case 3: if (internalAI[3] > 240 || (Math.Sign(npc.velocity.X) > 0 ? npc.Center.X > player.Center.X + 900 : npc.Center.X < player.Center.X - 900)) { internalAI[3] = 0; if (++internalAI[2] >= Repeats()) //repeat dash three times { internalAI[1] = 0; internalAI[2] = 0; internalAI[3] = 0; MeleeMode = false; } else { internalAI[1]--; } npc.netUpdate = true; } break; default: internalAI[1] = 0; goto case 0; #endregion } } else { if (npc.ai[2]++ > AIRate) { if (internalAI[0] != 5) { if (npc.velocity.X >= 0) { npc.rotation += .06f; npc.spriteDirection = 1; } else if (npc.velocity.X < 0) { npc.rotation -= .06f; npc.spriteDirection = -1; } } else { npc.rotation += .03f; } switch (internalAI[0]) { case 0: case 1: case 2: #region Lightning case 3: if (!AliveCheck(Main.player[npc.target])) { break; } if (npc.localAI[0] == 0f) { npc.localAI[0] = 1f; int num833 = Player.FindClosest(npc.Center, 0, 0); Vector2 vector62 = Main.player[num833].Center - npc.Center; if (vector62 == Vector2.Zero) { vector62 = Vector2.UnitY; } closestPlayer = vector62.ToRotation(); npc.netUpdate = true; } if (npc.ai[2] % 45 == 0) { Main.PlaySound(SoundID.Item8, npc.position); Vector2 vector71 = closestPlayer.ToRotationVector2(); Vector2 value56 = vector71.RotatedBy(1.5707963705062866) * (Main.rand.Next(2) == 0).ToDirectionInt() * Main.rand.Next(10, 21); vector71 *= Main.rand.Next(-80, 81); Vector2 velocity3 = (vector71 - value56) / 10f; Dust dust25 = Main.dust[Dust.NewDust(npc.Center, 0, 0, ModContent.DustType <Dusts.CDust>())]; dust25.noGravity = true; dust25.position = npc.Center + value56; dust25.velocity = velocity3; dust25.scale = 0.5f + Main.rand.NextFloat(); dust25.fadeIn = 0.5f; if (Main.netMode != NetmodeID.MultiplayerClient) { for (int a = 0; a < Repeats() + 1; a++) { Vector2 vector72 = closestPlayer.ToRotationVector2() * 8f; float ai2 = Main.rand.Next(80); Projectile.NewProjectile(npc.Center.X - vector72.X, npc.Center.Y - vector72.Y, vector72.X, vector72.Y, ModContent.ProjectileType <Novashock>(), 15, 1f, Main.myPlayer, closestPlayer, ai2); } } npc.localAI[0] = 0; } if (npc.ai[2] > AIRate + 140 && Main.netMode != NetmodeID.MultiplayerClient) { AIChange(); } break; #endregion #region Turrets case 4: if (!AliveCheck(Main.player[npc.target])) { break; } if (!AnyOrbitters) { OrbitterDist = 0; for (int m = 0; m < TurretCount(); m++) { int projectileID = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <NovaTurretProj>(), npc.damage, 4, Main.myPlayer); Main.projectile[projectileID].Center = npc.Center; Main.projectile[projectileID].velocity = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble())); Main.projectile[projectileID].velocity *= 8f; Main.projectile[projectileID].ai[0] = m; } } AIChange(); break; #endregion #region Lasers case 5: //Nova Beams if (!AliveCheck(Main.player[npc.target])) { break; } npc.velocity *= .94f; LaserAttack(); if (!CUtils.AnyProjectiles(ModContent.ProjectileType <NovaBeam>()) || !CUtils.AnyProjectiles(ModContent.ProjectileType <NovaBeamSmall>()) && !LaserShot) { AIChange(); } break; #endregion } } else { if (npc.velocity.X > 0) { npc.rotation += .03f; } else if (npc.velocity.X < 0) { npc.rotation -= .03f; } if (npc.life < npc.lifeMax / 2) { if (Shoot > 30) { if (Shoot % 10 == 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 spinningpoint2 = 0 * Vector2.UnitX; spinningpoint2 = spinningpoint2.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331); spinningpoint2 *= 8f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, spinningpoint2.X, spinningpoint2.Y, ModContent.ProjectileType <NovaRocket>(), npc.damage / 3, 0f, Main.myPlayer, 0f, 20f); if (Shoot > 60) { Shoot = 0; npc.netUpdate = true; } } Main.PlaySound(SoundID.Item39, npc.Center); } } } } } }