public override void AI() { Vector2 arg_11_0 = base.npc.Center; Vector2 vector2 = new Vector2(base.npc.Center.X, base.npc.Center.Y); Player player = Main.player[base.npc.target]; base.npc.TargetClosest(true); float num1 = player.Center.X - vector2.X; float num2 = player.Center.Y - vector2.Y; if (num4++ > 300) { num4 = 0; FireProjectileAtPlayer(base.mod.ProjectileType("CCProj")); } //Form 1 = Idle //Form 2 = Idle (Armless) //Form 3 = Idle (Headless) //Form 4 = Idle (Headless & Armless) //Form 5 = Spinning Charge //Form 6 = Cannon Phase //Form 7 = Enrage Transition //Form 8-14 = Enraged Forms if (this.armsLoose || this.headLoose || form == 7) { formUpdate = 0; } if (formUpdate++ > 600) { picker++; if (phaseTransitions[picker] == 8 && !flag) { picker = 1; } if (phaseTransitions[picker] == 15 && flag) { picker = 8; } if (phaseTransitions[picker] == 9999) { picker = 11; } form = phaseTransitions[picker]; formUpdate = 0; } float speedNorm = 4f; if (form == 5) { speedNorm *= 2.5f; } if (flag) { speedNorm *= 2f; } if (num5++ > 360) { speedNorm *= 10f; if (num5 > 390) { num5 = 0; } } base.npc.velocity = JSHelper.MoveTowardsPlayer(speedNorm, base.npc.velocity.X, base.npc.velocity.Y, player, base.npc.Center, base.npc.direction); if (base.npc.life < (int)(base.npc.lifeMax * 0.75) && !flag7) { Talk("INITIATING PRIMARY ELIMINATION PHASE. TARGET ACQUIRED."); flag7 = true; } if (base.npc.life < (int)(base.npc.lifeMax * 0.5) && !flag8) { Talk("INITIATING SECONDARY ANNIHILATION PHASE. TARGET LOST."); flag8 = true; } if (base.npc.life < (int)(base.npc.lifeMax * 0.25) && !flag9) { Talk("WARNING: SEVERE DAMAGE DETECTED. ENGAGING IN RECOVERY SAFETY PROTOCOL."); flag9 = true; } if (form == 6 || form == 13) { if (form == 6) { flag3 = true; } else { flag3 = false; } int cannonFire = flag3 ? 120 : 60; if (cannonTimer++ > cannonFire) { Main.PlaySound(base.mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CCBlast"), (int)base.npc.position.X, (int)base.npc.position.Y); FireProjectileAtPlayer(base.mod.ProjectileType("CCBlast")); cannonTimer = 0; num = 0; } base.npc.velocity.X = 0f; base.npc.velocity.Y = 0f; } base.npc.rotation = base.npc.velocity.X / 40f; if (form == 7) { base.npc.velocity.X = 0f; base.npc.velocity.Y = 0f; int num3 = Main.expertMode ? 1620 : 2100; if (!flag2) { cocoonLife = 6000; flag2 = true; } if (cocoonLife <= 0) { Talk("TRANSFORM PHASE CANCELLED. REGAINING POWER."); enrageTimer = 0; form = 1; } enrageTimer++; if (enrageTimer > num3 && !flag) { Main.PlaySound(SoundLoader.customSoundType, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/Custom/ShiftSpawn")); Talk("TRANSFORM COMPLETE. SHIFTING TO SECOND TIER."); enrageTimer = 0; SpewEnergy(); flag = true; form = 8; formUpdate = 0; base.npc.damage *= 2; base.npc.defense *= 2; } } else { enrageTimer = 0; } if ((form == 2 || form == 4 || form == 9 || form == 11) && !this.armsLoose) { this.armsLoose = true; NPC.NewNPC((int)base.npc.Center.X + 8, (int)base.npc.Center.Y, base.mod.NPCType("Shift_ArmLeft"), base.npc.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.npc.Center.X - 8, (int)base.npc.Center.Y, base.mod.NPCType("Shift_ArmRight"), base.npc.whoAmI, 0f, 0f, 0f, 0f, 255); } if ((form == 3 || form == 4 || form == 10 || form == 11) && !this.headLoose) { this.headLoose = true; int num4 = NPC.NewNPC((int)base.npc.Center.X, (int)base.npc.Center.Y - 16, base.mod.NPCType("Shift_Head"), base.npc.whoAmI, 0f, 0f, 0f, 0f, 255); if (form > 8) { Main.npc[num4].frame.Y = 24; } } bool flag4 = NPC.AnyNPCs(base.mod.NPCType("Shift_ArmLeft")); bool flag5 = NPC.AnyNPCs(base.mod.NPCType("Shift_ArmRight")); bool flag6 = NPC.AnyNPCs(base.mod.NPCType("Shift_Head")); if (!flag4 && !flag5) { if (form == 2 || form == 9) { picker++; form = phaseTransitions[picker]; this.armsLoose = false; } } if (!flag6) { if (form == 3 || form == 10) { picker++; form = phaseTransitions[picker]; this.headLoose = false; } } if (!flag4 && !flag5 && !flag6 && (form == 4 || form == 11)) { picker++; form = phaseTransitions[picker]; this.armsLoose = false; this.headLoose = false; } if (base.npc.Center.X < player.Center.X) { base.npc.direction = 1; } else { base.npc.direction = -1; } base.npc.spriteDirection = base.npc.direction; }