public override void AI() { BaseAI.AIFlier(npc, ref npc.ai, false, 0.2f, 0.1f, 3, 2.5f, true, 250); npc.rotation = npc.velocity.X * 0.05f; if (npc.velocity.X > 0) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } if (Collision.SolidCollision(new Vector2(npc.Center.X, npc.Center.Y), npc.width, npc.height)) { if (npc.alpha < 100) { npc.alpha += 2; } } else { if (npc.alpha > 0) { npc.alpha -= 3; } } }
public override void AI() { 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, ModContent.DustType <AbyssDust>(), 0f, 0f, 100); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = false; } } npc.alpha -= 3; if (npc.alpha < 0) { npc.alpha = 0; } BaseAI.AIFlier(npc, ref npc.ai, true, 0.15f, 0.08f, 6f, 5f, false, 300); Player player = Main.player[npc.target]; if (player.Center.X > npc.Center.X) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } }
public override void AI() { BaseAI.AIFlier(npc, ref npc.ai, true, 0.8f, 0.04f, 8f, 7f, false, 300); Player player = Main.player[npc.target]; if (player.Center.X > npc.Center.X) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 96; if (npc.frame.Y > (96 * 3)) { npc.frameCounter = 0; npc.frame.Y = 0; } } }
public override void AI() { if (Friendly) { FriendlyAI(); Rectangle rectangle = new Rectangle((int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, Main.player[npc.target].width, Main.player[npc.target].height); Rectangle rectangle2 = new Rectangle((int)npc.position.X - 100, (int)npc.position.Y - 100, npc.width + 600, npc.height + 600); if (rectangle2.Intersects(rectangle) || npc.life < npc.lifeMax) { npc.TargetClosest(true); npc.ai[0] = 0; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.localAI[0] = 0; npc.localAI[1] = 0; npc.localAI[2] = 0; npc.localAI[3] = 0; Friendly = false; npc.netUpdate = true; } } else { BaseAI.AIFlier(npc, ref npc.ai, true, 0.15f, 0.08f, 8f, 7f, false, 300); if (npc.alpha > 0) { npc.alpha -= 4; } else { npc.alpha = 0; } Player player = Main.player[npc.target]; if (npc.ai[3]++ > 30 && Main.netMode != 1) { int projType = ModContent.ProjectileType <SeraphFeather>(); float spread = 30f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - npc.Center); dir *= 14f; 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; for (int i = 0; i < 3; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, npc.damage / 4, 2, Main.myPlayer); } npc.ai[3] = 0; npc.netUpdate = true; } npc.spriteDirection = npc.direction; npc.rotation = npc.velocity.X * 0.05f; } }
public override void AI() { BaseAI.AIFlier(npc, ref npc.ai, false, 0.2f, 0.1f, 3, 2.5f, true, 250); npc.rotation = npc.velocity.X * 0.05f; if (npc.velocity.X > 0) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } }
public override void AI() { BaseAI.AIFlier(npc, ref npc.ai, true, 0.15f, 0.08f, 8f, 7f, true, 300); npc.spriteDirection = npc.direction; npc.rotation = npc.velocity.X * 0.05f; 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() { 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.AIFlier(npc, ref npc.ai, false, 0.3f, 0.2f, 6f, 4.5f, false, 250); if (player.Center.X < npc.Center.X) { npc.direction = npc.spriteDirection = -1; } else { npc.direction = npc.spriteDirection = 1; } }
public override void AI() { 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, ModContent.DustType <Dusts.DiscordLight>(), 0f, 0f, 100); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = false; } } npc.alpha -= 3; if (npc.alpha < 0) { npc.alpha = 0; } BaseAI.AIFlier(npc, ref npc.ai, true, 0.4f, 0.04f, 6f, 1.5f, true, 300); Player player = Main.player[npc.target]; if (player.Center.X > npc.Center.X) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 96; if (npc.frame.Y > (96 * 3)) { npc.frameCounter = 0; npc.frame.Y = 0; } } }
public int movementVariance = 60; //how far from the center point to move. public override void AI() { npc.defDamage = isAwakened ? 200 : 180; if (Body == null) { NPC npcBody = Main.npc[(int)npc.ai[0]]; if (npcBody.type == mod.NPCType("Yamata") || npcBody.type == mod.NPCType("YamataA")) { Body = (Yamata)npcBody.modNPC; } } if (Body == null) { return; } npc.alpha = Body.npc.alpha; if (npc.alpha > 0) { npc.damage = 0; } else { npc.damage = npc.defDamage; } npc.TargetClosest(); Player targetPlayer = Main.player[npc.target]; if (targetPlayer == null || !targetPlayer.active || targetPlayer.dead) { targetPlayer = null; //deliberately set to null } float playerDistance = targetPlayer == null ? 99999f : Vector2.Distance(targetPlayer.Center, npc.Center); if (!Body.npc.active) { if (Main.netMode != NetmodeID.MultiplayerClient) //force a kill to prevent 'ghost hands' { npc.life = 0; npc.checkDead(); npc.netUpdate = true; killedbyplayer = false; } return; } Vector2 nextTarget = Body.npc.Center + new Vector2(leftHead ? -distFromBodyX : distFromBodyX, -distFromBodyY) + new Vector2(npc.ai[2], npc.ai[3]); float dist = Vector2.Distance(nextTarget, npc.Center); if (YamataHead.EATTHELITTLEMAGGOT && playerDistance < 300f) { BaseAI.AIFlier(npc, ref customAI, true, .5f, .8f, 5, 5, false, 300); } else if (dist < 40f) { npc.velocity *= 0.9f; if (Math.Abs(npc.velocity.X) < 0.05f) { npc.velocity.X = 0f; } if (Math.Abs(npc.velocity.Y) < 0.05f) { npc.velocity.Y = 0f; } } else { npc.velocity = Vector2.Normalize(nextTarget - npc.Center); npc.velocity *= 20f; } npc.position += Body.npc.position - Body.npc.oldPosition; npc.spriteDirection = -1; if (Body.TeleportMe1) { Body.TeleportMe1 = false; npc.Center = Body.npc.Center; return; } if (Body.TeleportMe2) { Body.TeleportMe2 = false; npc.Center = Body.npc.Center; return; } if (Body.TeleportMe3) { Body.TeleportMe3 = false; npc.Center = Body.npc.Center; for (int i = 0; i < 5; ++i) { Main.PlaySound(SoundID.Item, (int)npc.Center.X, (int)npc.Center.Y, 20); Vector2 dir = Vector2.Normalize(targetPlayer.Center - npc.Center); dir *= 5f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, dir.X, dir.Y, isAwakened ? mod.ProjectileType("YamataABreath") : mod.ProjectileType("YamataBreath"), npc.damage / 4, 0f, Main.myPlayer); } return; } if (Body.TeleportMe4) { Body.TeleportMe4 = false; npc.Center = Body.npc.Center; return; } if (Body.TeleportMe5) { Body.TeleportMe5 = false; npc.Center = Body.npc.Center; return; } if (Body.TeleportMe6) { Body.TeleportMe6 = false; npc.Center = Body.npc.Center; return; } if (Main.netMode != NetmodeID.MultiplayerClient && !YamataHead.EATTHELITTLEMAGGOT) { if (npc.alpha <= 0) { npc.ai[1]++;; } int aiTimerFire = npc.whoAmI % 3 == 0 ? 50 : npc.whoAmI % 2 == 0 ? 150 : 100; if (leftHead) { aiTimerFire += 30; } if (targetPlayer != null && npc.ai[1] == aiTimerFire) { fireAttack = true; for (int i = 0; i < 5; ++i) { Main.PlaySound(SoundID.Item, (int)npc.Center.X, (int)npc.Center.Y, 20); Vector2 dir = Vector2.Normalize(targetPlayer.Center - npc.Center); dir *= 5f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, dir.X, dir.Y, isAwakened ? mod.ProjectileType("YamataABreath") : mod.ProjectileType("YamataBreath"), npc.damage / 4, 0f, Main.myPlayer); } } else if (npc.ai[1] >= 200) //pick random spot to move head to { fireAttack = false; npc.ai[1] = 0; npc.ai[2] = Main.rand.Next(-movementVariance, movementVariance); npc.ai[3] = Main.rand.Next(-movementVariance, movementVariance); npc.netUpdate = true; } } }
public override void AI() { if (!npc.HasPlayerTarget) { npc.TargetClosest(); } Player player = Main.player[npc.target]; BaseAI.AIFlier(npc, ref npc.ai, true, 0.15f, 0.08f, 8f, 7f, false, 300); if (npc.alpha > 0) { npc.alpha -= 4; } else { npc.alpha = 0; } if (npc.ai[3]++ > 30 && Main.netMode != 1) { int projType = ModContent.ProjectileType <SeraphFeather>(); float spread = 30f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - npc.Center); dir *= 14f; 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; for (int i = 0; i < 3; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, npc.damage / 4, 2, Main.myPlayer); } npc.ai[3] = 0; npc.netUpdate = true; } if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis || player.dead) { npc.TargetClosest(); if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis || player.dead) { if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis) { CombatText.NewText(npc.Hitbox, Color.CadetBlue, SeraphBitching(), true); } else if (player.dead) { CombatText.NewText(npc.Hitbox, Color.CadetBlue, SeraphBitchingKill(), true); } for (int a = 0; a < 8; a++) { Dust.NewDust(npc.Center, 60, 40, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0); } BaseAI.KillNPC(npc); } } npc.spriteDirection = npc.direction; npc.rotation = npc.velocity.X * 0.05f; }
public override void AI() { if (Main.expertMode) { damage = npc.damage / 4; } else { damage = npc.damage / 2; } Player player = Main.player[npc.target]; if (runonce == 0) { StartSandstorm(); runonce += 1; } if (internalAI[0] == 2 && npc.ai[3] < 60) { npc.velocity.X *= 0.97f; } if (internalAI[0] == 2 && npc.ai[3] > 120) { if (npc.velocity.X > 0) { npc.direction = 1; } else { npc.direction = -1; } } else { if (player.Center.X > npc.Center.X) { npc.direction = 1; } else { npc.direction = -1; } } if (player.dead || !player.active) { npc.TargetClosest(true); if (player.dead || !player.active) { FuriousFlexing(); return; } } else if (!player.ZoneDesert) { if (!soundPlayed) { soundPlayed = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); } npc.damage = 200; npc.defense = 1000; npc.ai[3]++; BaseAI.AIFlier(npc, ref npc.ai, true, 0.3f, 0.3f, 16f, 16f, false, 300); if (npc.localAI[0]++ > 50) { npc.localAI[0] = 0; Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-200, 200), npc.Center.Y + Main.rand.Next(-100, 100), 0, 0, ModContent.ProjectileType <Menacing>(), 0, 0, Main.myPlayer); } return; } else { soundPlayed = false; npc.defense = 15; Sandstorm.TimeLeft = 10; if (npc.alpha <= 0) { npc.alpha = 0; } else { npc.alpha -= 2; } } if (Main.netMode != 1) { npc.damage = 30; internalAI[1]++; if (internalAI[1] >= 300) { selectPoint = true;; internalAI[0] = Main.rand.Next(3); internalAI[1] = 0; npc.ai[3] = 0; npc.ai = new float[4]; npc.netUpdate = true; } } if (internalAI[0] == 0) { npc.damage = 30; npc.ai[3]++; npc.velocity.X = 0; npc.velocity.Y = 0; if (npc.ai[3] == 9 || npc.ai[3] == 36 || npc.ai[3] == 72) { if (Main.netMode != 1 && AAGlobalProjectile.CountProjectiles(658) < 5) { FireProjectile(); npc.netUpdate = true; } } if (npc.ai[3] > 90 && Main.netMode != 1) { internalAI[0] = 10; internalAI[1] = 0; npc.ai = new float[4]; npc.ai[3] = 0; npc.netUpdate = true; } } else if (internalAI[0] == 1) { npc.damage = 60; npc.ai[3]++; BaseAI.AIFlier(npc, ref npc.ai, true, 0.1f, 0.1f, 6f, 6f, false, 300); npc.damage = 40; if (npc.ai[3] > 200 && Main.netMode != 1) { internalAI[0] = 10; internalAI[1] = 0; npc.ai = new float[4]; npc.ai[3] = 0; npc.netUpdate = true; } } else if (internalAI[0] == 2) { npc.ai[3]++; npc.damage = 50; if (npc.ai[3] < 120 && npc.ai[3] > 60) { if (Main.netMode != 1) { if (selectPoint) { float point = 700 * npc.direction; MovePoint = player.Center + new Vector2(point, 0); MoveToPoint(MovePoint, 10f); selectPoint = false; npc.netUpdate = true; } npc.damage = 20; npc.netUpdate = true; } } else { if (Main.netMode != 1) { if (npc.ai[3] == 120) { //float point = 500 * npc.direction; MovePoint = new Vector2(player.Center.X, npc.position.Y); MoveToPoint(MovePoint, 10f); npc.netUpdate = true; } npc.damage = 40; npc.netUpdate = true; } } if (npc.ai[3] > 160 && Main.netMode != 1) { npc.damage = 30; internalAI[0] = 10; internalAI[1] = 0; npc.ai = new float[4]; npc.ai[3] = 0; npc.netUpdate = true; } } else { npc.damage = 30; BaseAI.AIFlier(npc, ref npc.ai, true, 0.1f, 0.04f, 4f, 2f, false, 300); } }
public override void AI() { if (Main.expertMode) { damage = npc.damage / 4; } else { damage = npc.damage / 2; } Player player = Main.player[npc.target]; if ((Main.dayTime && player.position.Y < Main.worldSurface) || !player.ZoneGlowshroom) { npc.velocity *= 0; if (npc.velocity.X <= .1f && npc.velocity.X >= -.1f) { npc.velocity.X = 0; } if (npc.velocity.Y <= .1f && npc.velocity.Y >= -.1f) { npc.velocity.Y = 0; } npc.alpha += 10; if (npc.alpha >= 255) { npc.active = false; } return; } npc.alpha -= 10; if (npc.alpha < 0) { npc.alpha = 0; } npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 90; if (npc.frame.Y > (90 * 7)) { npc.frameCounter = 0; npc.frame.Y = 0; } } npc.noTileCollide = true; if (Main.netMode != NetmodeID.MultiplayerClient && internalAI[1] != AISTATE_SHOOT) { internalAI[0]++; if (internalAI[0] >= 180) { internalAI[0] = 0; internalAI[1] = Main.rand.Next(3); npc.ai = new float[4]; npc.netUpdate = true; } } if (internalAI[1] == AISTATE_HOVER) { BaseAI.AISpaceOctopus(npc, ref npc.ai, player.Center, 0.15f, 4f, 170, 56f, FireMagic); } else if (internalAI[1] == AISTATE_FLIER) { BaseAI.AIFlier(npc, ref npc.ai, true, 0.1f, 0.04f, 5f, 3f, false, 1); } else if (internalAI[1] == AISTATE_SHOOT) { BaseAI.AISpaceOctopus(npc, ref npc.ai, player.Center, 0.15f, 4f, 170, 56f, null); if (Main.netMode != NetmodeID.MultiplayerClient) { internalAI[0]++; } if (internalAI[0] >= 60) { int attack = Main.rand.Next(4); internalAI[1] = Main.rand.Next(3); internalAI[0] = 0; FungusAttack(attack); npc.netUpdate = true; } } npc.rotation = 0; if (internalAI[4]++ > 20 && Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) { internalAI[4] = 0; Vector2 pos = new Vector2(player.Center.X + Main.rand.Next(70, 150) * (Main.rand.Next(2) == 0? 1: -1), player.Center.Y + Main.rand.Next(70, 150) * (Main.rand.Next(2) == 0? 1: -1)); Vector2 velocity = Vector2.Normalize(player.Center - pos) * .1f; int proj = Projectile.NewProjectile(pos.X, pos.Y, velocity.X, velocity.Y, mod.ProjectileType("FungusCloud"), damage, 0, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 720; Main.projectile[proj].alpha = 255; } }
public override void AI() { if (Main.expertMode) { damage = npc.damage / 4; } else { damage = npc.damage / 2; } Player player = Main.player[npc.target]; if ((Main.dayTime && player.position.Y < Main.worldSurface) || !player.ZoneGlowshroom) { npc.velocity *= 0; if (npc.velocity.X <= .1f && npc.velocity.X >= -.1f) { npc.velocity.X = 0; } if (npc.velocity.Y <= .1f && npc.velocity.Y >= -.1f) { npc.velocity.Y = 0; } npc.alpha += 10; if (npc.alpha >= 255) { npc.active = false; } return; } npc.alpha -= 10; if (npc.alpha < 0) { npc.alpha = 0; } npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 90; if (npc.frame.Y > (90 * 7)) { npc.frameCounter = 0; npc.frame.Y = 0; } } npc.noTileCollide = true; if (Main.netMode != 1 && internalAI[1] != AISTATE_SHOOT) { internalAI[0]++; if (internalAI[0] >= 180) { internalAI[0] = 0; internalAI[1] = Main.rand.Next(3); npc.ai = new float[4]; npc.netUpdate = true; } } if (internalAI[1] == AISTATE_HOVER) { BaseAI.AISpaceOctopus(npc, ref npc.ai, player.Center, 0.15f, 4f, 170, 56f, FireMagic); } else if (internalAI[1] == AISTATE_FLIER) { BaseAI.AIFlier(npc, ref npc.ai, true, 0.1f, 0.04f, 5f, 3f, false, 1); } else if (internalAI[1] == AISTATE_SHOOT) { BaseAI.AISpaceOctopus(npc, ref npc.ai, player.Center, 0.15f, 4f, 170, 56f, null); if (Main.netMode != 1) { internalAI[0]++; } if (internalAI[0] >= 60) { int attack = Main.rand.Next(4); internalAI[1] = Main.rand.Next(3); internalAI[0] = 0; FungusAttack(attack); npc.netUpdate = true; } } npc.rotation = 0; }