public override void AI() { AAAI.AIClaw(npc, ref npc.ai, true, false, 0.1f, 0.04f, 3f, 1.5f, 1f, 1f); if (npc.velocity.X > 0f) { npc.spriteDirection = 1; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); } if (npc.velocity.X < 0f) { npc.spriteDirection = -1; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 3.14f; } npc.frameCounter++; if (npc.frameCounter >= 8) { npc.frameCounter = 0; npc.frame.Y += 26; if (npc.frame.Y > (26 * 4)) { npc.frameCounter = 0; npc.frame.Y = 0; } } }
public override void AI() { if (!NPC.AnyNPCs(ModContent.NPCType <GripOfChaosRed>()) && !NPC.AnyNPCs(ModContent.NPCType <GripOfChaosBlue>())) { npc.alpha += 10; if (npc.alpha > 255) { npc.active = false; } } AAAI.AIClaw(npc, ref npc.ai, true, false, 0.1f, 0.04f, 4f, 1.5f, 1f, 1f); }
public override void AI() { if (!NPC.AnyNPCs(mod.NPCType("GripOfChaosRed")) && !NPC.AnyNPCs(mod.NPCType("GripOfChaosBlue"))) { npc.alpha += 10; if (npc.alpha > 255) { npc.active = false; } } AAAI.AIClaw(npc, ref npc.ai, false, true, 0.1f, 0.04f, 5.5f, 2.5f, 1f, 1f); }
public override void AI() { Lighting.AddLight(npc.Center, AAColor.YamataA.R / 255, AAColor.YamataA.G / 255, AAColor.YamataA.B / 255); AAAI.AIShadowflameGhost(npc, ref npc.ai, false, 660f, 0.3f, 15f, 0.2f, 8f, 5f, 10f, 0.4f, 0.4f, 0.95f, 5f); if (!NPC.AnyNPCs(ModContent.NPCType <YamataA>())) { npc.life = 0; } 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, mod.DustType("YamataAuraDust"), 0f, 0f, 100, default, 2f);
public override void AI() { if (internalAI[3] > 0 || (AAGlobalProjectile.AnyProjectiles(mod.ProjectileType("ShenWaveDeathray")) || AAGlobalProjectile.AnyProjectiles(mod.ProjectileType("ShenWaveDeathraySmall")))) { npc.TargetClosest(false); npc.rotation = 0; npc.velocity *= .2f; NPC shen = Main.npc[(int)internalAI[0]]; int shotdirection = npc.spriteDirection = npc.direction; if (internalAI[4] == 0) { npc.spriteDirection = npc.direction = shen.spriteDirection; shotdirection = npc.direction; npc.Center = new Vector2(shen.Center.X + internalAI[1] * shotdirection, shen.Center.Y + internalAI[2]); } if (shen.ai[0] == 0 && shen.ai[2] == 360 && Main.netMode != NetmodeID.MultiplayerClient) { float ai0 = (float)Math.PI * 2 / 300 * (internalAI[3] == 2 ? 1 : -1) * Math.Sign(internalAI[2]); Projectile.NewProjectile(npc.Center + npc.direction * new Vector2(npc.width / 2, 0), Vector2.UnitX * shotdirection, mod.ProjectileType("ShenWaveDeathraySmall"), npc.damage, 0f, Main.myPlayer, ai0, npc.whoAmI); internalAI[4] = 1; npc.netUpdate = true; } if (shen.ai[0] == 14 && shen.ai[1] == internalAI[3] * 120 - 30) { internalAI[4] = 1; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.Center + npc.direction * new Vector2(npc.width / 2, 0), npc.DirectionTo(Main.player[shen.target].Center), mod.ProjectileType("ShenWaveDeathraySmall"), npc.damage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); } } if (shen.ai[0] != 0 && shen.ai[0] != 1 && shen.ai[0] != 13 && shen.ai[0] != 14) { internalAI[3] = 0; npc.netUpdate = true; } return; } internalAI[4] = 0; AI86(); Lighting.AddLight(npc.Center, AAColor.Shen3.R / 255, AAColor.Shen3.G / 255, AAColor.Shen3.B / 255); AAAI.AIShadowflameGhost(npc, ref npc.ai, false, 660f, 0.3f, 15f, 0.2f, 8f, 5f, 10f, 0.4f, 0.4f, 0.95f, 5f); if (!NPC.AnyNPCs(mod.NPCType("ShenA"))) { npc.life = 0; npc.active = false; } 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 <DiscordDust>(), 0f, 0f, 100, default, 2f);
public override void AI() { Player player = Main.player[npc.target]; AAAI.AIWorm(npc, new int[] { mod.NPCType("SnakeHead"), mod.NPCType("SnakeBody"), mod.NPCType("SnakeTail") }, 9, 8f, 12f, 0.1f, false, false); if (npc.velocity.X < 0f) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } }
public override void AI() { Lighting.AddLight(npc.Center, Color.DarkOrange.R / 255, Color.DarkOrange.G / 255, Color.DarkOrange.B / 255); AAAI.AIShadowflameGhost(npc, ref npc.ai, false, 660f, 0.3f, 10f, 0.2f, 6f, 5f, 10f, 0.4f, 0.4f, 0.95f, 5f); npc.spriteDirection = npc.velocity.X > 0 ? -1 : 1; BaseAI.LookAt(npc.Center + npc.velocity, npc, 0); npc.frameCounter++; if (npc.frameCounter > 3) { npc.frameCounter = 0; npc.frame.Y += 76; if (npc.frame.Y > 76 * 7) { npc.frame.Y = 0; } } float num1276 = 120f; if (npc.localAI[0] < num1276) { npc.localAI[0] += 1f; float num1279 = 1f - npc.localAI[0] / num1276; float num1280 = num1279 * 20f; int num1281 = 0; while (num1281 < num1280) { if (Main.rand.Next(5) == 0) { int num1282 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType <Dusts.DragonflameDust>(), 0f, 0f, 0); Main.dust[num1282].alpha = 100; Main.dust[num1282].velocity *= 0.3f; Main.dust[num1282].velocity += npc.velocity * 0.75f; Main.dust[num1282].noGravity = true; } num1281++; } } }
public override void AI() { AAAI.InfernoFighterAI(npc, ref npc.ai, true, true, 1, 0.07f, 1f, 3, 4, 60, true, 10, 60, true, null, false); }
public override bool PreAI() { Player player = Main.player[npc.target]; AAAI.DustOnNPCSpawn(npc, ModContent.DustType <AkumaADust>(), 2, 12); npc.spriteDirection = npc.velocity.X > 0 ? -1 : 1; npc.ai[1]++; if (npc.ai[1] >= 1200) { npc.ai[1] = 0; } npc.TargetClosest(true); if (!Main.player[npc.target].active || Main.player[npc.target].dead) { npc.TargetClosest(true); if (!Main.player[npc.target].active || Main.player[npc.target].dead) { npc.ai[3]++; npc.velocity.Y = npc.velocity.Y + 0.11f; if (npc.ai[3] >= 300) { npc.active = false; } } else { npc.ai[3] = 0; } } if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0) { npc.realLife = npc.whoAmI; int latestNPC = npc.whoAmI; for (int i = 0; i < 12; ++i) { latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("AwakenedLungBody"), npc.whoAmI, 0, latestNPC); Main.npc[latestNPC].realLife = npc.whoAmI; Main.npc[latestNPC].ai[3] = npc.whoAmI; } latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("AwakenedLungTail"), npc.whoAmI, 0, latestNPC); Main.npc[latestNPC].realLife = npc.whoAmI; Main.npc[latestNPC].ai[3] = npc.whoAmI; npc.ai[0] = 1; npc.netUpdate = true; } } int minTilePosX = (int)(npc.position.X / 16.0) - 1; int maxTilePosX = (int)((npc.position.X + npc.width) / 16.0) + 2; int minTilePosY = (int)(npc.position.Y / 16.0) - 1; int maxTilePosY = (int)((npc.position.Y + npc.height) / 16.0) + 2; if (minTilePosX < 0) { minTilePosX = 0; } if (maxTilePosX > Main.maxTilesX) { maxTilePosX = Main.maxTilesX; } if (minTilePosY < 0) { minTilePosY = 0; } if (maxTilePosY > Main.maxTilesY) { maxTilePosY = Main.maxTilesY; } bool collision = true; float speed = 16; float acceleration = 0.15f; Vector2 npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float targetXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); float targetYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); float targetRoundedPosX = (int)(targetXPos / 16.0) * 16; float targetRoundedPosY = (int)(targetYPos / 16.0) * 16; npcCenter.X = (int)(npcCenter.X / 16.0) * 16; npcCenter.Y = (int)(npcCenter.Y / 16.0) * 16; float dirX = targetRoundedPosX - npcCenter.X; float dirY = targetRoundedPosY - npcCenter.Y; Vector2 vector132 = player.Center - npc.Center; (vector132.X > 0f).ToDirectionInt(); (vector132.Y > 0f).ToDirectionInt(); if (vector132.Length() < 500f && vector132.Length() >= 100f && npc.velocity.X / vector132.X > 0) { flaming = true; Vector2 shootspeed = Vector2.Normalize(npc.velocity) * 20f; Vector2 shootpos = Vector2.Normalize(npc.velocity).RotatedBy((float)Math.PI / 2 * npc.direction) * npc.height / 2; AAAI.BreatheFire(npc, true, mod.ProjectileType("AkumaABreath"), 2, 4); } else { flaming = false; } float length = (float)Math.Sqrt(dirX * dirX + dirY * dirY); if (!collision) { npc.TargetClosest(true); npc.velocity.Y = npc.velocity.Y + 0.11f; if (npc.velocity.Y > speed) { npc.velocity.Y = speed; } if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.4) { if (npc.velocity.X < 0.0) { npc.velocity.X = npc.velocity.X - acceleration * 1.1f; } else { npc.velocity.X = npc.velocity.X + acceleration * 1.1f; } } else if (npc.velocity.Y == speed) { if (npc.velocity.X < dirX) { npc.velocity.X = npc.velocity.X + acceleration; } else if (npc.velocity.X > dirX) { npc.velocity.X = npc.velocity.X - acceleration; } } else if (npc.velocity.Y > 4.0) { if (npc.velocity.X < 0.0) { npc.velocity.X = npc.velocity.X + acceleration * 0.9f; } else { npc.velocity.X = npc.velocity.X - acceleration * 0.9f; } } } else { if (npc.soundDelay == 0) { float num1 = length / 40f; if (num1 < 10.0) { num1 = 10f; } if (num1 > 20.0) { num1 = 20f; } npc.soundDelay = (int)num1; } float absDirX = Math.Abs(dirX); float absDirY = Math.Abs(dirY); float newSpeed = speed / length; dirX *= newSpeed; dirY *= newSpeed; if (npc.velocity.X > 0.0 && dirX > 0.0 || npc.velocity.X < 0.0 && dirX < 0.0 || npc.velocity.Y > 0.0 && dirY > 0.0 || npc.velocity.Y < 0.0 && dirY < 0.0) { if (npc.velocity.X < dirX) { npc.velocity.X = npc.velocity.X + acceleration; } else if (npc.velocity.X > dirX) { npc.velocity.X = npc.velocity.X - acceleration; } if (npc.velocity.Y < dirY) { npc.velocity.Y = npc.velocity.Y + acceleration; } else if (npc.velocity.Y > dirY) { npc.velocity.Y = npc.velocity.Y - acceleration; } if (Math.Abs(dirY) < speed * 0.2 && (npc.velocity.X > 0.0 && dirX < 0.0 || npc.velocity.X < 0.0 && dirX > 0.0)) { if (npc.velocity.Y > 0.0) { npc.velocity.Y = npc.velocity.Y + acceleration * 2f; } else { npc.velocity.Y = npc.velocity.Y - acceleration * 2f; } } if (Math.Abs(dirX) < speed * 0.2 && (npc.velocity.Y > 0.0 && dirY < 0.0 || npc.velocity.Y < 0.0 && dirY > 0.0)) { if (npc.velocity.X > 0.0) { npc.velocity.X = npc.velocity.X + acceleration * 2f; } else { npc.velocity.X = npc.velocity.X - acceleration * 2f; } } } else if (absDirX > absDirY) { if (npc.velocity.X < dirX) { npc.velocity.X = npc.velocity.X + acceleration * 1.1f; } else if (npc.velocity.X > dirX) { npc.velocity.X = npc.velocity.X - acceleration * 1.1f; } if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.5) { if (npc.velocity.Y > 0.0) { npc.velocity.Y = npc.velocity.Y + acceleration; } else { npc.velocity.Y = npc.velocity.Y - acceleration; } } } else { if (npc.velocity.Y < dirY) { npc.velocity.Y = npc.velocity.Y + acceleration * 1.1f; } else if (npc.velocity.Y > dirY) { npc.velocity.Y = npc.velocity.Y - acceleration * 1.1f; } if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.5) { if (npc.velocity.X > 0.0) { npc.velocity.X = npc.velocity.X + acceleration; } else { npc.velocity.X = npc.velocity.X - acceleration; } } } } npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; if (!Main.dayTime) { npc.velocity.Y = npc.velocity.Y - 1f; if (npc.position.Y - npc.height - npc.velocity.Y >= Main.maxTilesY && Main.netMode != NetmodeID.MultiplayerClient) { BaseAI.KillNPC(npc); npc.netUpdate2 = true; } } 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.velocity.Y = npc.velocity.Y + 1f; if (npc.position.Y < 0) { npc.velocity.Y = npc.velocity.Y + 1f; speed = 30f; } if (npc.position.Y < 0) { for (int num957 = 0; num957 < 200; num957++) { if (Main.npc[num957].aiStyle == npc.aiStyle) { Main.npc[num957].active = false; } } } } if (collision) { if (npc.localAI[0] != 1) { npc.netUpdate = true; } npc.localAI[0] = 1f; } else { if (npc.localAI[0] != 0.0) { npc.netUpdate = true; } npc.localAI[0] = 0.0f; } if ((npc.velocity.X > 0.0 && npc.oldVelocity.X < 0.0 || npc.velocity.X < 0.0 && npc.oldVelocity.X > 0.0 || npc.velocity.Y > 0.0 && npc.oldVelocity.Y < 0.0 || npc.velocity.Y < 0.0 && npc.oldVelocity.Y > 0.0) && !npc.justHit) { npc.netUpdate = true; } return(false); }
public override bool PreAI() { Vector2 chasePosition = Main.npc[(int)npc.ai[1]].Center; Vector2 directionVector = chasePosition - npc.Center; npc.spriteDirection = (directionVector.X > 0f) ? 1 : -1; if (npc.ai[3] > 0) { npc.realLife = (int)npc.ai[3]; } if (npc.target < 0 || npc.target == byte.MaxValue || Main.player[npc.target].dead) { npc.TargetClosest(true); } if (Main.player[npc.target].dead && npc.timeLeft > 300) { npc.timeLeft = 300; } AAAI.DustOnNPCSpawn(npc, ModContent.DustType <AkumaADust>(), 2, 12); if (Main.netMode != NetmodeID.MultiplayerClient) { if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[3]].type != mod.NPCType("AwakenedLung")) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0.0f, 0.0f, 0, 0, 0); } } if (npc.ai[1] < (double)Main.npc.Length) { Vector2 npcCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float dirX = Main.npc[(int)npc.ai[1]].position.X + Main.npc[(int)npc.ai[1]].width / 2 - npcCenter.X; float dirY = Main.npc[(int)npc.ai[1]].position.Y + Main.npc[(int)npc.ai[1]].height / 2 - npcCenter.Y; npc.rotation = (float)Math.Atan2(dirY, dirX) + 1.57f; float length = (float)Math.Sqrt(dirX * dirX + dirY * dirY); float dist = (length - npc.width) / length; float posX = dirX * dist; float posY = dirY * dist; if (dirX < 0f) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + posX; npc.position.Y = npc.position.Y + posY; } Player player = Main.player[npc.target]; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); } npc.netUpdate = true; return(false); }
public override void AI() { npc.TargetClosest(); Player player = Main.player[npc.target]; if (player == null) { npc.TargetClosest(); } if (player.dead || !player.active || Vector2.Distance(player.Center, npc.Center) > 5000) { npc.TargetClosest(); if (player.dead || !player.active || Vector2.Distance(player.Center, npc.Center) > 5000) { Projectile.NewProjectile(npc.Center, new Vector2(0f, 0f), mod.ProjectileType("MonarchRUNAWAY"), 0, 0); npc.active = false; return; } } float dist = npc.Distance(player.Center); npc.frameCounter++; if (internalAI[1] != AISTATE_JUMP && internalAI[1] != AISTATE_FLY) //walk or charge { int FrameSpeed = 10; if (internalAI[1] == AISTATE_CHARGE) { FrameSpeed = 6; } if (npc.frameCounter >= FrameSpeed) { npc.frameCounter = 0; npc.frame.Y += 108; if (npc.frame.Y > (108 * 4)) { npc.frameCounter = 0; npc.frame.Y = 0; } } if (npc.velocity.Y != 0) { if (npc.velocity.Y < 0) { npc.frame.Y = 648; } else if (npc.velocity.Y > 0) { npc.frame.Y = 756; } } } else if (internalAI[1] == AISTATE_FLY) { npc.frameCounter = 0; npc.frame.Y += 108; if (npc.frame.Y > (108 * 11) || npc.frame.Y < (108 * 8)) { npc.frameCounter = 0; npc.frame.Y = 108 * 8; } } else //jump { if (npc.velocity.Y == 0) { npc.frame.Y = 540; } else { if (npc.velocity.Y < 0) { npc.frame.Y = 648; } else if (npc.velocity.Y > 0) { npc.frame.Y = 756; } } } if (player.Center.X > npc.Center.X) // so it faces the player { npc.spriteDirection = -1; } else { npc.spriteDirection = 1; } if (npc.collideX && npc.velocity.Y <= 0) { npc.velocity.Y = -4f; internalAI[1] = AISTATE_CHARGE; } else if (((player.Center.Y - npc.Center.Y) < -150f && (internalAI[1] == AISTATE_WALK || internalAI[1] == AISTATE_CHARGE)) || Collision.SolidCollision(new Vector2(npc.Center.X, npc.position.Y - npc.height / 2 + 10), npc.width, npc.height)) { internalAI[1] = AISTATE_FLY; npc.ai = new float[4]; npc.netUpdate = true; } else if ((player.Center.Y - npc.Center.Y) > 100f && internalAI[1] != AISTATE_FLY) // player is below the npc. { internalAI[3] = internalAI[1]; //record the action internalAI[1] = AISTATE_WALK; npc.ai = new float[4]; npc.netUpdate = true; } else if (internalAI[1] != AISTATE_WALK) { internalAI[3] = internalAI[1]; } else { internalAI[1] = internalAI[3]; } if (Main.netMode != 1) { if (internalAI[1] != AISTATE_FLY) { 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_WALK) //fighter { npc.noGravity = false; if (Main.netMode != 1) { internalAI[2]++; } if ((player.Center.Y - npc.Center.Y) > 60f) // player is below the npc. { npc.noTileCollide = true; } else { npc.noTileCollide = false; } if (NPC.CountNPCS(ModContent.NPCType <RedMushling>()) < 4) { for (int i = 0; i < 2; i++) { int Minion = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <RedMushling>(), 0); Main.npc[Minion].netUpdate = true; } internalAI[2] = 0; } AAAI.InfernoFighterAI(npc, ref npc.ai, true, false, 0, 0.07f, 3f, 3, 4, 60, true, 10, 60, true, null, false); } else if (internalAI[1] == AISTATE_JUMP) //jumper { npc.noGravity = false; npc.noTileCollide = false; if (npc.ai[0] < -10) { npc.ai[0] = -10; //force rapid jumping } BaseAI.AISlime(npc, ref npc.ai, true, 30, 6f, -8f, 6f, -10f); } else if (internalAI[1] == AISTATE_FLY)//fly { npc.noTileCollide = true; npc.noGravity = true; if ((player.Center.Y - npc.Center.Y) > 60f) { if (NPC.CountNPCS(ModContent.NPCType <RedMushling>()) < 6) { for (int i = 0; i < 2; i++) { int Minion = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <RedMushling>(), 0); Main.npc[Minion].netUpdate = true; } } MoveToPoint(player.Center); } else { BaseAI.AISpaceOctopus(npc, ref npc.ai, .05f, 8, 250, 0, null); } npc.rotation = 0; if ((player.Center.Y - npc.Center.Y) > 30f && !Collision.SolidCollision(new Vector2(npc.Center.X, npc.position.Y - npc.height / 2 + 10), npc.width, npc.height)) { npc.rotation = 0; npc.noGravity = false; internalAI[0] = 0; internalAI[1] = Main.rand.Next(3); npc.ai = new float[4]; npc.netUpdate = true; npc.noTileCollide = false; } } else //charger { BaseAI.AICharger(npc, ref npc.ai, 0.07f, 10f, false, 30); } }
public override void AI() { Player player = Main.player[npc.target]; AAAI.AIWorm(npc, new int[] { mod.NPCType("Uraeus"), mod.NPCType("UraeusBody"), mod.NPCType("UraeusTail") }, 7, 0f, 10f, 0.07f, true, false, true, true, true); }
public override void AI() { Lighting.AddLight(npc.Center, AAColor.YamataA.R / 255, AAColor.YamataA.G / 255, AAColor.YamataA.B / 255); AAAI.AIShadowflameGhost(npc, ref npc.ai, false, 660f, 0.3f, 15f, 0.2f, 8f, 5f, 10f, 0.4f, 0.4f, 0.95f, 5f); if (!NPC.AnyNPCs(mod.NPCType("YamataA"))) { npc.life = 0; } if (Main.npc[(int)internalAI[0]].active && Main.npc[(int)internalAI[0]].life > 0) { float dist = npc.Distance(Main.npc[(int)internalAI[0]].Center); if (dist > 2000) { npc.position = Main.npc[(int)internalAI[0]].Center; } } if (internalAI[3] > 0) { internalAI[3]--; } else { npc.active = false; if (Main.netMode != NetmodeID.MultiplayerClient) { int Head = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("YamataAHeadF")); Main.npc[Head].ai[0] = internalAI[0]; if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head2.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head2 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * -3f; Main.npc[Head].ai[2] = -500 * .7f; Main.npc[Head].ai[3] = 3f; } else if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head3.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head3 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * -2f; Main.npc[Head].ai[2] = -500 * .8f; Main.npc[Head].ai[3] = 2f; } else if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head4.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head4 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * -1f; Main.npc[Head].ai[2] = -500 * .9f; Main.npc[Head].ai[3] = 1f; } else if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head5.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head5 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * 1f; Main.npc[Head].ai[2] = -500 * .9f; Main.npc[Head].ai[3] = 1f; } else if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head6.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head6 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * 2f; Main.npc[Head].ai[2] = -500 * .8f; Main.npc[Head].ai[3] = 2f; } else if (!((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head7.active) { ((YamataA)Main.npc[(int)internalAI[0]].modNPC).Head7 = Main.npc[Head]; Main.npc[Head].ai[1] = 300 * 3f; Main.npc[Head].ai[2] = -500 * .7f; Main.npc[Head].ai[3] = 3f; } else { Main.npc[Head].active = false; } Main.npc[Head].netUpdate = true; } } 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 <YamataAuraDust>(), 0f, 0f, 100, default, 2f);
public override void AI() { Player player = Main.player[npc.target]; // makes it so you can reference the player the npc is targetting npc.frameCounter++; if (internalAI[1] != AISTATE_JUMP) //walk or charge { npc.frameCounter++; if (npc.frameCounter >= 10) { npc.frameCounter = 0; npc.frame.Y += 108; if (npc.frame.Y > (108 * 4)) { npc.frameCounter = 0; npc.frame.Y = 0; } } if (npc.velocity.Y != 0) { if (npc.velocity.Y < 0) { npc.frame.Y = 648; } else if (npc.velocity.Y > 0) { npc.frame.Y = 756; } } } else //jump { if (npc.velocity.Y == 0) { npc.frame.Y = 540; } else { if (npc.velocity.Y < 0) { npc.frame.Y = 648; } else if (npc.velocity.Y > 0) { npc.frame.Y = 756; } } } if (player.Center.X > npc.Center.X) // so it faces the player { npc.spriteDirection = -1; } else { npc.spriteDirection = 1; } if (Main.netMode != 1) { 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_WALK) //fighter { AAAI.InfernoFighterAI(npc, ref npc.ai, true, false, 0, 0.07f, 3f, 3, 4, 60, true, 10, 60, true, null, false); } else if (internalAI[1] == AISTATE_JUMP) //jumper { if (npc.ai[0] < -10) { npc.ai[0] = -10; //force rapid jumping } BaseAI.AISlime(npc, ref npc.ai, true, 30, 6f, -8f, 6f, -10f); } else //charger { BaseAI.AICharger(npc, ref npc.ai, 0.07f, 10f, false, 30); } }