public override void SetDefaults() { NPC.aiStyle = -1; NPC.lifeMax = 35000; NPC.damage = 0; NPC.defense = 15; NPC.knockBackResist = 0; NPC.width = 621 / 2; NPC.height = 877; NPC.scale = 1; NPC.value = 500; NPC.npcSlots = 4; NPC.boss = true; NPC.lavaImmune = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit1; NPC.behindTiles = true; NPC.hide = true; NPC.DeathSound = SoundID.NPCDeath1; Music = MusicLoader.GetMusicSlot("KingdomTerrahearts/Sounds/Music/Vector to the Heaven"); s = new ProjectileSource_NPC(NPC); NPC.ai[0] = 50; }
public override bool CheckDead() { if (!NPC.downedMoonlord) { if (NPC.timeLeft > 20 && !defeated) { Conversation[] conv = new Conversation[] { new Conversation("Good fight, but I still went easy on you", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") }; DialogSystem.AddConversation(conv); } } else { if (!defeated) { ProjectileSource_NPC s = new ProjectileSource_NPC(NPC); Projectile.NewProjectile(s, Main.player[NPC.target].Center, Vector2.Zero, ModContent.ProjectileType <FinalXionSpawnProjectile>(), 0, 0); NPC.timeLeft = (NPC.timeLeft > 5) ? 1 : NPC.timeLeft; defeated = true; defeatTime = 0; } } KingdomWorld.downedXionPhases[1] = true; defeated = true; NPC.life = 1; return(false); }
public void Shoot() { ProjectileSource_NPC s = new ProjectileSource_NPC(NPC); Vector2 projVel = new Vector2(NPC.direction, 0); Projectile newProj = Projectile.NewProjectileDirect(s, NPC.Center, projVel * 2, ProjectileID.DeathLaser, 3, 0.5f); newProj.friendly = false; newProj.timeLeft = 175; newProj.scale = 0.85f; NPC.ai[0] = 0; }
public override void AI() { NPC.TargetClosest(true); Player p = Main.player[NPC.target]; float distToPlayer = Vector2.Distance(NPC.Center, p.Center); Vector2 pRelDist = p.Center - NPC.Center; if (hitRotation > 0) { NPC.rotation = hitRotation / rotationSpeed; hitRotation--; NPC.velocity *= speedReduction; } else { if (p == null || distToPlayer < targetRange) { attackTimer--; if (attackTimer > 0) { NPC.rotation = (float)(Math.Sin(Main.time / 10) / 6); NPC.velocity *= speedReduction; } else if (attackTimer > -100 / ((Main.expertMode)?4:1)) { NPC.rotation = (float)(Math.Sin(Main.time / 2) / 6); NPC.velocity *= speedReduction; } else { ProjectileSource_NPC s = new ProjectileSource_NPC(NPC); pRelDist = MathHelp.Normalize(pRelDist) * speed / 4; int proj = Projectile.NewProjectile(s, NPC.Center, pRelDist, ProjectileID.Fireball, 10, 1); Main.projectile[proj].scale = 0.25f; Main.projectile[proj].tileCollide = !Main.expertMode; Main.projectile[proj].timeLeft = 100 * ((Main.expertMode)?2:1); attackTimer = 25 * ((Main.expertMode)?2:1); } } else { NPC.velocity = MathHelp.Normalize(p.Center - NPC.Center) * speed; } } }
public static void GuidePartyMemberAI(NPC npc, Vector2 prevPos, int projType, ref int[] npcStats) { int npcOwner = PartyMemberLogic.IsPartyMember(npcStats[6]); if (npcOwner >= 0) { Vector2 desiredpos = Main.player[npcOwner].Center; npc.ai[2]++; for (int i = 1; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].friendly && MathHelp.Magnitude(GetDistanceToPlayer(Main.npc[i], npcOwner)) < 400) { npcStats[3] = (npcStats[3] == 0 || MathHelp.Magnitude(GetDistanceToPlayer(Main.npc[i], npcOwner)) < MathHelp.Magnitude(GetDistanceToPlayer(Main.npc[npcStats[3]], npcOwner))) ? i : npcStats[3]; } } if (npcStats[3] != 0 && Main.npc[npcStats[3]].active) { desiredpos = (Vector2.Distance(Main.npc[npcStats[3]].Center, Main.player[Main.myPlayer].Center) > 300) ? desiredpos : Main.npc[npcStats[3]].Center; if (npc.ai[2] > 25) { ProjectileSource_NPC s = new ProjectileSource_NPC(npc); Attack(ref npcStats[5], projType, MathHelp.Normalize(Main.npc[npcStats[3]].Center - npc.Center) * 15, npc.Center, s); npcStats[4] = 5; npc.ai[2] = 0; } } desiredpos = desiredpos - npc.Center; if (Math.Abs(desiredpos.X) > 125 + PartyMemberLogic.GetPartySlotOcupied(npc.type) * 30) { npc.velocity = new Vector2(MathHelp.Sign(desiredpos.X) * 3, (prevPos == npc.Center) ? -10 : npc.velocity.Y); } else { npc.velocity.X -= (Math.Abs(npc.velocity.X) < 1) ? -npc.velocity.X : MathHelp.Sign(npc.velocity.X); } } }
public override void SetDefaults() { NPC.lifeMax = 1200; NPC.width = 40; NPC.height = 60; Music = MusicLoader.GetMusicSlot("KingdomTerrahearts/Sounds/Music/The 13th Struggle"); NPC.friendly = false; NPC.boss = true; NPC.damage = 40; NPC.aiStyle = 0; NPC.npcSlots = 4; NPC.lavaImmune = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; s = new ProjectileSource_NPC(NPC); attacksDamage = new int[] { 0, 10, 25, 15, 15, 15, 15, 15, 15 }; weaponType = ModContent.ProjectileType <Projectiles.BossStuff.sharpShooterProj>(); weaponProj = new int[] { -1 }; }
public override void AI() { ProjectileSource_NPC s = new ProjectileSource_NPC(NPC); NPC.TargetClosest(); DespawnHandler(); Vector2 desPosition; Vector2 velocity; switch (curAttack) { case 0: if (curProjs[0] != 0) { for (int i = 0; i < curProjs.Length; i++) { curProjs[i] = -1; } } desPosition = Main.player[NPC.target].Center + new Vector2(0, VerticalDirection(50, 0.04f) - 250); velocity = desPosition - NPC.Center; NPC.Center += velocity / 5; CheckAttack(120); break; case 1: desPosition = Main.player[NPC.target].Center + new Vector2((NPC.ai[0] - 140) / 240 * 650, -350); velocity = desPosition - NPC.Center; NPC.Center += velocity / 10; if (NPC.ai[0] % 20 == 0 && NPC.ai[0] >= 40) { int proj = Projectile.NewProjectile(s, NPC.Center, new Vector2(0, 50), ProjectileID.IceSpike, 80, 1); Main.projectile[proj].scale = 1.25f; } CheckAttack(240); break; case 2: desPosition = Main.player[NPC.target].Center + new Vector2((NPC.ai[0] - 140) / 240 * -650, -350); velocity = desPosition - NPC.Center; NPC.Center += velocity / 10; if (NPC.ai[0] % 20 == 0 && NPC.ai[0] >= 40) { int proj = Projectile.NewProjectile(s, NPC.Center, new Vector2(0, 50), ProjectileID.IceSpike, 80, 1); Main.projectile[proj].scale = 1.25f; } CheckAttack(240); break; case 3: desPosition = Main.player[NPC.target].Center + new Vector2(0, -400); velocity = desPosition - NPC.Center; NPC.Center += velocity / 5; if (NPC.ai[0] < 320) { if (NPC.ai[0] == 0) { for (int i = 0; i < 20; i++) { curProjs[i] = Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ProjectileID.IceBolt, 150, 1); Main.projectile[curProjs[i]].hostile = true; Main.projectile[curProjs[i]].friendly = false; Main.projectile[curProjs[i]].tileCollide = false; } } if (curProjs[0] != -1) { if (NPC.ai[0] >= 300) { for (int i = 0; i < 20; i++) { Main.projectile[curProjs[i]].tileCollide = true; switch (i % 5) { case 0: Main.projectile[curProjs[i]].velocity = new Vector2(0, -50); break; case 1: Main.projectile[curProjs[i]].velocity = new Vector2(-15, -15); break; case 2: Main.projectile[curProjs[i]].velocity = new Vector2(15, -15); break; case 3: Main.projectile[curProjs[i]].velocity = new Vector2(-35, 35); break; case 4: Main.projectile[curProjs[i]].velocity = new Vector2(35, 35); break; } if (i % 10 > 4) { Main.projectile[curProjs[i]].velocity = -Main.projectile[curProjs[i]].velocity; } curProjs[i] = -1; } } else { for (int i = 0; i < 20; i++) { Vector2 offset; switch (i % 5) { default: case 0: offset = new Vector2(0, -50); break; case 1: offset = new Vector2(-15, -15); break; case 2: offset = new Vector2(15, -15); break; case 3: offset = new Vector2(-35, 35); break; case 4: offset = new Vector2(35, 35); break; } if (i % 10 > 4) { offset = -offset; } if (i >= 10) { offset *= 2; } Main.projectile[curProjs[i]].Center = NPC.Center + offset; } } } } CheckAttack(340); break; case 4: if (NPC.ai[0] > 9) { if (NPC.ai[0] == 10) { curProjs[0] = Projectile.NewProjectile(s, NPC.Center, new Vector2(0, -15f), ProjectileID.IceBolt, 10, 2); Main.projectile[curProjs[0]].tileCollide = false; Main.projectile[curProjs[0]].hostile = true; } if (NPC.ai[0] > 40) { Main.projectile[curProjs[0]].velocity = Vector2.Lerp(Main.projectile[curProjs[0]].velocity, MathHelp.Normalize(Main.player[NPC.target].Center - Main.projectile[curProjs[0]].Center) * 15, 0.2f); Main.projectile[curProjs[0]].velocity = MathHelp.Normalize(Main.projectile[curProjs[0]].velocity) * 15; } if (NPC.ai[0] == 150) { Main.projectile[curProjs[0]].tileCollide = true; Main.projectile[curProjs[0]].velocity *= 2; } } CheckAttack(150); break; } }
public void bossAttack(int attackType) { ProjectileSource_NPC s = new ProjectileSource_NPC(NPC); if (attackType == 1) { int projectile = ModContent.ProjectileType <Projectiles.DarksideMissileOrb>(); if (NPC.ai[1] < -100) { if (shootAttacksUsed < shootAttackTimes) { int missile = ModContent.NPCType <Projectiles.BossStuff.darksideMagicMissiles>(); NPC.NewNPC((int)NPC.Center.X + 15, (int)NPC.Center.Y, missile); NPC.NewNPC((int)NPC.Center.X - 15, (int)NPC.Center.Y, missile); //NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y + 15, missile); //NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y - 15, missile); shootAttacksUsed++; NPC.ai[1] = 0; } else { for (int i = 0; i < 1000; i++) { if (Main.projectile[i].type == projectile) { Main.projectile[i].timeLeft = 1; } } shootAttacksUsed = 0; NPC.ai[1] = 200 + Main.rand.Next(200); bossAttackType = 0; } } else { bool projectileExists = false; for (int i = 0; i < 1000; i++) { if (Main.projectile[i].type == projectile) { Main.projectile[i].Center = NPC.Center; Main.projectile[i].timeLeft = 15; projectileExists = true; } } if (!projectileExists) { Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, projectile, 0, 0); } } } else if (attackType == 2) { if (NPC.ai[1] < -250) { int missile = ModContent.NPCType <NPCs.shadowHeartless>(); NPC.NewNPC((int)NPC.Center.X + 15, (int)NPC.Center.Y, missile); NPC.NewNPC((int)NPC.Center.X - 15, (int)NPC.Center.Y, missile); NPC.ai[1] = 200 + Main.rand.Next(200); bossAttackType = 0; } } }