public override void AI() { projectile.frameCounter++; if (projectile.frameCounter >= 8) { projectile.frameCounter = 0; projectile.frame += 1; } if (projectile.frame > 3) { projectile.frame = 0; } Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(); if (player.dead || !player.HasBuff(mod.BuffType("Orbiters"))) { projectile.Kill(); } if (modPlayer.Orbiters) { projectile.timeLeft = 2; player.AddBuff(mod.BuffType("Orbiters"), 2, true); } if (projectile.active) { SetRot(); } BaseAI.AIRotate(projectile, ref projectile.rotation, ref rot, player.Center, true, 40f, 20f, 0.07f, true); }
public override void AI() { if (DefDamage == 0) { DefDamage = projectile.damage; } Player player = Main.player[projectile.owner]; if (player.dead || !player.active || player.ownedProjectileCounts[mod.ProjectileType("ArchwitchStaff")] < 1) { if (projectile.alpha < 255) { projectile.alpha += 8; } if (projectile.alpha >= 255) { projectile.Kill(); } } else { if (projectile.alpha > 0) { projectile.alpha -= 4; } } if (projectile.scale < 1) { projectile.scale += .05f; } projectile.damage = (int)(DefDamage * player.magicDamage); if (projectile.active) { SetRot(); } BaseAI.AIRotate(projectile, ref projectile.rotation, ref rot, player.Center, true, 100f, 20f, 0.07f * player.direction, true); rotate -= .05f * player.direction; }
public override void AI() { projectile.frameCounter++; if (projectile.frameCounter >= 8) { projectile.frameCounter = 0; projectile.frame += 1; } if (projectile.frame > 3) { projectile.frame = 0; } Player player = Main.player[projectile.owner]; if (player == Main.player[projectile.owner]) { if (player.altFunctionUse == 2) { released = true; float num1 = 12f; Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float f1 = Main.mouseX + Main.screenPosition.X - vector2.X; float f2 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (player.gravDir == -1.0) { f2 = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - vector2.Y; } float num4 = (float)Math.Sqrt(f1 * (double)f1 + f2 * (double)f2); float num5; if (float.IsNaN(f1) && float.IsNaN(f2) || f1 == 0.0 && f2 == 0.0) { f1 = projectile.direction; f2 = 0.0f; num5 = num1; } else { num5 = num1 / num4; } float SpeedX = f1 * num5; float SpeedY = f2 * num5; projectile.velocity.X = SpeedX; projectile.velocity.Y = SpeedY; } } projectile.ai[0]++; if (projectile.ai[0] < 30 && !released) { if (projectile.active) { SetRot(); } BaseAI.AIRotate(projectile, ref projectile.rotation, ref rot, player.Center, true, 60f, 20f, 0.07f, true); } if (projectile.ai[0] >= 30) { int foundTarget1 = HomeOnTarget(); if (!released) { if (foundTarget1 == -1) { if (projectile.active) { SetRot(); } BaseAI.AIRotate(projectile, ref projectile.rotation, ref rot, player.Center, true, 60f, 20f, 0.07f, true); } } } if (projectile.position.HasNaNs()) { projectile.Kill(); return; } bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); Dust dust19 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType <Dusts.AkumaADust>(), 0f, 0f, 0, default, 1f)];
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); }