public override void AI() { BaseAI.AIElemental(npc, ref npc.ai, null, 120, false, true, 800, 400, 180, 2); if (npc.ai[0] == 2f) { npc.alpha += 12; if (npc.alpha > 255) { npc.alpha = 255; } } else { npc.alpha -= 12; if (npc.alpha < 0) { npc.alpha = 0; } } npc.rotation = npc.velocity.X / 15f; npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 36; if (npc.frame.Y > (36 * 3)) { npc.frameCounter = 0; npc.frame.Y = 0; } } }
public override void AI() { BaseAI.AIElemental(npc, ref npc.ai, null, 1, false, false, 800f, 600f, 180, 3f); if (npc.velocity.X > 0) { Rotation += .03f; } else if (npc.velocity.X < 0) { Rotation -= .03f; } }
public override void AI() { npc.noGravity = true; npc.TargetClosest(true); Player player = Main.player[npc.target]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.Center.X > npc.Center.X) { npc.direction = -1; } else { npc.direction = 1; } if (internalAI[0] == 0) { if (Main.netMode != 1) { for (int m = 0; m < ProbeCount; m++) { int npcID = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SagittariusOrbiter"), 0); Main.npc[npcID].Center = npc.Center; Main.npc[npcID].velocity = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble())); Main.npc[npcID].velocity *= 8f; Main.npc[npcID].ai[0] = m; Main.npc[npcID].netUpdate2 = true; Main.npc[npcID].netUpdate = true; } } internalAI[0] = 1; } if (MovementType[0] == 0) { internalAI[6]++; MovementType[1] -= 5; if (MovementType[1] <= 0) { MovementType[1] = 0; } if (internalAI[6] > 200) { internalAI[6] = 0f; MovementType[0] = Main.rand.Next(3); npc.netUpdate = true; } } if (MovementType[0] == 1) { internalAI[6]++; if (internalAI[6] > 240) { internalAI[6] = 0; MovementType[0] = 5; npc.netUpdate = true; } } if (MovementType[0] == 2) { MovementType[1] += 5; if (MovementType[1] >= 255) { MovementType[0] = 3; npc.netUpdate = true; } } if (MovementType[0] == 3) { MovementType[1] -= 5; if (MovementType[1] <= 0) { MovementType[1] = 0; } internalAI[6]++; if (internalAI[6] > 360) { internalAI[6] = 0; MovementType[0] = 5; npc.netUpdate = true; } } else if (MovementType[0] == 4 || MovementType[0] == 5) { MovementType[1] += 5; if (MovementType[1] >= 255) { MovementType[0] = 0; npc.netUpdate = true; } } if (internalAI[4] < 60) { internalAI[4]++; } if (!NPC.AnyNPCs(ModContent.NPCType <SagittariusOrbiter>()) && internalAI[4] >= 60) { npc.Transform(ModContent.NPCType <SagittariusFree>()); } if (internalAI[3] == 1f) { npc.TargetClosest(true); npc.velocity *= .7f; npc.alpha += 5; if (npc.alpha >= 255) { npc.active = false; } if (!Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) <= 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) >= 6000f) { npc.TargetClosest(true); } return; } else { npc.TargetClosest(true); if (npc.alpha > 0) { npc.alpha -= 10; } if (npc.alpha <= 0) { npc.alpha = 0; } } if (Main.player[npc.target].dead) { npc.TargetClosest(true); if (Main.player[npc.target].dead) { if (internalAI[3] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Sagittarius1"), Color.PaleVioletRed); } internalAI[3] = 1f; } } } else if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f || !modPlayer.ZoneVoid) { npc.TargetClosest(true); if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f) { if (internalAI[3] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Sagittarius2"), Color.PaleVioletRed); } internalAI[3] = 1f; } } } npc.ai[1]++; if (npc.ai[1] >= 300) { internalAI[1] = 0; internalAI[2] = Main.rand.Next(3); npc.ai = new float[4]; npc.netUpdate = true; } if (internalAI[2] == 1) //Chaase down the target { BaseAI.AIElemental(npc, ref npc.ai, null, 120, false, false, 10, 10, 10, 2.5f); } else //Hover over target { BaseAI.AISpaceOctopus(npc, ref npc.ai, Main.player[npc.target].Center, 0.3f, 10f, 250f, 70f, null); } npc.rotation = 0; npc.noTileCollide = true; }
public override void AI() { if (testime > 0) { testime--; } if (Main.netMode != 2) { int ThreeQuartersHealth = npc.lifeMax * (int).75f; int HalfHealth = npc.lifeMax * (int).5f; int QuarterHealth = npc.lifeMax * (int).25f; if (roarTimer > -1) { roarTimer--; } if (npc.life <= ThreeQuartersHealth && !roared[0]) { roared[0] = true; roarTimer = 200; } if (npc.life <= HalfHealth && !roared[1]) { roared[1] = true; roarTimer = 200; } if (npc.life <= QuarterHealth && !roared[2]) { roared[2] = true; roarTimer = 200; } if (roarTimer == 180) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Sounds/IZRoar"), npc.Center); } } float movementMax = 1.5f; if (npc.target > -1) { Player targetPlayer = Main.player[npc.target]; if (!targetPlayer.dead) //speed changes depending on how far the player is { /*if (targetPlayer.Center.Y <= npc.Top.Y - 400f && !Scanning) * { * Projectile.NewProjectile(npc.position, npc.velocity, mod.ProjectileType<Scanner>(), 0, 0f, targetPlayer.whoAmI, npc.whoAmI); * Scanning = true; * } * else * { * Scanning = false; * }*/ npc.alpha -= 10; if (npc.alpha <= 0) { npc.alpha = 0; } movementMax = MathHelper.Lerp(1f, 4f, Math.Min(1f, Math.Max(0f, (Vector2.Distance(npc.Center, targetPlayer.Center) / 1000f)))); } if (targetPlayer.dead) //speed changes depending on how far the player is { npc.alpha += 10; if (npc.alpha >= 255) { npc.active = false; } } } //customAI is used here because the original ai and localAI are both used elsewhere. It is synced above. BaseAI.AIElemental(npc, ref customAI, false, 0, false, false, 800f, 600f, 60, movementMax); if (!ZerosSpawned) { if (Main.netMode != 1) { int latestNPC = npc.whoAmI; int handType = 0; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand1"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; handType++; Zero1 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand1"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; handType++; Zero2 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand1"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; handType++; Zero3 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand2"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; handType++; Zero4 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand2"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; handType++; Zero5 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 100, mod.NPCType("IZHand2"), 0, npc.whoAmI); Main.npc[latestNPC].ai[0] = npc.whoAmI; Main.npc[latestNPC].ai[1] = handType; Zero6 = Main.npc[latestNPC]; } ZerosSpawned = true; } if (testime == 0 && (Zero1 == null || Zero2 == null || Zero3 == null || Zero4 == null || Zero5 == null || Zero6 == null || !Zero1.active || !Zero2.active || !Zero3.active || !Zero4.active || !Zero5.active || !Zero6.active)) { Reseting = true; testime = 60; } if ((Zero1 == null || !Zero1.active) && (Zero2 == null || !Zero2.active) && (Zero3 == null || !Zero3.active) && (Zero4 == null || !Zero4.active) && (Zero5 == null || !Zero5.active) && (Zero6 == null || !Zero6.active)) { ZerosSpawned = false; } 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() { if (internalAI[1] == AISTATE_TURRET) { if (!HeadsSpawned) { if (Main.netMode != 1) { int latestNPC = npc.whoAmI; latestNPC = NPC.NewNPC((int)npc.Center.X - 34, (int)npc.Center.Y - 23, mod.NPCType("OrthrusHead2"), 0, npc.whoAmI); Main.npc[latestNPC].realLife = npc.whoAmI; Main.npc[latestNPC].ai[0] = npc.whoAmI; Head1 = Main.npc[latestNPC]; latestNPC = NPC.NewNPC((int)npc.Center.X + 34, (int)npc.Center.Y - 23, mod.NPCType("OrthrusHead1"), 0, npc.whoAmI); Main.npc[latestNPC].realLife = npc.whoAmI; Main.npc[latestNPC].ai[0] = npc.whoAmI; Head2 = Main.npc[latestNPC]; } HeadsSpawned = true; } npc.noTileCollide = true; npc.noGravity = true; if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f || npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) { } else { internalAI[1] = AISTATE_RISE; } } if (internalAI[1] == AISTATE_FLY) { HeadsSpawned = false; npc.noTileCollide = true; npc.noGravity = true; if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f || npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) { BaseAI.AIElemental(npc, ref npc.ai, false, 0, false, false, 800f, 100f, 60, 1.5f); } else { internalAI[1] = AISTATE_DROP; } } npc.frameCounter++; if (internalAI[1] == AISTATE_TURRET) //Standing { if (npc.frameCounter >= 5) { npc.frameCounter = 0; npc.frame.Y += 102; if (npc.frame.Y > (102 * 3)) { npc.frameCounter = 0; npc.frame.Y = 0; } } } if (internalAI[1] == AISTATE_FLY) //Following { if (npc.frameCounter >= 5) { npc.frameCounter = 0; npc.frame.Y += 102; if (npc.frame.Y > (102 * 7) || npc.frame.Y < (102 * 3)) { npc.frameCounter = 0; npc.frame.Y = 102 * 4; } } npc.noGravity = true; } if (internalAI[1] == AISTATE_RISE) //Rising { npc.frameCounter++; if (npc.frameCounter < 5) { npc.frame.Y = 102 * 11; } if (npc.frameCounter < 10) { npc.frame.Y = 102 * 10; } if (npc.frameCounter < 15) { npc.frame.Y = 102 * 9; } if (npc.frameCounter < 20) { npc.frame.Y = 102 * 8; } if (npc.frameCounter < 25) { internalAI[1] = AISTATE_FLY; } } if (internalAI[1] == AISTATE_DROP) //Dropping { npc.noGravity = false; if (npc.frameCounter < 5) { npc.frame.Y = 102 * 8; } if (npc.frameCounter < 10) { npc.frame.Y = 102 * 9; } if (npc.frameCounter < 15) { npc.frame.Y = 102 * 10; } if (npc.frameCounter < 20) { npc.frame.Y = 102 * 11; } if (npc.frameCounter < 25) { internalAI[1] = AISTATE_TURRET; } } }
public override void AI() { BaseAI.AIElemental(npc, ref npc.ai, ref IdleTimer, null, 1, false, true, 800f, 600f, 180, 2f); }