public override void AI() { float speedmulti = 0.75f; if (!Main.expertMode) { speedmulti = 0.5f; } if (SGAWorld.NightmareHardcore > 0) { speedmulti = 1f; } CopperArmorPiece myself = npc.modNPC as CopperArmorPiece; int npctype = mod.NPCType(myself.attachedType); NPC myowner = Main.npc[myself.attachedID]; if (myowner.active == false) { myself.ArmorMalfunction(); } else { Player P = Main.player[myowner.target]; npc.ai[0] += 1; npc.spriteDirection = npc.velocity.X > 0 ? -1 : 1; Vector2 itt = (myowner.Center - npc.Center + new Vector2(npc.ai[1] * npc.spriteDirection, npc.ai[2])); float locspeed = 0.25f * speedmulti; if (npc.ai[0] % 600 > 350) { npc.damage = (int)npc.defDamage * 3; itt = itt = (P.position - npc.position + new Vector2(npc.ai[1] * npc.spriteDirection, -8)); if (npc.ai[0] % 180 == 0 && SGAWorld.NightmareHardcore > 0) { Vector2 zxx = itt; zxx += P.velocity * 3f; zxx.Normalize(); npc.velocity += zxx * 18; } npc.rotation = npc.rotation + (0.65f * npc.spriteDirection); } else { npc.damage = (int)npc.defDamage; if (npc.ai[0] % 300 < 60) { locspeed = 2.5f * speedmulti; npc.velocity = npc.velocity * 0.92f; } npc.rotation = (float)npc.velocity.X * 0.09f; locspeed = 0.5f * speedmulti; } npc.velocity = npc.velocity * 0.96f; itt.Normalize(); npc.velocity = npc.velocity + (itt * locspeed); npc.timeLeft = 999; } }
public override void AI() { CopperArmorPiece myself = npc.modNPC as CopperArmorPiece; int npctype = mod.NPCType(myself.attachedType); NPC myowner = Main.npc[myself.attachedID]; if (myowner.active == false) { myself.ArmorMalfunction(); } else { CobaltFloat(myowner); } }
public override void AI() { CopperArmorPiece myself = npc.modNPC as CopperArmorPiece; int npctype = mod.NPCType(myself.attachedType); NPC myowner = Main.npc[myself.attachedID]; if (myowner.active == false) { myself.ArmorMalfunction(); } else { Player P = Main.player[npc.target]; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(false); P = Main.player[npc.target]; if (!P.active || P.dead) { npc.active = false; Main.npc[(int)npc.ai[1]].active = false; } } else { npc.ai[0] = npc.ai[0] + 1; if (npc.ai[0] % 300 < 150) { npc.velocity = npc.velocity + ((myowner.Center + new Vector2((float)npc.ai[1], (float)npc.ai[2]) - npc.Center)) / (50); } else { npc.velocity = npc.velocity + (P.Center - npc.Center) * (0.02f); } npc.velocity = npc.velocity * 0.5f; Vector2 dif = npc.Center - myowner.Center; dif.Normalize(); npc.position = npc.position + (dif * 5); npc.rotation = (float)Math.Atan2(npc.position.Y - (myowner.position.Y + (myowner.height * 0.5f)), npc.position.X - (myowner.position.X + (myowner.width * 0.5f))) + 90f; npc.timeLeft = 999; } } }
public override void AI() { CopperArmorPiece myself = npc.modNPC as CopperArmorPiece; NPC myowner = Main.npc[myself.attachedID]; if (myowner.active == false) { myself.ArmorMalfunction(); } else { npc.velocity = npc.velocity + (myowner.Center + new Vector2((float)npc.ai[1], (float)npc.ai[2]) - npc.Center) * (myself.speed); npc.velocity = npc.velocity * myself.friction; npc.rotation = (float)npc.velocity.X * 0.1f; //npc.position=myowner.position; npc.timeLeft = 999; } }
public override void AI() { CopperArmorPiece myself = npc.modNPC as CopperArmorPiece; int npctype = mod.NPCType(myself.attachedType); NPC myowner = Main.npc[myself.attachedID]; if (myowner.active == false) { myself.ArmorMalfunction(); } else { Player P = Main.player[npc.target]; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(false); P = Main.player[npc.target]; if (!P.active || P.dead) { npc.active = false; Main.npc[(int)npc.ai[1]].active = false; } } else { npc.ai[0] += 1; Vector2 itt = (myowner.Center - npc.Center + new Vector2(npc.ai[1] * npc.spriteDirection, npc.ai[2])); if (npc.ai[0] % 1500 > 1250) { itt = (P.position - npc.position + new Vector2(3f * npc.ai[1] * npc.spriteDirection, npc.ai[2] * 2f)); } float locspeed = 0.25f; if (npc.ai[0] % 900 > 550) { Vector2 cas = new Vector2(npc.position.X - P.position.X, npc.position.Y - P.position.Y); double dist = cas.Length(); float rotation = (float)Math.Atan2(npc.position.Y - (P.position.Y - (new Vector2(0, (float)(dist * 0.05f))).Y + (P.height * 0.5f)), npc.position.X - (P.position.X + (P.width * 0.5f))); npc.rotation = rotation;//npc.rotation+((rotation-npc.rotation)*0.1f); npc.velocity = npc.velocity * 0.86f; if (npc.ai[0] % 20 == 0 && npc.ai[0] % 900 > 650) { List <Projectile> one = Idglib.Shattershots(npc.Center, npc.Center + new Vector2(-15 * npc.spriteDirection, 0), new Vector2(0, 0), SGAWorld.NightmareHardcore > 0 ? mod.ProjectileType("UnmanedArrow2") : ProjectileID.WoodenArrowHostile, 20, 20, 0, 1, true, (Main.rand.Next(-100, 100) * 0.000f) - npc.rotation, true, 300); one[0].hostile = true; one[0].friendly = false; one[0].localAI[0] = P.whoAmI; one[0].netUpdate = true; } npc.spriteDirection = 1; } else { if (Math.Abs(npc.velocity.X) > 2) { npc.spriteDirection = npc.velocity.X > 0 ? -1 : 1; } npc.rotation = (float)npc.velocity.X * 0.09f; locspeed = 0.5f; } npc.velocity = npc.velocity * 0.96f; itt.Normalize(); npc.velocity = npc.velocity + (itt * locspeed); npc.timeLeft = 999; } } }