public override void AI() { Player player = Main.player[Main.myPlayer]; bool flag1 = true; int num3; for (int num432 = 0; num432 < 1000; num432 = num3 + 1) { if (num432 != projectile.whoAmI && Main.projectile[num432].active && Main.projectile[num432].owner == projectile.owner && Main.projectile[num432].type == projectile.type && projectile.timeLeft > Main.projectile[num432].timeLeft && Main.projectile[num432].timeLeft > 30) { flag1 = false; projectile.netUpdate = true; Main.projectile[num432].timeLeft = 30; } num3 = num432; } projectile.velocity.X *= 0f; projectile.velocity.Y *= 0f; float num33 = 10; float num44 = 6.28318548f * Main.rand.NextFloat(); Vector2 value = new Vector2(32f, 32f); for (float num5 = 0f; num5 < num33; num5 += 1f) { Dust dust = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 0, default(Color), 1f)]; Vector2 vector32 = Vector2.UnitY.RotatedBy((double)(num5 * 6.28318548f / num33 + num44), default(Vector2)); dust.position = projectile.Center + vector32 * value / 2f; dust.velocity = vector32; dust.noGravity = true; dust.scale = 1.2f; dust.velocity *= dust.scale; dust.fadeIn = Main.rand.NextFloat() * 0.6f; } PrimordialSandsPlayer modPlayer = (PrimordialSandsPlayer)player.GetModPlayer(mod, "PrimordialSandsPlayer"); if (modPlayer.infernoSummoned && flag1) { modPlayer.infernoSummoned = false; projectile.netUpdate = true; Main.PlaySound(45, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); int num626 = 1; for (int num627 = 0; num627 < num626; num627 = num3 + 1) { float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; num628 *= 10f; num629 *= 10f; int data = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num628, num629, mod.ProjectileType("InfernoBollProjectile"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[data].penetrate = 1; Main.projectile[data].netUpdate = true; num3 = num627; } } }
public override void Update(Player player, ref int buffIndex) { PrimordialSandsPlayer modPlayer = player.GetModPlayer <PrimordialSandsPlayer>(mod); if (player.ownedProjectileCounts[mod.ProjectileType("TreeEntMinion")] > 0) { modPlayer.treeEnt = true; } if (!modPlayer.treeEnt) { player.DelBuff(buffIndex); buffIndex--; } else { player.buffTime[buffIndex] = 18000; } }
public override void AI() { Player player = Main.player[projectile.owner]; bool minionCheck = projectile.type == mod.ProjectileType("TreeEntMinion"); player.AddBuff(mod.BuffType("TreeEntMinionBuff"), 3600); PrimordialSandsPlayer modPlayer = player.GetModPlayer <PrimordialSandsPlayer>(mod); if (minionCheck) { if (player.dead) { modPlayer.treeEnt = false; } if (modPlayer.treeEnt) { projectile.timeLeft = 2; } } }
public override void AI() { //Making player variable "p" set as the projectile's owner Player player = Main.player[projectile.owner]; int[] array = new int[20]; //Factors for calculations double deg = (double)projectile.ai[1]; //The degrees, you can multiply projectile.ai[1] to make it orbit faster, may be choppy depending on the value double rad = deg * (Math.PI / 180); //Convert degrees to radians double dist = 50; //Distance away from the player /*Position the player based on where the player is, the Sin/Cos of the angle times the / * /distance for the desired distance away from the player minus the projectile's width / * /and height divided by two so the center of the projectile is at the right place. */ projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; //Increase the counter/angle in degrees by 1 point, you can change the rate here too, but the orbit may look choppy depending on the value projectile.ai[1] += 2f; bool flag64 = projectile.type == mod.ProjectileType("ReaperProjectile"); PrimordialSandsPlayer modPlayer = (PrimordialSandsPlayer)player.GetModPlayer(mod, "PrimordialSandsPlayer"); if (player.dead) { modPlayer.reaperRosario = false; } if (!player.HasBuff(mod.BuffType("ReaperHealBuff"))) { modPlayer.reaperRosario = false; projectile.Kill(); } if (modPlayer.reaperRosario) { projectile.timeLeft = 2; } int frameCount = projectile.frameCounter; int num433 = 0; float num434 = 300f; for (int num435 = 0; num435 < 200; num435 = frameCount + 1) { if (Main.npc[num435].CanBeChasedBy(projectile, false)) { float posX1 = Main.npc[num435].position.X + (float)(Main.npc[num435].width / 2); float posY1 = Main.npc[num435].position.Y + (float)(Main.npc[num435].height / 2); float posSqrt1 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - posY1) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - posY1); if (posSqrt1 < num434 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num435].Center, 1, 1)) { if (num433 < 20) { array[num433] = num435; frameCount = num433; num433 = frameCount + 1; } } } frameCount = num435; } int num439 = Main.rand.Next(num433); num439 = array[num439]; float num440 = Main.npc[num439].position.X + (float)(Main.npc[num439].width / 2); float num441 = Main.npc[num439].position.Y + (float)(Main.npc[num439].height / 2); projectile.localAI[0] += 1f; if (projectile.localAI[0] > 180f) { projectile.localAI[0] = 0f; float num442 = 8f; Vector2 vector32 = new Vector2(projectile.position.X + (float)projectile.width, projectile.position.Y + (float)projectile.height); vector32 += projectile.velocity * 4f; float posX = num440 - vector32.X; float posY = num441 - vector32.Y; float posSqrt = (float)Math.Sqrt((double)(posX * posX + posY * posY)); posSqrt = num442 / posSqrt; posX *= posSqrt; posY *= posSqrt; int damage = 30; int type = mod.ProjectileType("ReaperHealProjectile"); Projectile.NewProjectile(vector32.X, vector32.Y, posX, posY, type, damage, projectile.knockBack, projectile.owner, 0f, 0f); return; } }