public override void AI() { projectile.velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y * 0.95f); int q = 0; for (q = 0; q < 1; q++) { int dust = Dust.NewDust(projectile.position - new Vector2(50, 0), 100, 40, 74, 0f, projectile.velocity.Y * 0.4f, 100, Color.DarkGreen * 0.15f, 2.5f); Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 2f; //Main.dust[dust].velocity *= 1.8f; //Main.dust[dust].velocity.Y -= 0.5f; //Main.playerDrawDust.Add(dust); } int minTilePosX = (int)(projectile.position.X / 16.0) - 1; int maxTilePosX = (int)((projectile.position.X + 2) / 16.0) + 2; int minTilePosY = (int)(projectile.position.Y / 16.0) - 1; int maxTilePosY = (int)((projectile.position.Y + 2) / 16.0) + 2; int whereisity; whereisity = Idglib.RaycastDown(minTilePosX + 1, minTilePosY); //Main.NewText(""+(whereisity-minTilePosY),255,255,255); projectile.position.Y += whereisity - minTilePosY > 2 ? 1 : 0; Rectangle rectangle1 = new Rectangle((int)projectile.Center.X - 40, (int)projectile.Center.Y - 60, 100, 40); int maxDistance = 50; bool playerCollision = false; for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].active) { Rectangle rectangle2 = new Rectangle((int)Main.npc[index].position.X - Main.npc[index].width, (int)Main.npc[index].position.Y - Main.npc[index].height, Main.npc[index].height * 2, Main.npc[index].width * 2); if (rectangle1.Intersects(rectangle2)) { if (Main.npc[index].GetGlobalNPC <SGAnpcs>().Combusted < 1) { IdgNPC.AddBuffBypass(index, mod.BuffType("DosedInGas"), 60 * 8, true); } } } } }
public override void AI() { Vector2 mousePos = Main.MouseWorld; Player player = Main.player[projectile.owner]; if (projectile.ai[0] > 1000f || player.dead) { projectile.Kill(); } projectile.localAI[1] += 1f; if ((!player.channel || projectile.ai[0] > 0)) { projectile.ai[0] += 1; projectile.netUpdate = true; projectile.velocity /= 2f; if (projectile.ai[0] < 2) { projectile.ai[1] = projectile.timeLeft; if (projectile.ai[1] < 130) { player.itemAnimation = 5; player.itemTime = 5; projectile.Kill(); return; } projectile.timeLeft /= 4; projectile.timeLeft += 90; } else { if (projectile.ai[0] > 20f && projectile.ai[0] < 1000f) { projectile.ai[0] = 1000f; int rayloc = Idglib.RaycastDown((int)(player.Center.X) / 16, (int)(player.Center.Y - 8f) / 16) * 16; if (!((rayloc - 16) - (projectile.position.Y) > 30 || (rayloc - 16) - (projectile.position.Y) < -30)) { //player.Hurt(PlayerDeathReason.ByCustomReason("Testing"), 5, projectile.direction, true, false, false, -1); Vector2 pos = player.Center; //new Vector2((int)(player.Center.X/16), (int)(player.Center.Y/16)) * 16; float damagemul = 1f + (projectile.ai[1] - 130) / 250f; int thisoned = Projectile.NewProjectile(pos, new Vector2(projectile.direction * 4, 0), GetType() == typeof(BrimflameCharging) ? ModContent.ProjectileType <SurtWave3>() : ModContent.ProjectileType <SurtWave>(), (int)(projectile.damage * damagemul) * 3, projectile.knockBack * 2f, Main.player[projectile.owner].whoAmI); Main.projectile[thisoned].timeLeft = (int)projectile.ai[1]; Main.PlaySound(SoundID.Item, player.Center, 74); } } } } else { if (projectile.timeLeft < 300) { projectile.timeLeft += (GetType() == typeof(BrimflameCharging) ? 3 : 2); } if (projectile.localAI[1] % 10 == 0 && projectile.timeLeft > 129 && projectile.timeLeft < 300) { Main.PlaySound(SoundID.Item, (int)player.Center.X, (int)player.Center.Y, 102, 0.25f, -0.5f + (float)projectile.timeLeft / 250f); } } projectile.rotation = MathHelper.ToRadians(135); // Multiplayer support here, only run this code if the client running it is the owner of the projectile if (projectile.owner == Main.myPlayer) { Vector2 diff = mousePos - player.Center; diff.Normalize(); if (projectile.ai[0] < 1f) { projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; } projectile.netUpdate = true; projectile.Center = mousePos; } if (projectile.ai[0] < 1f) { projectile.velocity = new Vector2(projectile.direction * 2, -((float)projectile.timeLeft - 60f)) * 0.15f; } projectile.Center = player.Center; player.heldProj = projectile.whoAmI; player.itemAnimation = 60; player.itemTime = 60; player.AddBuff(BuffID.OnFire, (int)(((float)projectile.timeLeft - 60f) * 2f)); int dir = projectile.direction; player.itemRotation = (MathHelper.ToRadians(90) + MathHelper.ToRadians(projectile.velocity.Y * 5f)) * dir; player.ChangeDir(dir); }