public override void OpenBossBag(Player player) { if (Main.rand.Next(20) == 0) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); modPlayer.PMLDevArmor(); } string[] lootTableA = { "AshRain", "FuryFlame", "FireSpiritStaff", "AsheSatchel" }; int lootA = Main.rand.Next(lootTableA.Length); player.QuickSpawnItem(mod.ItemType(lootTableA[lootA])); string[] lootTableH = { "HarukaKunai", "Masamune", "MizuArashi", "HarukaBox" }; int lootH = Main.rand.Next(lootTableH.Length); player.QuickSpawnItem(mod.ItemType(lootTableH[lootH])); player.QuickSpawnItem(mod.ItemType("HeartOfPassion")); player.QuickSpawnItem(mod.ItemType("HeartOfSorrow")); }
public override void Update(Player player, ref int buffIndex) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.ownedProjectileCounts[mod.ProjectileType("Seraph")] > 0 && BasePlayer.HasAccessory(player, ModContent.ItemType <Items.Boss.Athena.SeraphHarp>(), true, false)) { modPlayer.Seraph = true; } else { modPlayer.Seraph = false; } if (!modPlayer.Seraph) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override void OpenBossBag(Player player) { if (Main.rand.Next(10) == 0) { player.QuickSpawnItem(mod.ItemType("ZeroCore")); } if (Main.rand.Next(7) == 0) { player.QuickSpawnItem(mod.ItemType("ZeroMask")); } if (Main.rand.Next(10) == 0) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); modPlayer.PMLDevArmor(); } player.QuickSpawnItem(mod.ItemType("UnstableSingularity"), Main.rand.Next(30, 40)); player.QuickSpawnItem(mod.ItemType("BrokenCode")); string[] lootTable = { "Battery", "ZeroArrow", "Vortex", "EventHorizon", "RealityCannon", "RiftShredder", "VoidStar", "TeslaHand", "Neutralizer", "ZeroTerratool", "DoomPortal", "Gigataser", "OmegaVolley", "GenocideCannon" }; int loot = Main.rand.Next(lootTable.Length); player.QuickSpawnItem(mod.ItemType(lootTable[loot])); }
public override void OpenBossBag(Player player) { if (Main.rand.Next(7) == 0) { player.QuickSpawnItem(mod.ItemType("HydraMask1")); } else if (Main.rand.Next(7) == 1) { player.QuickSpawnItem(mod.ItemType("HydraMask2")); } else if (Main.rand.Next(7) == 2) { player.QuickSpawnItem(mod.ItemType("HydraMask3")); } if (Main.rand.Next(20) == 0) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); modPlayer.PHMDevArmor(); } player.QuickSpawnItem(mod.ItemType("Abyssium"), Main.rand.Next(75, 125)); player.QuickSpawnItem(mod.ItemType("HydraHide"), Main.rand.Next(50, 100)); player.QuickSpawnItem(mod.ItemType("HydraPendant")); }
public override void OpenBossBag(Player player) { if (Main.rand.Next(7) == 0) { player.QuickSpawnItem(mod.ItemType("GripMaskBlue")); } else if (Main.rand.Next(7) == 1) { player.QuickSpawnItem(mod.ItemType("GripMaskRed")); } if (Main.rand.Next(10) == 0) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); modPlayer.PHMDevArmor(); } if (Main.rand.Next(3) == 0) { player.QuickSpawnItem(mod.ItemType("ClawBaton")); } player.QuickSpawnItem(mod.ItemType("Abyssium"), Main.rand.Next(25, 56)); player.QuickSpawnItem(mod.ItemType("Incinerite"), Main.rand.Next(25, 56)); player.QuickSpawnItem(mod.ItemType("ClawOfChaos")); }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(mod); if (player.dead) { modPlayer.Raidmini = false; } if (modPlayer.Raidmini) { projectile.timeLeft = 2; } projectile.frameCounter++; if (projectile.frameCounter > 5) { projectile.frame++; projectile.frameCounter = 0; if (projectile.frame > 2) { projectile.frame = 0; } } }
public override void OpenBossBag(Player player) { player.QuickSpawnItem(mod.ItemType("HolySock")); if (Main.rand.NextFloat() < 0.01f) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(mod); modPlayer.HMDevArmor(); } string[] lootTable = { "HolyLaserBlaster", "PuppetStaff", "SockCannon", "SockMace" }; int loot = Main.rand.Next(lootTable.Length); if (Main.rand.Next(5) == 0) { player.QuickSpawnItem(mod.ItemType("Sock"), Main.rand.Next(400)); return; } player.QuickSpawnItem(mod.ItemType(lootTable[loot])); }
public override void Update(Player player, ref int buffIndex) { AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); bool flag = player.ownedProjectileCounts[mod.ProjectileType("BunnyRune")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("DiscordRune")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("EnergyRune")] > 0; bool flag2 = player.ownedProjectileCounts[mod.ProjectileType("TerraRune")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("ChaosRune")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("VoidRune")] > 0; if (flag) { modPlayer.WeakCCRune = true; } if (flag2) { modPlayer.CCRune = true; } if (!modPlayer.WeakCCRune && !modPlayer.CCRune && !modPlayer.CCBook && !modPlayer.CCBookEX) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override void AI() { bool flag64 = projectile.type == mod.ProjectileType("CrimeraMinion"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("CrimeraMinion"), 3600); if (flag64) { if (player.dead) { modPlayer.CrimeraMinion = false; } if (modPlayer.CrimeraMinion) { projectile.timeLeft = 2; } } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("CrimeraMinion"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (projectile.ai[0] == 2f) { projectile.ai[1] += 1f; projectile.extraUpdates = 1; projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; if (projectile.ai[1] > 40f) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = 0; projectile.numUpdates = 0; projectile.netUpdate = true; } else { flag24 = true; } } if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 40f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { if (projectile.ai[1] == 0f && flag25 && num633 < 500f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { projectile.ai[0] = 2f; Vector2 value20 = vector46 - projectile.Center; value20.Normalize(); projectile.velocity = value20 * 8f; projectile.netUpdate = true; return; } } } }
public override void AI() { bool flag64 = projectile.type == mod.ProjectileType("DustDevil"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("DustDevil"), 3600); if (flag64) { if (player.dead) { modPlayer.dustDevil = false; } if (modPlayer.dustDevil) { projectile.timeLeft = 2; } } float num8 = 0.1f; float num9 = projectile.width * 2f; for (int j = 0; j < 1000; j++) { if (j != projectile.whoAmI && Main.projectile[j].active && Main.projectile[j].owner == projectile.owner && Main.projectile[j].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[j].position.X) + Math.Abs(projectile.position.Y - Main.projectile[j].position.Y) < num9) { if (projectile.position.X < Main.projectile[j].position.X) { projectile.velocity.X = projectile.velocity.X - num8; } else { projectile.velocity.X = projectile.velocity.X + num8; } if (projectile.position.Y < Main.projectile[j].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num8; } else { projectile.velocity.Y = projectile.velocity.Y + num8; } } } Vector2 vector = projectile.position; float num10 = 400f; bool flag = false; int num11 = -1; projectile.tileCollide = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.alpha += 20; if (projectile.alpha > 150) { projectile.alpha = 150; } } else { projectile.alpha -= 50; if (projectile.alpha < 60) { projectile.alpha = 60; } } Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); if (projectile.type == 423) { value.Y = 0f; } NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this, false)) { Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; float num12 = Vector2.Distance(vector2, center); if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) { num10 = num12; vector = vector2; flag = true; num11 = ownerMinionAttackTargetNPC.whoAmI; } } if (!flag) { for (int k = 0; k < 200; k++) { NPC nPC = Main.npc[k]; if (nPC.CanBeChasedBy(this, false)) { Vector2 vector3 = nPC.position + nPC.Size * value; float num13 = Vector2.Distance(vector3, center); if (((Vector2.Distance(center, vector) > num13 && num13 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) { num10 = num13; vector = vector3; flag = true; num11 = k; } } } } int num16 = 500; if (flag) { num16 = 1200; } float num17 = Vector2.Distance(player.Center, projectile.Center); if (num17 > num16) { projectile.ai[0] = 1f; projectile.netUpdate = true; } if (projectile.ai[0] == 1f) { projectile.tileCollide = false; } if (flag && projectile.ai[0] == 0f) { Vector2 vector4 = vector - projectile.Center; float num18 = vector4.Length(); vector4.Normalize(); if (num18 > 400f) { float scaleFactor = 2f; vector4 *= scaleFactor; projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; } else { projectile.velocity *= 0.96f; } if (num18 > 200f) { float scaleFactor2 = 6f; vector4 *= scaleFactor2; projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; } else if (projectile.velocity.Y > -1f) { projectile.velocity.Y = projectile.velocity.Y - 0.1f; } } else { if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) { projectile.ai[0] = 1f; } float num22 = 9f; Vector2 center2 = projectile.Center; Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); vector6 += new Vector2(0f, 40f); float num24 = vector6.Length(); if (num24 > 200f && num22 < 9f) { num22 = 9f; } if (num24 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num24 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.width / 2; } if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) { vector6.Normalize(); vector6 *= num22; vector6 *= new Vector2(1.25f, 0.65f); projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; } else { if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } projectile.velocity *= 1.01f; } } projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; if (projectile.velocity.X > 0f) { projectile.spriteDirection = projectile.direction = -1; } else if (projectile.velocity.X < 0f) { projectile.spriteDirection = projectile.direction = 1; } if (projectile.ai[1] > 0f) { projectile.ai[1] += 1f; if (Main.rand.Next(3) != 0) { projectile.ai[1] += 1f; } } if (projectile.ai[1] > 60f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float scaleFactor4 = 5f; int num29 = ModContent.ProjectileType <DevilGust>(); if (flag) { if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { return; } else if (projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { Vector2 value4 = vector - projectile.Center; value4.Normalize(); value4 *= scaleFactor4; int num33 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value4.X, value4.Y, num29, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num33].timeLeft = 300; Main.projectile[num33].netUpdate = true; projectile.netUpdate = true; } } } } projectile.frameCounter++; if (projectile.frameCounter >= 7) { projectile.frame += 1; projectile.frameCounter = 0; } if (projectile.frame >= 6) { projectile.frame = 0; } }
public override void AI() { Lighting.AddLight((int)(projectile.position.X + projectile.width / 2) / 16, (int)(projectile.position.Y + projectile.height / 2) / 16, 1f, 0.95f, 0.8f); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("CCRune"), 3600); if (!modPlayer.CCBook) { projectile.active = false; return; } if (player.dead) { modPlayer.WeakCCRune = false; } if (player.HasBuff(mod.BuffType("CCRune"))) { projectile.timeLeft = 2; } projectile.timeLeft++; float num633 = 700f; float num634 = 800f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("BunnyRune"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - 0.02f; } else { projectile.velocity.X = projectile.velocity.X + 0.02f; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - 0.02f; } else { projectile.velocity.Y = projectile.velocity.Y + 0.02f; } } } if (Vector2.Distance(player.Center, projectile.Center) > 400f) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } Vector2 vector = player.Center - projectile.Center - new Vector2(0, 50f); float num639 = 7f; if (vector.Length() > 200f && num639 < 10f) { num639 = 10f; } if (vector.Length() < 100f && (projectile.ai[0] == 1f) && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (vector.Length() > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } else if (vector.Length() > 40f) { vector.Normalize(); vector *= num639; projectile.velocity = (projectile.velocity * 40f + vector) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.04f; projectile.velocity.Y = -0.02f; } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 220f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.localAI[0] < 120f) { projectile.localAI[0] += 1f; } if (projectile.ai[0] == 0f) { if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Main.player[projectile.owner].statLife < Main.player[projectile.owner].statLifeMax2) { Main.player[projectile.owner].HealEffect(1, false); Main.player[projectile.owner].statLife += 1; if (Main.player[projectile.owner].statLife > Main.player[projectile.owner].statLifeMax2) { Main.player[projectile.owner].statLife = Main.player[projectile.owner].statLifeMax2; } NetMessage.SendData(66, -1, -1, null, projectile.owner, 1, 0f, 0f, 0, 0, 0); projectile.netUpdate = true; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = Main.player[projectile.owner].GetModPlayer <AAPlayer>(); if (player.dead) { modPlayer.ImpServant = false; } if (modPlayer.ImpServant) { projectile.timeLeft = 2; } float num8 = 0.1f; float num9 = projectile.width; num9 *= 2f; for (int j = 0; j < 1000; j++) { if (j != projectile.whoAmI && Main.projectile[j].active && Main.projectile[j].owner == projectile.owner && Main.projectile[j].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[j].position.X) + Math.Abs(projectile.position.Y - Main.projectile[j].position.Y) < num9) { if (projectile.position.X < Main.projectile[j].position.X) { projectile.velocity.X = projectile.velocity.X - num8; } else { projectile.velocity.X = projectile.velocity.X + num8; } if (projectile.position.Y < Main.projectile[j].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num8; } else { projectile.velocity.Y = projectile.velocity.Y + num8; } } } Vector2 vector = projectile.position; float num10 = 400f; bool flag = false; projectile.tileCollide = false; NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this, false)) { float num14 = Vector2.Distance(ownerMinionAttackTargetNPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector) > num14 && num14 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) { num10 = num14; vector = ownerMinionAttackTargetNPC2.Center; flag = true; } } if (!flag) { for (int l = 0; l < 200; l++) { NPC nPC2 = Main.npc[l]; if (nPC2.CanBeChasedBy(this, false)) { float num15 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector) > num15 && num15 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num10 = num15; vector = nPC2.Center; flag = true; } } } } int num16 = 500; if (flag) { num16 = 1000; } float num17 = Vector2.Distance(player.Center, projectile.Center); if (num17 > num16) { projectile.ai[0] = 1f; projectile.netUpdate = true; } if (projectile.ai[0] == 1f) { projectile.tileCollide = false; } if (flag && projectile.ai[0] == 0f) { Vector2 vector4 = vector - projectile.Center; float num18 = vector4.Length(); vector4.Normalize(); if (num18 < 150f) { float num21 = 4f; vector4 *= -num21; projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; } else { projectile.velocity *= 0.97f; } } else { if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) { projectile.ai[0] = 1f; } float num22 = 6f; if (projectile.ai[0] == 1f) { num22 = 15f; } Vector2 center2 = projectile.Center; projectile.ai[1] = 3600f; projectile.netUpdate = true; Vector2 vector6 = player.Center - center2; int num23 = 1; for (int m = 0; m < projectile.whoAmI; m++) { if (Main.projectile[m].active && Main.projectile[m].owner == projectile.owner && Main.projectile[m].type == projectile.type) { num23++; } } vector6.X -= 10 * Main.player[projectile.owner].direction; vector6.X -= num23 * 40 * Main.player[projectile.owner].direction; vector6.Y -= 10f; float num24 = vector6.Length(); if (num24 > 200f && num22 < 9f) { num22 = 9f; } num22 = (int)(num22 * 0.75); if (num24 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num24 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.width / 2; } if (num24 > 10f) { vector6.Normalize(); if (num24 < 50f) { num22 /= 2f; } vector6 *= num22; projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; } else { projectile.direction = Main.player[projectile.owner].direction; projectile.velocity *= 0.9f; } } projectile.rotation = projectile.velocity.X * 0.05f; if (projectile.velocity.X > 0f) { projectile.spriteDirection = projectile.direction = 1; } else if (projectile.velocity.X < 0f) { projectile.spriteDirection = projectile.direction = -1; } if (projectile.ai[1] > 0f) { projectile.ai[1] += 1f; if (Main.rand.Next(3) == 0) { projectile.ai[1] += 1f; } } if (projectile.ai[1] > Main.rand.Next(180, 900)) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { projectile.frame = 1; float scaleFactor4 = 11f; int num29 = ModContent.ProjectileType <SkullShot>(); if (flag) { if ((vector - projectile.Center).X > 0f) { projectile.spriteDirection = projectile.direction = -1; } else if ((vector - projectile.Center).X < 0f) { projectile.spriteDirection = projectile.direction = 1; } if (projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { Vector2 value4 = vector - projectile.Center; value4.Normalize(); value4 *= scaleFactor4; int num33 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value4.X, value4.Y, num29, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num33].timeLeft = 300; Main.projectile[num33].netUpdate = true; projectile.netUpdate = true; } } } } if (projectile.frame > 0) { projectile.frameCounter++; if (projectile.frameCounter > 30) { projectile.frame = 0; projectile.frameCounter = 0; } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("CrowMinion"), 3600); if (player.dead) { modPlayer.CrowMinion = false; } if (modPlayer.CrowMinion) { projectile.timeLeft = 2; } projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; if (projectile.frameCounter >= 4) { projectile.frameCounter = 0; projectile.frame++; } if (projectile.frame < 4) { projectile.frame = 4; } if (projectile.frame > 7) { projectile.frame = 4; } if (Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; return; } for (int num527 = 0; num527 < 1000; num527++) { if (num527 != projectile.whoAmI && Main.projectile[num527].active && Main.projectile[num527].owner == projectile.owner && Main.projectile[num527].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[num527].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num527].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num527].position.X) { projectile.velocity.X = projectile.velocity.X - 0.05f; } else { projectile.velocity.X = projectile.velocity.X + 0.05f; } if (projectile.position.Y < Main.projectile[num527].position.Y) { projectile.velocity.Y = projectile.velocity.Y - 0.05f; } else { projectile.velocity.Y = projectile.velocity.Y + 0.05f; } } } float num528 = projectile.position.X; float num529 = projectile.position.Y; float num530 = 900f; bool flag19 = false; int num531 = 500; if (projectile.ai[1] != 0f || projectile.friendly) { num531 = 1400; } if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > num531) { projectile.ai[0] = 1f; } if (projectile.ai[0] == 0f) { projectile.tileCollide = true; NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this, false)) { float num532 = ownerMinionAttackTargetNPC2.position.X + ownerMinionAttackTargetNPC2.width / 2; float num533 = ownerMinionAttackTargetNPC2.position.Y + ownerMinionAttackTargetNPC2.height / 2; float num534 = Math.Abs(projectile.position.X + projectile.width / 2 - num532) + Math.Abs(projectile.position.Y + projectile.height / 2 - num533); if (num534 < num530 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) { num530 = num534; num528 = num532; num529 = num533; flag19 = true; } } if (!flag19) { for (int num535 = 0; num535 < 200; num535++) { if (Main.npc[num535].CanBeChasedBy(this, false)) { float num536 = Main.npc[num535].position.X + Main.npc[num535].width / 2; float num537 = Main.npc[num535].position.Y + Main.npc[num535].height / 2; float num538 = Math.Abs(projectile.position.X + projectile.width / 2 - num536) + Math.Abs(projectile.position.Y + projectile.height / 2 - num537); if (num538 < num530 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num535].position, Main.npc[num535].width, Main.npc[num535].height)) { num530 = num538; num528 = num536; num529 = num537; flag19 = true; } } } } } else { projectile.tileCollide = false; } if (!flag19) { projectile.friendly = true; float num539 = 8f; if (projectile.ai[0] == 1f) { num539 = 12f; } Vector2 vector38 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num540 = Main.player[projectile.owner].Center.X - vector38.X; float num541 = Main.player[projectile.owner].Center.Y - vector38.Y - 60f; float num542 = (float)Math.Sqrt(num540 * num540 + num541 * num541); if (num542 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; } if (num542 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.width / 2; } if (num542 > 70f) { num542 = num539 / num542; num540 *= num542; num541 *= num542; projectile.velocity.X = (projectile.velocity.X * 20f + num540) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num541) / 21f; } else { if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } projectile.velocity *= 1.01f; } projectile.friendly = false; projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; if (projectile.frameCounter >= 4) { projectile.frameCounter = 0; projectile.frame++; } if (projectile.frame > 3) { projectile.frame = 0; } if (Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; return; } } else { if (projectile.ai[1] == -1f) { projectile.ai[1] = 17f; } if (projectile.ai[1] > 0f) { projectile.ai[1] -= 1f; } if (projectile.ai[1] == 0f) { projectile.friendly = true; float num543 = 8f; Vector2 vector39 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num544 = num528 - vector39.X; float num545 = num529 - vector39.Y; float num546 = (float)Math.Sqrt(num544 * num544 + num545 * num545); if (num546 < 100f) { num543 = 14f; } num546 = num543 / num546; num544 *= num546; num545 *= num546; projectile.velocity.X = (projectile.velocity.X * 14f + num544) / 15f; projectile.velocity.Y = (projectile.velocity.Y * 14f + num545) / 15f; } else { projectile.friendly = false; if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) { projectile.velocity *= 1.15f; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.dead) { modPlayer.Baron = false; } if (modPlayer.Baron) { projectile.timeLeft = 2; } float shootInterval = 90f; if (player.statLife < player.statLifeMax2 * (4 / 5)) { MeterF = 1; shootInterval = 70f; projectile.damage = (int)(170 * player.minionDamage); } else if (player.statLife < player.statLifeMax2 * (3 / 5)) { MeterF = 2; shootInterval = 60f; projectile.damage = (int)(190 * player.minionDamage); } else if (player.statLife < player.statLifeMax2 * (2 / 5)) { MeterF = 3; shootInterval = 40f; projectile.damage = (int)(210 * player.minionDamage); } else if (player.statLife < player.statLifeMax2 * (1 / 5)) { MeterF = 4; shootInterval = 20f; projectile.damage = (int)(250 * player.minionDamage); } else { MeterF = 5; projectile.damage = (int)(150 * player.minionDamage); } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("BaronBunny"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } projectile.frameCounter++; if (projectile.frameCounter >= 10) { projectile.frameCounter = 0; projectile.frame++; } if (projectile.frame > 4) { projectile.frame = 0; } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > shootInterval) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float scaleFactor3 = 10f; if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; int num658 = Main.rand.Next(3); switch (num658) { case 0: ModContent.ProjectileType <RabbitBeam>(); break; case 1: ModContent.ProjectileType <BaronSpear>(); break; case 2: ModContent.ProjectileType <BaronCarrot>(); break; } if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) { if (num658 == ModContent.ProjectileType <BaronCarrot>()) { float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(vector46 - projectile.Center); dir *= scaleFactor3; 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 / 6f; for (int i = 0; i < 3; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), num658, projectile.damage, 5, Main.myPlayer); } } else { Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 300; Main.projectile[num659].hostile = false; Main.projectile[num659].friendly = true; projectile.netUpdate = true; } projectile.netUpdate = true; } } } projectile.rotation = 0; }
public override void AI() { bool flag64 = projectile.type == mod.ProjectileType("DoomiteProbeC"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("DoomiteProbeC"), 3600); if (flag64) { if (player.dead) { modPlayer.DoomiteProbeC = false; } if (modPlayer.DoomiteProbeC) { projectile.timeLeft = 2; } } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("ProbeMinion"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC nPC2 = Main.npc[player.MinionAttackTargetNPC]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } else { for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } if (projectile.direction == 1) { projectile.spriteDirection = 1; } else { projectile.spriteDirection = -1; } projectile.frameCounter++; if (projectile.frameCounter >= 5) { projectile.frameCounter = 0; projectile.frame++; } if (projectile.frame > 3) { projectile.frame = 0; } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 45f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float scaleFactor3 = 8f; int num658 = 389; if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) { Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].penetrate = 2; Main.projectile[num659].timeLeft = 300; Main.projectile[num659].usesLocalNPCImmunity = true; Main.projectile[num659].localNPCHitCooldown = -1; projectile.netUpdate = true; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(mod); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } int num1038 = 10; if (player.dead) { modPlayer.DragonMinion = false; } if (modPlayer.DragonMinion) { projectile.timeLeft = 2; } num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; float scaleFactor16 = 0f; float scaleFactor17 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); scaleFactor17 = num1053; scaleFactor16 = 16f; int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("DragonHead")) { Main.projectile[byUUID].localAI[1] = projectile.whoAmI; } } if (!flag67) { return; } if (projectile.alpha > 0) { for (int num1054 = 0; num1054 < 2; num1054++) { int num1055 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType <Dusts.AkumaDust>(), 0f, 0f, 100, default(Color), 2f); Main.dust[num1055].noGravity = true; Main.dust[num1055].noLight = true; } } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.scale = scaleFactor17; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * scaleFactor16 * scaleFactor17; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.dead) { modPlayer.CerlaEX = false; } if (modPlayer.CerlaEX) { projectile.timeLeft = 2; } if (projectile.alpha > 0) { projectile.alpha -= 4; } else { projectile.alpha = 0; } if (RingScale < 1.2f) { RingScale += .005f; RingRot += .05f; } else { RingScale = 1.2f; RingRot += .02f; } Vector2 PlayerPoint; PlayerPoint.X = player.Center.X - projectile.width / 2; PlayerPoint.Y = player.Center.Y - projectile.height / 2 + player.gfxOffY - 60f; projectile.position = PlayerPoint; if (player.gravDir == -1f) { projectile.position.Y = projectile.position.Y + 120f; projectile.rotation = 3.14f; } else { projectile.rotation = 0f; } if (projectile.owner == Main.myPlayer) { projectile.ai[0]++; float num396 = projectile.position.X; float num397 = projectile.position.Y; float num398 = 1500f; bool flag11 = false; for (int num399 = 0; num399 < 200; num399++) { if (Main.npc[num399].CanBeChasedBy(this, true)) { float num400 = Main.npc[num399].position.X + Main.npc[num399].width / 2; float num401 = Main.npc[num399].position.Y + Main.npc[num399].height / 2; float num402 = Math.Abs(projectile.position.X + projectile.width / 2 - num400) + Math.Abs(projectile.position.Y + projectile.height / 2 - num401); if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) { num398 = num402; num396 = num400; num397 = num401; flag11 = true; } } } if (flag11) { float num403 = 12f; Vector2 vector29 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num404 = num396 - vector29.X; float num405 = num397 - vector29.Y; float num406 = (float)Math.Sqrt(num404 * num404 + num405 * num405); num406 = num403 / num406; num404 *= num406; num405 *= num406; if (projectile.ai[0] % 5 == 0) { Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, ModContent.ProjectileType <CerlaProj>(), (int)(projectile.damage * player.minionDamage), Player.crystalLeafKB, projectile.owner, 1, 0f); } } } }
public override void AI() { projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; if (projectile.frameCounter++ > 6) { projectile.frame++; projectile.frameCounter = 0; if (projectile.frame > 3) { projectile.frame = 0; } } float radius = 700f; float num14 = 800f; float num15 = 1200f; float num16 = 150f; Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("ChaosClaw"), 3600); if (player.dead) { modPlayer.ChaosClaw = false; } if (modPlayer.ChaosClaw) { projectile.timeLeft = 2; } for (int whoAmI = 0; whoAmI < 1000; whoAmI++) { if (whoAmI != projectile.whoAmI && Main.projectile[whoAmI].active && Main.projectile[whoAmI].owner == projectile.owner && Math.Abs(projectile.position.X - Main.projectile[whoAmI].position.X) + Math.Abs(projectile.position.Y - Main.projectile[whoAmI].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[whoAmI].position.X) { projectile.velocity.X = projectile.velocity.X - 0.05f; } else { projectile.velocity.X = projectile.velocity.X + 0.05f; } if (projectile.position.Y < Main.projectile[whoAmI].position.Y) { projectile.velocity.Y = projectile.velocity.Y - 0.05f; } else { projectile.velocity.Y = projectile.velocity.Y + 0.05f; } } } Vector2 position = projectile.position; bool foundTarget = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC target = Main.npc[player.MinionAttackTargetNPC]; if (target.CanBeChasedBy(projectile, false)) { float distance = Vector2.Distance(target.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, position) > distance && distance < radius) || !foundTarget) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) { radius = distance; position = target.Center; foundTarget = true; } } } else { for (int num645 = 0; num645 < 200; num645++) { NPC target = Main.npc[num645]; if (target.CanBeChasedBy(projectile, false)) { float distance = Vector2.Distance(target.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, position) > distance && distance < radius) || !foundTarget) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) { radius = distance; position = target.Center; foundTarget = true; } } } } float num18 = num14; if (foundTarget) { num18 = num15; } if (Vector2.Distance(player.Center, projectile.Center) > num18) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (foundTarget && projectile.ai[0] == 0f) { Vector2 difference = position - projectile.Center; float num648 = difference.Length(); difference.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; difference *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + difference) / 41f; } else { float num649 = 4f; difference *= -num649; projectile.velocity = (projectile.velocity * 40f + difference) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num16 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } if (foundTarget) { projectile.spriteDirection = (position - projectile.Center).X > 0 ? 1 : -1; projectile.rotation = (position - projectile.Center).ToRotation() + 1.57f; } else { projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; projectile.rotation = projectile.velocity.ToRotation() + 1.57f; } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 60f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float speedScale = 7f; int shoot = mod.ProjectileType("BlazeBall"); if (foundTarget && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, position, 0, 0)) { Vector2 speed = position - projectile.Center; speed.Normalize(); speed *= speedScale; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, shoot, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 300; projectile.netUpdate = true; } } } }
public override void AI() { Lighting.AddLight((int)(projectile.position.X + projectile.width / 2) / 16, (int)(projectile.position.Y + projectile.height / 2) / 16, 1f, 0.95f, 0.8f); bool flag64 = projectile.type == mod.ProjectileType("VoidRune"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("CCRune"), 3600); if (!modPlayer.CCBookEX) { projectile.active = false; return; } if (flag64) { if (player.dead) { modPlayer.CCRune = false; } if (modPlayer.CCRune || modPlayer.CCBookEX) { projectile.timeLeft = 2; } } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("VoidRune"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (projectile.ai[0] == 2f) { projectile.ai[1] += 1f; projectile.extraUpdates = 1; projectile.rotation = projectile.velocity.ToRotation() + 1.57f; if (projectile.ai[1] > 40f) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = 0; projectile.numUpdates = 0; projectile.netUpdate = true; } else { flag24 = true; } } if (flag24) { return; } bool flag25 = false; Vector2 vector46 = projectile.position; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if ((num646 < num633 && Main.npc[num645].life > maxlife) && nPC2.active && nPC2.life > 0 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { maxlife = Main.npc[num645].life; target = num645; } } } if (target > -1) { vector46 = Main.npc[target].Center; flag25 = true; } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector = vector46 - projectile.Center - new Vector2(0, 50f + Main.npc[target].height / 2); float num639 = 7f; if (vector.Length() > 200f && num639 < 10f) { num639 = 10f; } if (vector.Length() > 200f) { vector.Normalize(); vector *= num639; projectile.velocity = (projectile.velocity * 40f + vector) / 41f; } else if (vector.Length() < 40f && (projectile.velocity.X != 0f || projectile.velocity.Y != 0f)) { vector.Normalize(); vector *= num639; projectile.velocity = (projectile.velocity + vector * 40f) / 41f; } if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.02f; projectile.velocity.Y = -0.01f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } if (projectile.ai[1] > 0f) { projectile.ai[1] += 1; } if (projectile.ai[1] > 300f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float scaleFactor3 = 8f; int num658 = mod.ProjectileType("CCRuneNovaRay"); if (flag25 && projectile.ai[1] == 0) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) { Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, projectile.whoAmI, target); projectile.netUpdate = true; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = (AAPlayer)player.GetModPlayer(mod, "AAPlayer"); if (player.dead) { modPlayer.MiniZero = false; } if (modPlayer.MiniZero) { projectile.timeLeft = 2; } float num619 = 0f; float num620 = 0f; float num621 = 0f; float num622 = 0f; float num623 = 0.05f; for (int num624 = 0; num624 < 1000; num624++) { if (num624 != projectile.whoAmI && Main.projectile[num624].active && Main.projectile[num624].owner == projectile.owner && Math.Abs(projectile.position.X - Main.projectile[num624].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num624].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num624].position.X) { projectile.velocity.X = projectile.velocity.X - num623; } else { projectile.velocity.X = projectile.velocity.X + num623; } if (projectile.position.Y < Main.projectile[num624].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num623; } else { projectile.velocity.Y = projectile.velocity.Y + num623; } } } Lighting.AddLight(projectile.Center, 0.8f, 0.3f, 0.1f); bool flag23 = false; if (projectile.ai[0] >= 3f && projectile.ai[0] <= 5f) { int num625 = 2; flag23 = true; projectile.velocity *= 0.9f; projectile.ai[1] += 1f; int num626 = (int)projectile.ai[1] / num625 + (int)(projectile.ai[0] - 3f) * 8; if (num626 < 4) { projectile.frame = 17 + num626; } else if (num626 < 5) { projectile.frame = 0; } else if (num626 < 8) { projectile.frame = 1 + num626 - 5; } else if (num626 < 11) { projectile.frame = 11 - num626; } else if (num626 < 12) { projectile.frame = 0; } else if (num626 < 16) { projectile.frame = num626 - 2; } else if (num626 < 20) { projectile.frame = 29 - num626; } else if (num626 < 21) { projectile.frame = 0; } else { projectile.frame = num626 - 4; } if (projectile.ai[1] > num625 * 8) { projectile.ai[0] -= 3f; projectile.ai[1] = 0f; } } if (projectile.ai[0] >= 6f && projectile.ai[0] <= 8f) { projectile.ai[1] += 1f; projectile.MaxUpdates = 2; if (projectile.ai[0] == 7f) { projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; } else { projectile.rotation += 0.5235988f; } int num627 = 0; switch ((int)projectile.ai[0]) { case 6: projectile.frame = 5; num627 = 40; break; case 7: projectile.frame = 13; num627 = 30; break; case 8: projectile.frame = 17; num627 = 30; break; } if (projectile.ai[1] > num627) { projectile.ai[1] = 1f; projectile.ai[0] -= 6f; projectile.localAI[0] += 1f; projectile.extraUpdates = 0; projectile.numUpdates = 0; projectile.netUpdate = true; } else { flag23 = true; } if (projectile.ai[0] == 8f) { for (int num628 = 0; num628 < 4; num628++) { int num629 = Utils.SelectRandom(Main.rand, new int[] { 226, 228, 75 }); int num630 = Dust.NewDust(projectile.Center, 0, 0, num629, 0f, 0f, 0); Dust dust2 = Main.dust[num630]; Vector2 value17 = Vector2.One.RotatedBy(num628 * 1.57079637f, default).RotatedBy(projectile.rotation, default); dust2.position = projectile.Center + value17 * 10f; dust2.velocity = value17 * 1f; dust2.scale = 0.6f + Main.rand.NextFloat() * 0.5f; dust2.noGravity = true; } } } if (flag23) { return; } Vector2 vector44 = projectile.position; bool flag24 = false; if (projectile.ai[0] < 9f) { projectile.tileCollide = true; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } NPC ownerMinionAttackTargetNPC3 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC3 != null && ownerMinionAttackTargetNPC3.CanBeChasedBy(this, false)) { float num631 = Vector2.Distance(ownerMinionAttackTargetNPC3.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector44) > num631 && num631 < num619) || !flag24) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC3.position, ownerMinionAttackTargetNPC3.width, ownerMinionAttackTargetNPC3.height)) { num619 = num631; vector44 = ownerMinionAttackTargetNPC3.Center; flag24 = true; } } if (!flag24) { for (int num632 = 0; num632 < 200; num632++) { NPC nPC2 = Main.npc[num632]; if (nPC2.CanBeChasedBy(this, false)) { float num633 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector44) > num633 && num633 < num619) || !flag24) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num619 = num633; vector44 = nPC2.Center; flag24 = true; } } } } float num634 = num620; if (flag24) { num634 = num621; } if (Vector2.Distance(player.Center, projectile.Center) > num634) { projectile.ai[0] += 3 * (3 - (int)(projectile.ai[0] / 3f)); projectile.tileCollide = false; projectile.netUpdate = true; } bool flag25 = projectile.ai[0] >= 9f; float num637 = 12f; if (flag25) { num637 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector46 = player.Center - center2 + new Vector2(0f, -60f); float num638 = vector46.Length(); if (num638 > 200f && num637 < 8f) { num637 = 8f; } if (num638 < num622 && flag25 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] -= 9f; projectile.netUpdate = true; } if (num638 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num638 > 70f) { vector46.Normalize(); vector46 *= num637; projectile.velocity = (projectile.velocity * 40f + vector46) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } if (projectile.ai[0] < 3f || projectile.ai[0] >= 9f) { projectile.rotation += projectile.velocity.X * 0.04f; } if (projectile.ai[1] > 0f) { projectile.ai[1] += 1f; int num644 = 10; if (projectile.ai[1] > num644) { projectile.ai[1] = 0f; projectile.netUpdate = true; } } else if (projectile.ai[0] < 3f) { int num647 = 0; switch ((int)projectile.ai[0]) { case 0: case 3: case 6: num647 = 400; break; case 1: case 4: case 7: num647 = 400; break; case 2: case 5: case 8: num647 = 600; break; } if (projectile.ai[1] == 0f && flag24 && num619 < num647) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { if (projectile.localAI[0] >= 3f) { projectile.ai[0] += 4f; if (projectile.ai[0] == 6f) { projectile.ai[0] = 3f; } projectile.localAI[0] = 0f; return; } projectile.ai[0] += 6f; Vector2 value21 = vector44 - projectile.Center; value21.Normalize(); float scaleFactor4 = (projectile.ai[0] == 8f) ? 12f : 10f; projectile.velocity = value21 * scaleFactor4; projectile.netUpdate = true; return; } } } projectile.frameCounter++; if (projectile.frameCounter >= 8) { projectile.frameCounter = 0; projectile.frame += 1; if (projectile.frame > 3) { projectile.frame = 0; } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.dead || !player.HasBuff(mod.BuffType("SagOrbiter"))) { projectile.Kill(); } if (modPlayer.SagOrbiter) { projectile.timeLeft = 2; player.AddBuff(mod.BuffType("SagOrbiter"), 2, true); } projectile.ai[0] = 30 * player.minionDamage; Vector2 vector46 = projectile.position; bool flag25 = false; float num633 = 700f; int Height = 0; int Width = 0; if (player.HasMinionAttackTargetNPC) { NPC nPC2 = Main.npc[player.MinionAttackTargetNPC]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { vector46 = nPC2.position; flag25 = true; Height = nPC2.height; Width = nPC2.width; } } } else { for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.position; flag25 = true; Height = nPC2.height; Width = nPC2.width; } } } } if (flag25) { int id = BaseAI.ShootPeriodic(projectile, vector46, Width, Height, Terraria.ModLoader.ModContent.ProjectileType <Darkray>(), ref projectile.ai[1], 120, (int)projectile.ai[0], 11, true); Main.projectile[id].ranged = false; Main.projectile[id].minion = true; } if (projectile.active) { SetRot(); } BaseAI.AIRotate(projectile, ref projectile.rotation, ref rot, player.Center, true, 80f, 20f, 0.07f, true); }
public override void OnChatButtonClicked(bool firstButton, ref bool shop) { Player player = Main.LocalPlayer; AAPlayer p = player.GetModPlayer <AAPlayer>(); if (firstButton) { shop = true; } if (!firstButton) { Main.PlaySound(12, -1, -1, 1); int Mushman = NPC.FindFirstNPC(mod.NPCType("Mushman")); int Item1 = player.FindItem(ModContent.ItemType <Items.Materials.TerraShard>()); int Item2 = player.FindItem(ModContent.ItemType <Items.Materials.DragonScale>()); int Item3 = player.FindItem(ModContent.ItemType <Items.Materials.MirePod>()); int Item4 = player.FindItem(ItemID.RottenChunk); int Item5 = player.FindItem(ItemID.Vertebrae); int Item6 = player.FindItem(ItemID.PixieDust); int Item7 = player.FindItem(ModContent.ItemType <Items.Materials.DoomiteScrap>()); int Item8 = player.FindItem(ItemID.JungleSpores); int Item9 = player.FindItem(ModContent.ItemType <Items.Boss.MushroomMonarch.Mushium>()); int Item10 = player.FindItem(ModContent.ItemType <Items.Boss.MushroomMonarch.GlowingMushium>()); int Item11 = player.FindItem(ItemID.Stinger); int Item12 = player.FindItem(ItemID.IceMachine); int Item13 = player.FindItem(ItemID.Bunny); if (Item1 >= 0 && AAWorld.squid1 < 5) //Item 1: 3 Blueberries { Main.npcChatCornerItem = ModContent.ItemType <Items.Materials.TerraShard>(); player.inventory[Item1].stack--; if (player.inventory[Item1].stack <= 0) { player.inventory[Item1] = new Item(); } if (AAWorld.squid1 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("PurityFlaskChat"); player.QuickSpawnItem(mod.ItemType("PurityFlask"), 5); Main.npcChatCornerItem = mod.ItemType("PurityFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)1); } AAWorld.squid1++; Main.PlaySound(24, -1, -1, 1); } else if (Item2 >= 0 && AAWorld.squid2 < 5) //Item 2: 3 Teal Mushrooms { Main.npcChatCornerItem = ModContent.ItemType <Items.Materials.DragonScale>(); player.inventory[Item2].stack--; if (player.inventory[Item2].stack <= 0) { player.inventory[Item2] = new Item(); } if (AAWorld.squid2 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("AshJarChat"); player.QuickSpawnItem(mod.ItemType("AshJar"), 5); Main.npcChatCornerItem = mod.ItemType("AshJar"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)2); } AAWorld.squid2++; Main.PlaySound(24, -1, -1, 1); } else if (Item3 >= 0 && AAWorld.squid3 < 5) { Main.npcChatCornerItem = ModContent.ItemType <Items.Materials.MirePod>(); player.inventory[Item3].stack--; if (player.inventory[Item3].stack <= 0) { player.inventory[Item3] = new Item(); } if (AAWorld.squid3 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("DarkwaterFlaskChat"); player.QuickSpawnItem(mod.ItemType("DarkwaterFlask"), 5); Main.npcChatCornerItem = mod.ItemType("DarkwaterFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)3); } AAWorld.squid3++; Main.PlaySound(24, -1, -1, 1); } else if (Item4 >= 0 && AAWorld.squid4 < 5) { Main.npcChatCornerItem = ItemID.RottenChunk; player.inventory[Item4].stack--; if (player.inventory[Item4].stack <= 0) { player.inventory[Item4] = new Item(); } if (AAWorld.squid4 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("CorruptionFlaskChat"); player.QuickSpawnItem(mod.ItemType("CorruptionFlask"), 5); Main.npcChatCornerItem = mod.ItemType("CorruptionFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)4); } AAWorld.squid4++; Main.PlaySound(24, -1, -1, 1); } else if (Item5 >= 0 && AAWorld.squid5 < 5) { Main.npcChatCornerItem = ItemID.Vertebrae; player.inventory[Item5].stack--; if (player.inventory[Item5].stack <= 0) { player.inventory[Item5] = new Item(); } if (AAWorld.squid5 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("CrimsonFlaskChat"); player.QuickSpawnItem(mod.ItemType("CrimsonFlask"), 5); Main.npcChatCornerItem = mod.ItemType("CrimsonFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)5); } AAWorld.squid5++; Main.PlaySound(24, -1, -1, 1); } else if (Item6 >= 0 && AAWorld.squid6 < 5) { Main.npcChatCornerItem = ItemID.PixieDust; player.inventory[Item6].stack--; if (player.inventory[Item6].stack <= 0) { player.inventory[Item6] = new Item(); } if (AAWorld.squid6 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("MeanGreenStewChat"); player.QuickSpawnItem(mod.ItemType("MeanGreenStew"), 5); Main.npcChatCornerItem = mod.ItemType("MeanGreenStew"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)6); } AAWorld.squid6++; Main.PlaySound(24, -1, -1, 1); } else if (Item7 >= 0 && AAWorld.squid7 < 5) { Main.npcChatCornerItem = ModContent.ItemType <Items.Materials.DoomiteScrap>(); player.inventory[Item7].stack--; if (player.inventory[Item7].stack <= 0) { player.inventory[Item7] = new Item(); } if (AAWorld.squid7 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("VoidFlaskChat"); player.QuickSpawnItem(mod.ItemType("VoidFlask"), 5); Main.npcChatCornerItem = mod.ItemType("Z"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)7); } AAWorld.squid7++; Main.PlaySound(24, -1, -1, 1); } else if (Item8 >= 0 && AAWorld.squid8 < 5) { Main.npcChatCornerItem = ItemID.JungleSpores; player.inventory[Item8].stack--; if (player.inventory[Item8].stack <= 0) { player.inventory[Item8] = new Item(); } if (AAWorld.squid8 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("FungicideChat"); player.QuickSpawnItem(mod.ItemType("Fungicide"), 5); Main.npcChatCornerItem = mod.ItemType("Fungicide"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)8); } AAWorld.squid8++; Main.PlaySound(24, -1, -1, 1); } else if (Item9 >= 0 && AAWorld.squid9 < 5 && Mushman >= 0) { Main.npcChatCornerItem = ModContent.ItemType <Items.Boss.MushroomMonarch.Mushium>(); player.inventory[Item9].stack--; if (player.inventory[Item9].stack <= 0) { player.inventory[Item9] = new Item(); } if (AAWorld.squid9 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("SporeSacChat1") + Main.npc[Mushman].GivenName + Lang.TownNPCLovecraftian("SporeSacChat2"); player.QuickSpawnItem(mod.ItemType("SporeSac"), 5); Main.npcChatCornerItem = mod.ItemType("SporeSac"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)9); } AAWorld.squid9++; Main.PlaySound(24, -1, -1, 1); } else if (Item10 >= 0 && AAWorld.squid10 < 5 && Mushman >= 0) { Main.npcChatCornerItem = ModContent.ItemType <Items.Boss.MushroomMonarch.GlowingMushium>(); player.inventory[Item10].stack--; if (player.inventory[Item10].stack <= 0) { player.inventory[Item10] = new Item(); } if (AAWorld.squid10 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("GlowingSporeSacChat1") + Main.npc[Mushman].GivenName + Lang.TownNPCLovecraftian("GlowingSporeSacChat2"); player.QuickSpawnItem(mod.ItemType("GlowingSporeSac"), 5); Main.npcChatCornerItem = mod.ItemType("GlowingSporeSac"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)10); } AAWorld.squid10++; Main.PlaySound(24, -1, -1, 1); } else if (Item11 >= 0 && AAWorld.squid11 < 5) { Main.npcChatCornerItem = ItemID.Stinger; player.inventory[Item11].stack--; if (player.inventory[Item11].stack <= 0) { player.inventory[Item11] = new Item(); } if (AAWorld.squid11 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("JungleFlaskChat"); player.QuickSpawnItem(mod.ItemType("JungleFlask"), 5); Main.npcChatCornerItem = mod.ItemType("JungleFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)11); } AAWorld.squid11++; Main.PlaySound(24, -1, -1, 1); } else if (Item12 >= 0 && AAWorld.squid12 < 1) { Main.npcChatCornerItem = ItemID.IceMachine; player.inventory[Item12].stack--; if (player.inventory[Item12].stack <= 0) { player.inventory[Item12] = new Item(); } if (AAWorld.squid12 == 0) { Main.npcChatText = Lang.TownNPCLovecraftian("IceFlaskChat"); player.QuickSpawnItem(mod.ItemType("IceFlask"), 3); player.QuickSpawnItem(mod.ItemType("IcemeltFlask"), 3); Main.npcChatCornerItem = mod.ItemType("IceFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)12); } AAWorld.squid12++; Main.PlaySound(24, -1, -1, 1); } else if (Item13 >= 0 && AAWorld.squid13 < 5) { Main.npcChatCornerItem = ItemID.Bunny; player.inventory[Item13].stack--; if (player.inventory[Item13].stack <= 0) { player.inventory[Item13] = new Item(); } if (AAWorld.squid13 == 4) { Main.npcChatText = Lang.TownNPCLovecraftian("ForestFlaskChat"); player.QuickSpawnItem(mod.ItemType("ForestFlask"), 5); Main.npcChatCornerItem = mod.ItemType("ForestFlask"); } if (Main.netMode == NetmodeID.MultiplayerClient) { AANet.SendNetMessage(AANet.UpdateLovecraftianCount, (byte)13); } AAWorld.squid13++; Main.PlaySound(24, -1, -1, 1); } else { if (!BaseMod.BasePlayer.HasItem(player, ModContent.ItemType <Items.Flasks.SquidList>())) { Main.npcChatText = Lang.TownNPCLovecraftian("SquidListChat"); int itemID = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, mod.ItemType("SquidList"), 1, false, 0, false, false); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendData(21, -1, -1, null, itemID, 1f, 0f, 0f, 0, 0, 0); } } else { Main.npcChatText = Lang.TownNPCLovecraftian("NothingChat"); } Main.npcChatCornerItem = 0; Main.PlaySound(12, -1, -1, 1); } } }
public override void AI() { if (Main.expertMode) { damage = npc.damage / 4; } else { damage = npc.damage / 2; } npc.noGravity = true; npc.TargetClosest(true); Player player = Main.player[npc.target]; AAPlayer modplayer = player.GetModPlayer <AAPlayer>(); RingRoatation += .05f; npc.ai[1]++; if (internalAI[3] > 0) { internalAI[3]--; } if (Main.player[npc.target].dead && Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f) { npc.TargetClosest(true); if (Main.player[npc.target].dead) { if (internalAI[0] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("SagittariusFree1"), Color.PaleVioletRed); } internalAI[0] = 1f; } } if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f) { if (internalAI[0] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("SagittariusFree2"), Color.PaleVioletRed); } internalAI[0] = 1f; } } } if (internalAI[0] == 1f) { npc.TargetClosest(true); npc.velocity *= .7f; npc.alpha += 5; if (npc.alpha >= 255) { npc.active = false; } 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.TargetClosest(true); internalAI[0] = 0f; } } else { npc.TargetClosest(true); if (npc.alpha > 0) { npc.alpha -= 10; } if (npc.alpha <= 0) { npc.alpha = 0; } } internalAI[1]++; if (internalAI[2] == 2) { npc.dontTakeDamage = true; } else { npc.dontTakeDamage = false; } if (internalAI[1] >= 300) { internalAI[1] = 0; internalAI[2] = internalAI[3] <= 0 ? Main.rand.Next(3) : Main.rand.Next(2); internalAI[4] = Main.rand.Next(2); if (internalAI[2] == 2) { CombatText.NewText(npc.Hitbox, Color.PaleVioletRed, Lang.BossChat("SagittariusFree3")); } npc.ai = new float[4]; npc.netUpdate = true; } if (internalAI[2] == 1) { BaseAI.AIEater(npc, ref npc.ai, 0.05f, 4f, 0, false, true); npc.rotation = 0; BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, mod.ProjType("SagProj"), ref shootAI[0], 15, damage, 10f, true, new Vector2(20f, 15f)); } else if (internalAI[2] == 2) //Shield Mode { ShieldScale += .02f; if (ShieldScale >= 1f) { ShieldScale = 1f; } internalAI[3] = 1200; npc.life += 2; CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), CombatText.HealLife, string.Concat(2), false, false); BaseAI.AISpaceOctopus(npc, ref npc.ai, Main.player[npc.target].Center, 0.07f, 5f, 250f, 70f, ShootLaser); } else { BaseAI.AIEye(npc, ref npc.ai, false, true, .3f, .3f, 4, 4, 0, 0); npc.rotation = 0; } if (internalAI[2] != 2f) { ShieldScale -= .02f; if (ShieldScale <= 0f) { ShieldScale = 0f; } } bool foundLocation = false; if (internalAI[4] == 1) { npc.alpha += 5; int Xint = Main.rand.Next(-500, 500); int Yint = Main.rand.Next(-500, 500); if (npc.alpha >= 255) { npc.alpha = 255; if ((Xint < -100 || Xint > 100) && (Yint < -90 || Yint > 90)) { foundLocation = true; } } if (foundLocation) { Vector2 tele = new Vector2(player.Center.X + Xint, player.Center.Y + Yint); npc.Center = tele; internalAI[4] = 0; } } else { npc.alpha -= 3; if (npc.alpha <= 0) { npc.alpha = 0; } } npc.noTileCollide = true; }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } if (player.dead) { modPlayer.SnakeMinion = false; } if (modPlayer.SnakeMinion) { projectile.timeLeft = 2; } int num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; num1052 = Main.projectile[byUUID].rotation; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("SerpentHead")) { Main.projectile[byUUID].localAI[1] = projectile.whoAmI; } if (projectile.owner == player.whoAmI && Main.projectile[byUUID].type == mod.ProjectileType("SerpentHead")) { Main.projectile[byUUID].Kill(); projectile.Kill(); return; } } if (!flag67) { return; } if (projectile.alpha > 0) { for (int num1054 = 0; num1054 < 2; num1054++) { int num1055 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f);
public override void AI() { Lighting.AddLight((int)(projectile.position.X + projectile.width / 2) / 16, (int)(projectile.position.Y + projectile.height / 2) / 16, 1f, 0.95f, 0.8f); bool flag64 = projectile.type == mod.ProjectileType("ChaosRune"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("CCRune"), 3600); if (!modPlayer.CCBookEX) { projectile.active = false; return; } if (flag64) { if (player.dead) { modPlayer.CCRune = false; } if (modPlayer.CCRune || modPlayer.CCBookEX) { projectile.timeLeft = 2; } } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("ChaosRune"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (projectile.ai[0] == 2f) { projectile.ai[1] += 1f; projectile.extraUpdates = 1; projectile.rotation = projectile.velocity.ToRotation() + 1.57f; if (projectile.ai[1] > 40f) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = 0; projectile.numUpdates = 0; projectile.netUpdate = true; } else { flag24 = true; } } if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC nPC2 = Main.npc[player.MinionAttackTargetNPC]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } else { for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 40f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { if (projectile.ai[1] == 0f && flag25 && num633 < 500f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { projectile.ai[0] = 2f; Vector2 value20 = vector46 - projectile.Center; value20.Normalize(); projectile.velocity = value20 * 8f; projectile.netUpdate = true; return; } } } if (Counter++ > 30) { Counter = 0; } if (!Main.dayTime && flag25 && Counter == 0 && projectile.owner == Main.myPlayer) { Vector2 vector55 = (vector46 - projectile.Center) * -1f; vector55.Normalize(); vector55 *= Main.rand.Next(45, 65) * 0.1f; vector55 = vector55.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); int id = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector55.X, vector55.Y, mod.ProjectileType("FlairdraCyclone"), projectile.damage, projectile.knockBack, projectile.owner, -10f, 0f); Main.projectile[id].melee = false; Main.projectile[id].minion = true; } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } if (player.dead) { modPlayer.SnakeMinion = false; } if (modPlayer.SnakeMinion) { projectile.timeLeft = 2; } int num1038 = 30; Vector2 center = player.Center; float num1040 = 700f; float num1041 = 1000f; int num1042 = -1; if (projectile.Distance(center) > 2000f) { projectile.Center = center; projectile.netUpdate = true; } bool flag66 = true; if (flag66) { NPC ownerMinionAttackTargetNPC5 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC5 != null && ownerMinionAttackTargetNPC5.CanBeChasedBy(projectile, false)) { float num1043 = projectile.Distance(ownerMinionAttackTargetNPC5.Center); if (num1043 < num1040 * 2f) { num1042 = ownerMinionAttackTargetNPC5.whoAmI; } } if (num1042 < 0) { for (int num1044 = 0; num1044 < 200; num1044++) { NPC nPC13 = Main.npc[num1044]; if (nPC13.CanBeChasedBy(projectile, false) && player.Distance(nPC13.Center) < num1041) { float num1045 = projectile.Distance(nPC13.Center); if (num1045 < num1040) { num1042 = num1044; } } } } } if (num1042 != -1) { NPC nPC14 = Main.npc[num1042]; Vector2 vector132 = nPC14.Center - projectile.Center; (vector132.X > 0f).ToDirectionInt(); (vector132.Y > 0f).ToDirectionInt(); float scaleFactor15 = 0.4f; if (vector132.Length() < 600f) { scaleFactor15 = 0.6f; } if (vector132.Length() < 300f) { scaleFactor15 = 0.8f; } if (vector132.Length() > nPC14.Size.Length() * 0.75f) { projectile.velocity += Vector2.Normalize(vector132) * scaleFactor15 * 1.5f; if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) { projectile.velocity *= 0.8f; } } float num1046 = 30f; if (projectile.velocity.Length() > num1046) { projectile.velocity = Vector2.Normalize(projectile.velocity) * num1046; } } else { float num1047 = 0.2f; Vector2 vector133 = center - projectile.Center; if (vector133.Length() < 200f) { num1047 = 0.12f; } if (vector133.Length() < 140f) { num1047 = 0.06f; } if (vector133.Length() > 100f) { if (Math.Abs(center.X - projectile.Center.X) > 20f) { projectile.velocity.X = projectile.velocity.X + num1047 * Math.Sign(center.X - projectile.Center.X); } if (Math.Abs(center.Y - projectile.Center.Y) > 10f) { projectile.velocity.Y = projectile.velocity.Y + num1047 * Math.Sign(center.Y - projectile.Center.Y); } } else if (projectile.velocity.Length() > 2f) { projectile.velocity *= 0.96f; } if (Math.Abs(projectile.velocity.Y) < 1f) { projectile.velocity.Y = projectile.velocity.Y - 0.1f; } float num1048 = 15f; if (projectile.velocity.Length() > num1048) { projectile.velocity = Vector2.Normalize(projectile.velocity) * num1048; } } projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; int direction = projectile.direction; projectile.direction = projectile.spriteDirection = projectile.velocity.X > 0f ? 1 : -1; if (direction != projectile.direction) { projectile.netUpdate = true; } float num1049 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); projectile.position = projectile.Center; projectile.scale = 1f + num1049 * 0.01f; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (projectile.alpha > 0) { projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } } float DamageBoost = Main.player[projectile.owner].minionDamage + Main.player[projectile.owner].allDamage - 1f; projectile.damage = (int)(DamageBoost > 0f? (projectile.localAI[0] * 3 * DamageBoost) : 1); }
public override void AI() { projectile.frameCounter++; if (projectile.frameCounter >= 8) { projectile.frameCounter = 0; projectile.frame += 1; } if (projectile.frame > 4) { projectile.frame = 0; } Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.dead) { modPlayer.TrueHallowedPrism = false; } if (modPlayer.TrueHallowedPrism) { projectile.timeLeft = 2; } dust--; if (dust >= 0) { int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, ModContent.DustType <Dusts.InfinityOverloadB>(), 0f, 0f, 0, AAColor.Hallow, 1f); Main.dust[num503].velocity *= 2f; } } projectile.frameCounter++; if (projectile.frameCounter > 8) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 4) { projectile.frame = 0; } float num = Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); projectile.rotation = projectile.velocity.X * 0.04f; if (Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; } float num633 = 700f; float num634 = 800f; float num635 = 1200f; float num636 = 150f; float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("TrueHallowedPrism"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - num637; } else { projectile.velocity.X = projectile.velocity.X + num637; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - num637; } else { projectile.velocity.Y = projectile.velocity.Y + num637; } } } bool flag24 = false; if (projectile.ai[0] == 2f) { projectile.ai[1] += 1f; projectile.extraUpdates = 1; if (projectile.ai[1] > 40f) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = 0; projectile.numUpdates = 0; projectile.netUpdate = true; } else { flag24 = true; } } if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } if (player.HasMinionAttackTargetNPC) { NPC nPC2 = Main.npc[player.MinionAttackTargetNPC]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } else { for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) { float num646 = Vector2.Distance(nPC2.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } } float num647 = num634; if (flag25) { num647 = num635; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 8f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 5f; //6 if (flag26) { num650 = 12f; //15 } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 float num651 = vector48.Length(); if (num651 > 200f && num650 < 6.5f) //200 and 8 { num650 = 6.5f; //8 } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.2f; projectile.velocity.Y = -0.1f; } } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 80f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { float scaleFactor3 = 24f; int num658 = ModContent.ProjectileType <TruePrismshot>(); if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) { Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 300; projectile.netUpdate = true; } } } }
public override void AI() { npc.noGravity = true; npc.TargetClosest(true); Player player = Main.player[npc.target]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.Center.X > npc.Center.X) { npc.direction = -1; } else { npc.direction = 1; } if (internalAI[0] == 0) { if (Main.netMode != 1) { for (int m = 0; m < ProbeCount; m++) { int npcID = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SagittariusOrbiter"), 0); Main.npc[npcID].Center = npc.Center; Main.npc[npcID].velocity = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble())); Main.npc[npcID].velocity *= 8f; Main.npc[npcID].ai[0] = m; Main.npc[npcID].netUpdate2 = true; Main.npc[npcID].netUpdate = true; } } internalAI[0] = 1; } if (MovementType[0] == 0) { internalAI[6]++; MovementType[1] -= 5; if (MovementType[1] <= 0) { MovementType[1] = 0; } if (internalAI[6] > 200) { internalAI[6] = 0f; MovementType[0] = Main.rand.Next(3); npc.netUpdate = true; } } if (MovementType[0] == 1) { internalAI[6]++; if (internalAI[6] > 240) { internalAI[6] = 0; MovementType[0] = 5; npc.netUpdate = true; } } if (MovementType[0] == 2) { MovementType[1] += 5; if (MovementType[1] >= 255) { MovementType[0] = 3; npc.netUpdate = true; } } if (MovementType[0] == 3) { MovementType[1] -= 5; if (MovementType[1] <= 0) { MovementType[1] = 0; } internalAI[6]++; if (internalAI[6] > 360) { internalAI[6] = 0; MovementType[0] = 5; npc.netUpdate = true; } } else if (MovementType[0] == 4 || MovementType[0] == 5) { MovementType[1] += 5; if (MovementType[1] >= 255) { MovementType[0] = 0; npc.netUpdate = true; } } if (internalAI[4] < 60) { internalAI[4]++; } if (!NPC.AnyNPCs(ModContent.NPCType <SagittariusOrbiter>()) && internalAI[4] >= 60) { npc.Transform(ModContent.NPCType <SagittariusFree>()); } if (internalAI[3] == 1f) { npc.TargetClosest(true); npc.velocity *= .7f; npc.alpha += 5; if (npc.alpha >= 255) { npc.active = false; } 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.TargetClosest(true); } return; } else { npc.TargetClosest(true); if (npc.alpha > 0) { npc.alpha -= 10; } if (npc.alpha <= 0) { npc.alpha = 0; } } if (Main.player[npc.target].dead) { npc.TargetClosest(true); if (Main.player[npc.target].dead) { if (internalAI[3] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Sagittarius1"), Color.PaleVioletRed); } internalAI[3] = 1f; } } } else if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f || !modPlayer.ZoneVoid) { npc.TargetClosest(true); if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 5000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 5000f) { if (internalAI[3] != 1f) { if (Main.netMode != 1) { BaseUtility.Chat(Lang.BossChat("Sagittarius2"), Color.PaleVioletRed); } internalAI[3] = 1f; } } } npc.ai[1]++; if (npc.ai[1] >= 300) { internalAI[1] = 0; internalAI[2] = Main.rand.Next(3); npc.ai = new float[4]; npc.netUpdate = true; } if (internalAI[2] == 1) //Chaase down the target { BaseAI.AIElemental(npc, ref npc.ai, null, 120, false, false, 10, 10, 10, 2.5f); } else //Hover over target { BaseAI.AISpaceOctopus(npc, ref npc.ai, Main.player[npc.target].Center, 0.3f, 10f, 250f, 70f, null); } npc.rotation = 0; npc.noTileCollide = true; }
public override void AI() { bool flag64 = projectile.type == mod.ProjectileType("SoccMinion"); Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); player.AddBuff(mod.BuffType("Socc"), 3600); if (flag64) { if (player.dead) { modPlayer.Socc = false; } if (modPlayer.Socc) { projectile.timeLeft = 2; } } float num633 = 700f; float num634 = 800f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = Main.projectile[num638].type == mod.ProjectileType("SoccMinion"); if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width) { if (projectile.position.X < Main.projectile[num638].position.X) { projectile.velocity.X = projectile.velocity.X - 0.02f; } else { projectile.velocity.X = projectile.velocity.X + 0.02f; } if (projectile.position.Y < Main.projectile[num638].position.Y) { projectile.velocity.Y = projectile.velocity.Y - 0.02f; } else { projectile.velocity.Y = projectile.velocity.Y + 0.02f; } } } bool flag24 = false; if (flag24) { return; } Vector2 vector46 = projectile.position; bool flag25 = false; if (projectile.ai[0] != 1f) { projectile.tileCollide = false; } if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) { projectile.tileCollide = false; } bool AttackFrame = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; AttackFrame = true; if (Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = Vector2.Distance(projectile.Center, vector46); vector46 = npc.Center; flag25 = true; } } else { for (int k = 0; k < 200; k++) { NPC npc = Main.npc[k]; if (npc.CanBeChasedBy(this, false)) { AttackFrame = true; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((num646 < num633 || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; vector46 = npc.Center; flag25 = true; } } } } float num647 = num634; if (flag25) { num647 = 1200f; } if (Vector2.Distance(player.Center, projectile.Center) > num647) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } if (flag25 && projectile.ai[0] == 0f) { Vector2 vector47 = vector46 - projectile.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = projectile.ai[0] == 1f; } float num650 = 6f; if (flag26) { num650 = 15f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < 150f && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } if (num651 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2; projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2; projectile.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } } projectile.rotation = projectile.velocity.X * 0.04f; if (Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = projectile.direction; } if (projectile.ai[1] > 0f) { projectile.ai[1] += Main.rand.Next(1, 4); } if (projectile.ai[1] > 20) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) { Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= 9f; int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, 449, projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); Main.projectile[proj].extraUpdates = 1; Main.projectile[proj].hostile = false; Main.projectile[proj].friendly = true; Main.projectile[proj].magic = false; Main.projectile[proj].minion = true; Main.projectile[proj].netUpdate = true; projectile.netUpdate = true; } } } if (!AttackFrame) { if (projectile.frameCounter++ >= 10) { projectile.frameCounter = 0; if (++projectile.frame > 5) { projectile.frame = 0; } } } else { if (projectile.frameCounter++ >= 5) { projectile.frameCounter = 0; if (projectile.frame < 6 || projectile.frame > 10) { projectile.frame = 6; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (!player.active) { projectile.active = false; return; } bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = true; if (projectile.lavaWet) { projectile.ai[0] = 1f; projectile.ai[1] = 0f; } if (player.dead) { modPlayer.DapperSquirrel = false; } if (modPlayer.DapperSquirrel) { projectile.timeLeft = Main.rand.Next(2, 10); } int num = 10; int num2 = 40 * (projectile.minionPos + 1) * player.direction; if (player.position.X + player.width / 2 < projectile.position.X + projectile.width / 2 - num + num2) { flag = true; } else if (player.position.X + player.width / 2 > projectile.position.X + projectile.width / 2 + num + num2) { flag2 = true; } else if (player.position.X + player.width / 2 < projectile.position.X + projectile.width / 2 - num) { flag = true; } else if (player.position.X + player.width / 2 > projectile.position.X + projectile.width / 2 + num) { flag2 = true; } if (projectile.ai[1] == 0f) { projectile.tileCollide = true; int num36 = 500; num36 += 40 * projectile.minionPos; if (projectile.localAI[0] > 0f) { num36 += 500; } if (player.rocketDelay2 > 0) { projectile.ai[0] = 1f; } Vector2 vector6 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num37 = player.position.X + player.width / 2 - vector6.X; float num38 = player.position.Y + player.height / 2 - vector6.Y; float num39 = (float)Math.Sqrt(num37 * num37 + num38 * num38); if (num39 > 2000f) { projectile.position.X = player.position.X + player.width / 2 - projectile.width / 2; projectile.position.Y = player.position.Y + player.height / 2 - projectile.height / 2; } else if (num39 > num36 || (Math.Abs(num38) > 300f && (projectile.localAI[0] <= 0f))) { if (num38 > 0f && projectile.velocity.Y < 0f) { projectile.velocity.Y = 0f; } if (num38 < 0f && projectile.velocity.Y > 0f) { projectile.velocity.Y = 0f; } projectile.ai[0] = 1f; } } if (projectile.ai[0] != 0f) { int num41 = 100; projectile.tileCollide = false; Vector2 vector7 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num42 = player.position.X + player.width / 2 - vector7.X; num42 -= 40 * player.direction; float num43 = 700f; if (flag5) { num43 += 100f; } bool flag6 = false; int num44 = -1; for (int j = 0; j < 200; j++) { if (Main.npc[j].CanBeChasedBy(this, false)) { float num45 = Main.npc[j].position.X + Main.npc[j].width / 2; float num46 = Main.npc[j].position.Y + Main.npc[j].height / 2; float num47 = Math.Abs(player.position.X + player.width / 2 - num45) + Math.Abs(player.position.Y + player.height / 2 - num46); if (num47 < num43) { if (Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height)) { num44 = j; } flag6 = true; break; } } } if (!flag6) { num42 -= 40 * projectile.minionPos * player.direction; } if (flag6 && num44 >= 0) { projectile.ai[0] = 0f; } float num48 = player.position.Y + player.height / 2 - vector7.Y; float num49 = (float)Math.Sqrt(num42 * num42 + num48 * num48); float num40 = 0.4f; float num50 = 12f; if (num50 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) { num50 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); } if (num49 < num41 && player.velocity.Y == 0f && projectile.position.Y + projectile.height <= player.position.Y + player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; if (projectile.velocity.Y < -6f) { projectile.velocity.Y = -6f; } } if (num49 < 60f) { num42 = projectile.velocity.X; num48 = projectile.velocity.Y; } else { num49 = num50 / num49; num42 *= num49; num48 *= num49; } if (projectile.velocity.X < num42) { projectile.velocity.X = projectile.velocity.X + num40; if (projectile.velocity.X < 0f) { projectile.velocity.X = projectile.velocity.X + num40 * 1.5f; } } if (projectile.velocity.X > num42) { projectile.velocity.X = projectile.velocity.X - num40; if (projectile.velocity.X > 0f) { projectile.velocity.X = projectile.velocity.X - num40 * 1.5f; } } if (projectile.velocity.Y < num48) { projectile.velocity.Y = projectile.velocity.Y + num40; if (projectile.velocity.Y < 0f) { projectile.velocity.Y = projectile.velocity.Y + num40 * 1.5f; } } if (projectile.velocity.Y > num48) { projectile.velocity.Y = projectile.velocity.Y - num40; if (projectile.velocity.Y > 0f) { projectile.velocity.Y = projectile.velocity.Y - num40 * 1.5f; } } if (projectile.frame < 12) { projectile.frame = Main.rand.Next(12, 18); projectile.frameCounter = 0; } if (projectile.velocity.X > 0.5) { projectile.spriteDirection = -1; } else if (projectile.velocity.X < -0.5) { projectile.spriteDirection = 1; } if (projectile.spriteDirection == -1) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } else { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 3.14f; } return; } else { float num57 = 40 * projectile.minionPos; int num58 = 30; int num59 = 60; projectile.localAI[0] -= 1f; if (projectile.localAI[0] < 0f) { projectile.localAI[0] = 0f; } if (projectile.ai[1] > 0f) { projectile.ai[1] -= 1f; } else { float num60 = projectile.position.X; float num61 = projectile.position.Y; float num62 = 100000f; float num63 = num62; int num64 = -1; NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this, false)) { float num65 = ownerMinionAttackTargetNPC.position.X + ownerMinionAttackTargetNPC.width / 2; float num66 = ownerMinionAttackTargetNPC.position.Y + ownerMinionAttackTargetNPC.height / 2; float num67 = Math.Abs(projectile.position.X + projectile.width / 2 - num65) + Math.Abs(projectile.position.Y + projectile.height / 2 - num66); if (num67 < num62) { if (num64 == -1 && num67 <= num63) { num63 = num67; num60 = num65; num61 = num66; } if (Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) { num62 = num67; num60 = num65; num61 = num66; num64 = ownerMinionAttackTargetNPC.whoAmI; } } } if (num64 == -1) { for (int l = 0; l < 200; l++) { if (Main.npc[l].CanBeChasedBy(this, false)) { float num68 = Main.npc[l].position.X + Main.npc[l].width / 2; float num69 = Main.npc[l].position.Y + Main.npc[l].height / 2; float num70 = Math.Abs(projectile.position.X + projectile.width / 2 - num68) + Math.Abs(projectile.position.Y + projectile.height / 2 - num69); if (num70 < num62) { if (num64 == -1 && num70 <= num63) { num63 = num70; num60 = num68; num61 = num69; } if (Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[l].position, Main.npc[l].width, Main.npc[l].height)) { num62 = num70; num60 = num68; num61 = num69; num64 = l; } } } } } if (num64 == -1 && num63 < num62) { num62 = num63; } float num71 = 400f; if (projectile.position.Y > Main.worldSurface * 16.0) { num71 = 200f; } if (num62 < num71 + num57 && num64 == -1) { float num72 = num60 - (projectile.position.X + projectile.width / 2); if (num72 < -5f) { flag = true; flag2 = false; } else if (num72 > 5f) { flag2 = true; flag = false; } } else if (num64 >= 0 && num62 < 800f + num57) { projectile.localAI[0] = num59; float num73 = num60 - (projectile.position.X + projectile.width / 2); if (num73 > 300f || num73 < -300f) { if (num73 < -50f) { flag = true; flag2 = false; } else if (num73 > 50f) { flag2 = true; flag = false; } } else if (projectile.owner == Main.myPlayer) { projectile.ai[1] = num58; float num74 = 12f; Vector2 vector8 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height / 2 - 8f); float num75 = num60 - vector8.X + Main.rand.Next(-20, 21); float num76 = Math.Abs(num75) * 0.1f; num76 = num76 * Main.rand.Next(0, 100) * 0.001f; float num77 = num61 - vector8.Y + Main.rand.Next(-20, 21) - num76; float num78 = (float)Math.Sqrt(num75 * num75 + num77 * num77); num78 = num74 / num78; num75 *= num78; num77 *= num78; int num79 = projectile.damage; int num80 = ModContent.ProjectileType <FezShot>(); int num81 = Projectile.NewProjectile(vector8.X, vector8.Y, num75 * 2, num77 * 2, num80, num79, projectile.knockBack, Main.myPlayer, 0f, num64); Main.projectile[num81].timeLeft = 300; if (num75 < 0f) { projectile.direction = -1; } if (num75 > 0f) { projectile.direction = 1; } projectile.netUpdate = true; } } } if (projectile.localAI[0] == 0f) { projectile.direction = player.direction; } projectile.rotation = 0f; float num104 = 6f; float num103 = 0.2f; if (num104 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) { num104 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); num103 = 0.3f; } if (flag) { if (projectile.velocity.X > -3.5) { projectile.velocity.X = projectile.velocity.X - num103; } else { projectile.velocity.X = projectile.velocity.X - num103 * 0.25f; } } else if (flag2) { if (projectile.velocity.X < 3.5) { projectile.velocity.X = projectile.velocity.X + num103; } else { projectile.velocity.X = projectile.velocity.X + num103 * 0.25f; } } else { projectile.velocity.X = projectile.velocity.X * 0.9f; if (projectile.velocity.X >= -num103 && projectile.velocity.X <= num103) { projectile.velocity.X = 0f; } } if (flag || flag2) { int num105 = (int)(projectile.position.X + projectile.width / 2) / 16; int j2 = (int)(projectile.position.Y + projectile.height / 2) / 16; if (flag) { num105--; } if (flag2) { num105++; } num105 += (int)projectile.velocity.X; if (WorldGen.SolidTile(num105, j2)) { flag4 = true; } } if (player.position.Y + player.height - 8f > projectile.position.Y + projectile.height) { flag3 = true; } Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); if (projectile.velocity.Y == 0f) { if (!flag3 && (projectile.velocity.X < 0f || projectile.velocity.X > 0f)) { int num106 = (int)(projectile.position.X + projectile.width / 2) / 16; int j3 = (int)(projectile.position.Y + projectile.height / 2) / 16 + 1; if (flag) { num106--; } if (flag2) { num106++; } WorldGen.SolidTile(num106, j3); } if (flag4) { int num107 = (int)(projectile.position.X + projectile.width / 2) / 16; int num108 = (int)(projectile.position.Y + projectile.height) / 16 + 1; if (WorldGen.SolidTile(num107, num108) || Main.tile[num107, num108].halfBrick() || Main.tile[num107, num108].slope() > 0) { try { num107 = (int)(projectile.position.X + projectile.width / 2) / 16; num108 = (int)(projectile.position.Y + projectile.height / 2) / 16; if (flag) { num107--; } if (flag2) { num107++; } num107 += (int)projectile.velocity.X; if (!WorldGen.SolidTile(num107, num108 - 1) && !WorldGen.SolidTile(num107, num108 - 2)) { projectile.velocity.Y = -5.1f; } else if (!WorldGen.SolidTile(num107, num108 - 2)) { projectile.velocity.Y = -7.1f; } else if (WorldGen.SolidTile(num107, num108 - 5)) { projectile.velocity.Y = -11.1f; } else if (WorldGen.SolidTile(num107, num108 - 4)) { projectile.velocity.Y = -10.1f; } else { projectile.velocity.Y = -9.1f; } } catch { projectile.velocity.Y = -9.1f; } } } } if (projectile.velocity.X > num104) { projectile.velocity.X = num104; } if (projectile.velocity.X < -num104) { projectile.velocity.X = -num104; } if (projectile.velocity.X < 0f) { projectile.direction = -1; } if (projectile.velocity.X > 0f) { projectile.direction = 1; } if (projectile.velocity.X > num103 && flag2) { projectile.direction = 1; } if (projectile.velocity.X < -num103 && flag) { projectile.direction = -1; } if (projectile.direction == -1) { projectile.spriteDirection = 1; } if (projectile.direction == 1) { projectile.spriteDirection = -1; } if (projectile.ai[1] > 0f) { if (projectile.localAI[1] == 0f) { projectile.localAI[1] = 1f; projectile.frame = 1; } if (projectile.frame != 0) { projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame == 4) { projectile.frame = 0; } } } else if (projectile.velocity.Y == 0f) { projectile.localAI[1] = 0f; if (projectile.velocity.X == 0f) { projectile.frame = 0; projectile.frameCounter = 0; } else if (projectile.velocity.X < -0.8 || projectile.velocity.X > 0.8) { projectile.frameCounter += (int)Math.Abs(projectile.velocity.X); projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame < 5) { projectile.frame = 5; } if (projectile.frame >= 11) { projectile.frame = 5; } } else { projectile.frame = 0; projectile.frameCounter = 0; } } else if (projectile.velocity.Y < 0f) { projectile.frameCounter = 0; projectile.frame = 4; } else if (projectile.velocity.Y > 0f) { projectile.frameCounter = 0; projectile.frame = 4; } projectile.velocity.Y = projectile.velocity.Y + 0.4f; if (projectile.velocity.Y > 10f) { projectile.velocity.Y = 10f; } return; } }