public override void AI() { projectile.rotation += .1f; if (projectile.alpha > 0) { projectile.timeLeft = 180; projectile.alpha -= 5; } if (projectile.timeLeft < 60) { projectile.alpha += 5; } int FountainCount = AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <GoldFountain>()); if (FountainCount < 1) { FountainCount = 1; } if (Main.netMode != 1 && projectile.ai[0]++ >= 5 * FountainCount) { Projectile.NewProjectile(projectile.position.X + 30f, projectile.position.Y + 30f, Main.rand.Next(-3, 4), Main.rand.Next(-3, 10), ModContent.ProjectileType <Gold>(), projectile.damage, 1, projectile.owner, 0, 0); projectile.ai[0] = 0; projectile.netUpdate = true; } Player player = Main.player[projectile.owner]; if (player.inventory[player.selectedItem].type == mod.ItemType("GoldDigger") && player.altFunctionUse == 2 && player.controlUseItem) { projectile.Kill(); } }
public override void PostAI() { if (Main.netMode != 1) { ProjTimer++; if (ProjTimer >= 20) { ProjTimer = 0; int NPCTarget = Target(); if (NPCTarget != -1 && AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <VortexProj>()) < 5) { Projectile.NewProjectile(projectile.position, projectile.velocity, ModContent.ProjectileType <VortexProj>(), projectile.damage, projectile.knockBack, projectile.owner); } } } }
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; } AAModGlobalNPC.Rajah = npc.whoAmI; WeaponPos = new Vector2(npc.Center.X + (npc.direction == 1 ? -78 : 78), npc.Center.Y - 9); StaffPos = new Vector2(npc.Center.X + (npc.direction == 1 ? 78 : -78), npc.Center.Y - 9); if (Roaring) { roarTimer--; } if (Main.netMode != 1 && npc.type == ModContent.NPCType <SupremeRajah>() && isSupreme == false) { isSupreme = true; npc.netUpdate = true; } if (isSupreme) { if (npc.ai[3] != 0 && !DefenseLine && !AAWorld.downedRajahsRevenge && Main.netMode != 1) { DefenseLine = true; BaseUtility.Chat("Rajah glows with furious energy as he attacks, strengthening his defenses", Color.MediumPurple); } if (npc.life <= npc.lifeMax / 7 && !SayLine && Main.netMode != 1) { SayLine = true; string Name; int bunnyKills = NPC.killCount[Item.NPCtoBanner(NPCID.Bunny)]; if (bunnyKills >= 100 && !AAWorld.downedRajahsRevenge) { Name = "MUDERER"; } else { if (Main.netMode != 0) { Name = "Terrarians"; } else if (!AAWorld.downedRajahsRevenge) { Name = "Terrarian"; } else { Name = Main.LocalPlayer.name; } } if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Rajah5") + Name.ToUpper() + Lang.BossChat("Rajah6"), 107, 137, 179); } music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LastStand"); } } Player player = Main.player[npc.target]; if (npc.target >= 0 && Main.player[npc.target].dead) { npc.TargetClosest(true); if (Main.player[npc.target].dead) { if (isSupreme) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Rajah7"), 107, 137, 179); } if (Main.netMode != 1) { Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <SupremeRajahBookIt>(), damage, 0, Main.myPlayer); } } else { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Rajah2"), 107, 137, 179); } if (Main.netMode != 1) { Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <RajahBookIt>(), damage, 0, Main.myPlayer); } } npc.active = false; npc.noTileCollide = true; npc.netUpdate = true; return; } } if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 10000) { npc.TargetClosest(true); if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 10000) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Rajah3"), 107, 137, 179); } if (Main.netMode != 1) { if (isSupreme) { Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <SupremeRajahBookIt>(), damage, 0, Main.myPlayer); //Originally 100 damage } else { Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <RajahBookIt>(), damage, 0, Main.myPlayer); } } npc.active = false; npc.noTileCollide = true; npc.netUpdate = true; return; } } if (player.Center.X < npc.Center.X) { npc.direction = 1; } else { npc.direction = -1; } if (player.Center.Y < npc.position.Y - 30f || TileBelowEmpty() || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 2000 || isDashing) { npc.noGravity = true; FlyAI(); } else { npc.noTileCollide = false; npc.noGravity = false; isDashing = false; JumpAI(); } if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); } if (Main.netMode != 1) { npc.ai[2]++; internalAI[3]++; } if (npc.ai[2] >= 500) { internalAI[3] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } else if (npc.ai[3] == 0 && npc.ai[2] >= ChangeRate()) { if (Main.rand.Next(5) == 0) { Roar(roarTimerMax); } if (Main.netMode != 1) { internalAI[3] = 0; npc.ai[2] = 0; if (ModSupport.GetMod("ThoriumMod") != null && Main.rand.Next(7) == 0) { npc.ai[3] = 7; } else { if (isSupreme) { npc.ai[3] = Main.rand.Next(7); } else { npc.ai[3] = Main.rand.Next(4); } } } npc.netUpdate = true; } if (Main.netMode != 1) { if (npc.ai[3] == 0) //Minion Phase { if (internalAI[3] >= 80) { internalAI[3] = 0; if (internalAI[1] == 0) { if (NPC.CountNPCS(ModContent.NPCType <RabbitcopterSoldier>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon1>()) < 5) { Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); } npc.netUpdate = true; } else { if (npc.ai[1] > 2) { npc.ai[1] = 0; } if (npc.ai[1] == 0) { if (NPC.CountNPCS(ModContent.NPCType <RabbitcopterSoldier>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon1>()) < 5) { Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); } } else if (npc.ai[1] == 1) { if (NPC.CountNPCS(ModContent.NPCType <BunnyBrawler>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon2>()) < 5) { Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon2>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon2>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); } } else if (npc.ai[1] == 2) { if (NPC.CountNPCS(ModContent.NPCType <BunnyBattler>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon3>()) < 8) { Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50)); } } npc.ai[1] += 1; npc.netUpdate = true; } } } else if (npc.ai[3] == 1) //Bunzooka { if (internalAI[3] > 40) { internalAI[3] = 0; int Rocket = isSupreme ? ModContent.ProjectileType <RajahRocketEXR>() : ModContent.ProjectileType <RajahRocket>(); Vector2 dir = Vector2.Normalize(player.Center - WeaponPos); dir *= ProjSpeed(); Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, Rocket, damage, 5, Main.myPlayer); npc.netUpdate = true; } } else if (npc.ai[3] == 2) //Royal Scepter { int carrots = isSupreme ? 5 : 3; int carrotType = isSupreme ? mod.ProjectileType("CarrotEXR") : mod.ProjectileType("CarrotHostile"); float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - WeaponPos); dir *= ProjSpeed(); 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 / carrots * 2; if (internalAI[3] > 40) { internalAI[3] = 0; for (int i = 0; i < carrots; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), carrotType, damage, 5, Main.myPlayer, 0); } npc.netUpdate = true; } } else if (npc.ai[3] == 3) //Javelin { int Javelin = isSupreme ? ModContent.ProjectileType <BaneTEXR>() : ModContent.ProjectileType <BaneR>(); if (internalAI[3] == (isSupreme ? 40 : 60)) { Vector2 dir = Vector2.Normalize(player.position - WeaponPos); dir *= ProjSpeed(); Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, Javelin, damage, 5, Main.myPlayer); } if (internalAI[3] > (isSupreme ? 60 : 90)) { internalAI[3] = 0; } npc.netUpdate = true; } else if (npc.ai[3] == 4) //Excalihare { if (internalAI[3] > 40) { internalAI[3] = 0; Vector2 dir = Vector2.Normalize(player.Center - WeaponPos); dir *= ProjSpeed(); Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, ModContent.ProjectileType <ExcalihareR>(), damage, 5, Main.myPlayer); npc.netUpdate = true; } } else if (npc.ai[3] == 5) //Fluffy Fury { int Arrows = Main.rand.Next(2, 4); float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - WeaponPos); dir *= ProjSpeed(); 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 / (Arrows * 2); if (internalAI[3] > 50) { internalAI[3] = 0; for (int i = 0; i < Arrows; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("CarrowR"), damage, 5, Main.myPlayer); } npc.netUpdate = true; } } else if (npc.ai[3] == 6) //Rabbits Wrath { if (internalAI[3] > 5) { internalAI[3] = 0; Vector2 vector12 = new Vector2(player.Center.X, player.Center.Y); float num75 = 14f; for (int num120 = 0; num120 < 3; num120++) { Vector2 vector2 = player.Center + new Vector2(-(float)Main.rand.Next(0, 401) * player.direction, -600f); vector2.Y -= 120 * num120; Vector2 vector13 = vector12 - vector2; if (vector13.Y < 0f) { vector13.Y *= -1f; } if (vector13.Y < 20f) { vector13.Y = 20f; } vector13.Normalize(); vector13 *= num75; float num82 = vector13.X; float num83 = vector13.Y; float speedX5 = num82; float speedY6 = num83 + Main.rand.Next(-40, 41) * 0.02f; int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX5, speedY6, ModContent.ProjectileType <CarrotEXR>(), damage, 6, Main.myPlayer, 0, 0); Main.projectile[p].tileCollide = false; } npc.netUpdate = true; } } else if (npc.ai[3] == 7) //Carrot Farmer { if (!AAGlobalProjectile.AnyProjectiles(ModContent.ProjectileType <CarrotFarmerR>())) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType <CarrotFarmerR>(), damage, 3f, Main.myPlayer, npc.whoAmI); npc.netUpdate = true; } } } if (Main.expertMode) { if (npc.life < (npc.lifeMax * .85f)) //The lower the health, the more damage is done { npc.damage = (int)(npc.defDamage * 1.1f); } if (npc.life < (npc.lifeMax * .7f)) { npc.damage = (int)(npc.defDamage * 1.3f); } if (npc.life < (npc.lifeMax * .65f)) { npc.damage = (int)(npc.defDamage * 1.5f); } if (npc.life < (npc.lifeMax * .4f)) { npc.damage = (int)(npc.defDamage * 1.7f); } if (npc.life < (npc.lifeMax * .25f)) { npc.damage = (int)(npc.defDamage * 1.9f); } if (npc.life < (npc.lifeMax / 7)) { npc.damage = (int)(npc.defDamage * 2.2f); } } else { if (npc.life == npc.lifeMax / 7) { npc.damage = (int)(npc.defDamage * 1.5f); } } npc.rotation = 0; }