public override void UpdateAccessory(Player player, bool hideVisual) { player.jumpBoost = true; player.doubleJumpCloud = true; player.fireWalk = true; player.noKnockback = true; player.noFallDmg = true; player.canRocket = true; player.rocketTime = 1200; player.rocketBoots = 2; player.rocketTimeMax = 1200; player.moveSpeed += 0.6f; player.jumpSpeedBoost = 3.2f; player.wingTimeMax = 1200; bool restricted = false; for (int i = 2; i <= 6; i++) { if (player.armor[i].type == ItemID.HermesBoots || player.armor[i].type == ItemID.SpectreBoots) { restricted = true; } } if (!restricted) { if (player.controlLeft) { if (player.velocity.X > -3) { player.velocity.X -= (float)(player.moveSpeed - 1f) / 10; } if (player.velocity.X < -3 && player.velocity.X > -6 * player.moveSpeed) { if (player.velocity.Y != 0) { player.velocity.X -= 0.1f; } else { player.velocity.X -= 0.2f; } player.velocity.X -= 0.02f + ((player.moveSpeed - 1f) / 10); } } if (player.controlRight) { if (player.velocity.X < 3) { player.velocity.X += (float)(player.moveSpeed - 1f) / 10; } if (player.velocity.X > 3 && player.velocity.X < 6 * player.moveSpeed) { if (player.velocity.Y != 0) { player.velocity.X += 0.1f; } else { player.velocity.X += 0.2f; } player.velocity.X += 0.02f + ((player.moveSpeed - 1f) / 10); } } if (player.velocity.X > 6 || player.velocity.X < -6) { player.waterWalk = true; int sonicDust = Dust.NewDust(new Vector2((float)player.position.X, (float)player.position.Y), player.width, player.height, 16, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 100, default, 2f);
public override void PreApply(Entity e, DrawData?drawData) { UseColor(PrimeColor); UseSecondaryColor(SecondColor); Vector3 newVector = new Vector3(0f, 0f, 0f); if (SpecialShader == 0) //life dye { Player player = e as Player; if (player == null) { return; } Vector3 vector = new Vector3(0.92f, 0f, 0f); if (IsPrimeColor) { vector = PrimeColor; } float resultX = ((float)player.statLife / (float)player.statLifeMax2 * vector.X + 0.08f); float resultY = ((float)player.statLife / (float)player.statLifeMax2 * vector.Y + 0.08f); float resultZ = ((float)player.statLife / (float)player.statLifeMax2 * vector.Z + 0.08f); if (vector.X <= 0.08f) { resultX = 0.08f; } if (vector.Y <= 0.08f) { resultY = 0.08f; } if (vector.Z <= 0.08f) { resultZ = 0.08f; } newVector = new Vector3(resultX, resultY, resultZ); UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 1) //mana dye { Player player = e as Player; if (player == null) { return; } Vector3 vector = new Vector3(0.8f, 0.7f, 1f); // 0.2f 0.3f if (IsPrimeColor) { vector = PrimeColor; } float resultX = ((1f - (float)player.statMana / (float)player.statManaMax2) * vector.X + (0.95f - vector.X)); float resultY = ((1f - (float)player.statMana / (float)player.statManaMax2) * vector.Y + (0.95f - vector.Y)); float resultZ = ((1f - (float)player.statMana / (float)player.statManaMax2) * vector.Z + (0.95f - vector.Z)); if (vector.X >= 1f) { resultX = 1f; } if (vector.Y >= 1f) { resultY = 1f; } if (vector.Z >= 1f) { resultZ = 1f; } newVector = new Vector3(resultX, resultY, resultZ); UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 2) //depth dye { Player player = e as Player; if (player == null) { return; } float num29 = (float)(Main.worldSurface * 0.45) * 16f; float num30 = (float)(Main.worldSurface + Main.rockLayer) * 8f; float num31 = (float)(Main.rockLayer + (double)Main.maxTilesY) * 8f; float num32 = (float)(Main.maxTilesY - 150) * 16f; Vector2 center = player.Center; if (center.Y < num29) { float num33 = center.Y / num29; float num34 = 1f - num33; newVector.X = (0.45f * num34 + 0.1f * num33); newVector.Y = (0.63f * num34 + 0.85f * num33); newVector.Z = (0.97f * num34 + 0.36f * num33); } else if (center.Y < num30) { float num35 = num29; float num36 = (center.Y - num35) / (num30 - num35); float num37 = 1f - num36; newVector.X = (0.1f * num37 + 0.6f * num36); newVector.Y = (0.85f * num37 + 0.42f * num36); newVector.Z = (0.36f * num37 + 0.3f * num36); } else if (center.Y < num31) { float num38 = num30; float num39 = (center.Y - num38) / (num31 - num38); float num40 = 1f - num39; newVector.X = (0.6f * num40 + 0.5f * num39); newVector.Y = (0.42f * num40 + 0.5f * num39); newVector.Z = (0.3f * num40 + 0.5f * num39); } else if (center.Y < num32) { float num41 = num31; float num42 = (center.Y - num41) / (num32 - num41); float num43 = 1f - num42; newVector.X = (0.5f * num43 + 1f * num42); newVector.Y = (0.5f * num43 + 0.2f * num42); newVector.Z = (0.5f * num43 + 0.05f * num42); } else { newVector.X = 1f; newVector.Y = 0.2f; newVector.Z = 0.04f; } UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 3) //money dye { Player player = e as Player; if (player == null) { return; } int num17 = 0; for (int i = 0; i < 54; i++) { if (player.inventory[i].type == 71) { num17 += player.inventory[i].stack; } if (player.inventory[i].type == 72) { num17 += player.inventory[i].stack * 100; } if (player.inventory[i].type == 73) { num17 += player.inventory[i].stack * 10000; } if (player.inventory[i].type == 74) { num17 += player.inventory[i].stack * 1000000; if (num17 >= 2147483647) { num17 = 2147483647; } } } float num18 = (float)Item.buyPrice(0, 5, 0, 0); float num19 = (float)Item.buyPrice(0, 50, 0, 0); float num20 = (float)Item.buyPrice(2, 0, 0, 0); Vector3 color8 = new Vector3(0.89f, 0.47f, 0.3f); Vector3 color9 = new Vector3(0.69f, 0.76f, 0.76f); Vector3 color10 = new Vector3(0.8f, 0.71f, 0.29f); Vector3 color11 = new Vector3(0.64f, 0.68f, 0.68f); if ((float)num17 < num18) { float num21 = (float)num17 / num18; float num22 = 1f - num21; newVector.X = (color8.X * num22 + color9.X * num21); newVector.Y = (color8.Y * num22 + color9.Y * num21); newVector.Z = (color8.Z * num22 + color9.Z * num21); } else if ((float)num17 < num19) { float num24 = ((float)num17 - num18) / (num19 - num18); float num25 = 1f - num24; newVector.X = (color9.X * num25 + color10.X * num24); newVector.Y = (color9.Y * num25 + color10.Y * num24); newVector.Z = (color9.Z * num25 + color10.Z * num24); } else if ((float)num17 < num20) { float num27 = ((float)num17 - num19) / (num20 - num19); float num28 = 1f - num27; newVector.X = (color10.X * num28 + color11.X * num27); newVector.Y = (color10.Y * num28 + color11.Y * num27); newVector.Z = (color10.Z * num28 + color11.Z * num27); } else { newVector = color11; } UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 4) //time dye { Vector3 color4 = new Vector3(0.003f, 0.55f, 1f); Vector3 color5 = new Vector3(1f, 1f, 0f); Vector3 color6 = new Vector3(0.83f, 0.17f, 0.5f); Vector3 color7 = new Vector3(0.27f, 0.17f, 0.47f); if (Main.dayTime) { if (Main.time < 27000.0) { float num7 = (float)(Main.time / 27000.0); float num8 = 1f - num7; newVector.X = (color4.X * num8 + color5.X * num7); newVector.Y = (color4.Y * num8 + color5.Y * num7); newVector.Z = (color4.Z * num8 + color5.Z * num7); } else { float num9 = 27000f; float num10 = (float)((Main.time - (double)num9) / (54000.0 - (double)num9)); float num11 = 1f - num10; newVector.X = (color5.X * num11 + color6.X * num10); newVector.Y = (color5.Y * num11 + color6.Y * num10); newVector.Z = (color5.Z * num11 + color6.Z * num10); } } else if (Main.time < 16200.0) { float num12 = (float)(Main.time / 16200.0); float num13 = 1f - num12; newVector.X = (color6.X * num13 + color7.X * num12); newVector.Y = (color6.Y * num13 + color7.Y * num12); newVector.Z = (color6.Z * num13 + color7.Z * num12); } else { float num14 = 16200f; float num15 = (float)((Main.time - (double)num14) / (32400.0 - (double)num14)); float num16 = 1f - num15; newVector.X = (color7.X * num16 + color4.X * num15); newVector.Y = (color7.Y * num16 + color4.Y * num15); newVector.Z = (color7.Z * num16 + color4.Z * num15); } UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 5) //biome dye { newVector = ((Main.waterStyle != 2) ? ((Main.waterStyle != 3) ? ((Main.waterStyle != 4) ? ((Main.waterStyle != 5) ? ((Main.waterStyle != 6) ? ((Main.waterStyle != 7) ? ((Main.waterStyle != 8) ? ((Main.waterStyle != 9) ? ((Main.waterStyle != 10) ? new Vector3(0.11f, 0.85f, 0.36f) : new Vector3(0.82f, 0.31f, 0.31f)) : new Vector3(0.78f, 0f, 0f)) : new Vector3(0.5f, 0.5f, 0.5f)) : new Vector3(0.6f, 0.42f, 0.3f)) : new Vector3(0.91f, 0.86f, 0.4f)) : new Vector3(0.74f, 0.91f, 1f)) : new Vector3(0.31f, 0.75f, 0.9f)) : new Vector3(0.56f, 0.85f, 0.11f)) : new Vector3(0.49f, 0.47f, 0.94f)); UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 6) //party dye, may delete { Player player = e as Player; if (player == null) { return; } newVector = new Vector3(0.95f, 0.09f, 0.69f); if (IsPrimeColor) { newVector = PrimeColor; } if (!Main.gameMenu && !Main.gamePaused) { if (Main.rand.Next(45) == 0) { int type = Main.rand.Next(139, 143); int num5 = Dust.NewDust(player.position, player.width, 8, type, 0f, 0f, 0, default(Color), 1.2f); Main.dust[num5].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; Main.dust[num5].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; Main.dust[num5].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f; Main.dust[num5].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f; Main.dust[num5].velocity.Y -= 1f; Main.dust[num5].scale *= 0.7f + (float)Main.rand.Next(-30, 31) * 0.01f; Dust obj = Main.dust[num5]; obj.velocity += player.velocity * 0.2f; } if (Main.rand.Next(225) == 0) { int type2 = Main.rand.Next(276, 283); int num6 = Gore.NewGore(new Vector2(player.position.X + (float)Main.rand.Next(player.width), player.position.Y + (float)Main.rand.Next(8)), player.velocity, type2, 1f); Main.gore[num6].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; Main.gore[num6].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; Main.gore[num6].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Main.gore[num6].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f; Main.gore[num6].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f; Main.gore[num6].velocity.Y -= 1f; Gore obj2 = Main.gore[num6]; obj2.velocity += player.velocity * 0.2f; } } UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 7) //speed dye { Player player = e as Player; if (player == null) { return; } Vector3 vector = new Vector3(0f, 0f, 0f); if (IsPrimeColor) { vector = PrimeColor; } Vector3 vector2 = new Vector3(0.3f, 1f, 0.78f); if (UseSecond) { vector2 = SecondColor; } float num = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); float num2 = 10f; //if (num > num2) //{ // num = num2; //} float num3 = num / num2; float num4 = 1f - num3; newVector.X = (vector2.X * num3 + vector.X * num4); newVector.Y = (vector2.Y * num3 + vector.Y * num4); newVector.Z = (vector2.Z * num3 + vector.Z * num4); UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } if (SpecialShader == 8) //xna colors, use Color.*color*.ToVector3() as prime -unused- { newVector = PrimeColor; UseColor(newVector); if (!IsSecondColor) { SecondColor = newVector; UseSecondaryColor(SecondColor); } } //if (SpecialShader == 8) //{ // Player player = e as Player; // if (player == null) return; // Vector3 vector = new Vector3(0f, 0f, 0f); // if (player.team >= 0 && player.team < Main.teamColor.Length) // { // vector = new Vector3(((float)Main.teamColor[player.team].R / 255), ((float)Main.teamColor[player.team].B / 255), ((float)Main.teamColor[player.team].G / 255)); // } // UseColor(newVector); // if (!IsSecondColor) // { // SecondColor = newVector; // UseSecondaryColor(SecondColor); // } //} }
public override void AI() { Vector2?vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType <LifeChampion>()) { projectile.Center = Main.npc[(int)projectile.ai[1]].Center; } else { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item12, projectile.Center); } float num801 = 1f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 2f * num801; if (projectile.scale > num801) { projectile.scale = num801; } float num804 = projectile.velocity.ToRotation(); num804 += projectile.ai[0]; projectile.rotation = num804 - 1.57079637f; //float num804 = Main.npc[(int)projectile.ai[1]].ai[3] - 1.57079637f + projectile.ai[0]; //if (projectile.ai[0] != 0f) num804 -= (float)Math.PI; //projectile.rotation = num804; //num804 += 1.57079637f; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; float num806 = (float)projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) { samplingPoint = vector78.Value; } float[] array3 = new float[(int)num805]; //Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 3000f, array3); for (int i = 0; i < array3.Length; i++) { array3[i] = 3000f; } float num807 = 0f; int num3; for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) { num807 += array3[num808]; num3 = num808; } num807 /= num805; float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809 = num3 + 1) { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); Main.dust[num812].noGravity = true; Main.dust[num812].scale = 1.7f; num3 = num809; } if (Main.rand.Next(5) == 0) { Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); } //DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); //Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); }
public virtual void DoAI() { if (projectile.localAI[0] > 300) { projectile.Kill(); return; } oldHitbox = new Vector2(projectile.width, projectile.height); if (projectile.localAI[0] == 1) { projectile.rotation = projectile.ai[0]; projectile.spriteDirection = projectile.rotation > 500 ? -1 : 1; if (projectile.rotation > 500) { projectile.rotation -= 1000; } projectile.ai[0] = 0; projectile.netUpdate = true; } Vector2 target; SwingUp(); SwingDown(); void SwingUp() { if (projectile.localAI[0] < 70)//Swing up { float progress = Math.Min(projectile.localAI[0] / 50f, 1f); if (Helper.IsTargetValid(enemy)) { strikeWhere = enemy.Center + new Vector2(enemy.velocity.X, enemy.velocity.Y / 2f); enemySize = new Vector2(enemy.width, enemy.height); } projectile.rotation = projectile.rotation.AngleLerp(-MathHelper.Pi / 4f, 0.075f * progress); target = strikeWhere + new Vector2(projectile.spriteDirection * -(75 + (float)Math.Pow(projectile.localAI[0] * 2f, 0.80) + enemySize.X / 2f), -200); projectile.velocity += (target - projectile.Center) / 75f; if (projectile.velocity.Length() > 14f * progress) { projectile.velocity = Vector2.Normalize(projectile.velocity) * 14 * progress; } projectile.velocity /= 1.5f; } } void SwingDown() { if (projectile.localAI[0] >= 70)//Swing Down { if (Helper.IsTargetValid(enemy)) { strikeWhere.X = enemy.Center.X + enemy.velocity.X * 1.50f; } projectile.velocity.X += Math.Min(Math.Abs(projectile.velocity.X), 0) * projectile.spriteDirection; float progress = Math.Min((projectile.localAI[0] - 70f) / 30f, 1f); projectile.rotation = projectile.rotation.AngleTowards(MathHelper.Pi / 4f, 0.075f * progress); target = strikeWhere + new Vector2(projectile.spriteDirection * -(32 + enemySize.X / 4f), -32); projectile.velocity.X += MathHelper.Clamp(target.X - projectile.Center.X, -80f, 80f) / 24f; projectile.velocity.Y += 1f; if (projectile.velocity.Length() > 10 * progress) { projectile.velocity = Vector2.Normalize(projectile.velocity) * 10 * progress; } projectile.velocity.X /= 1.20f; Smash(); } } void Smash() { if (projectile.Center.Y > target.Y)//Smashing! { int tileTargetY = (int)(projectile.Center.Y / 16) + 1; Point16 point = new Point16((int)((projectile.Center.X + projectile.width / 3f * projectile.spriteDirection) / 16), Math.Min(Main.maxTilesY, tileTargetY)); Tile tile = Framing.GetTileSafely(point.X, point.Y); //hard coded dust ids in worldgen.cs, still ew //Tile hit! if (tile != null && WorldGen.InWorld(point.X, point.Y, 1) && tile.active() && Main.tileSolid[tile.type]) { projectile.localAI[0] = 301; int dusttype = ModContent.DustType <Dusts.GlassGravity>(); DustHelper.TileDust(tile, ref dusttype); int ai0 = tile.type; int ai1 = 16 * projectile.spriteDirection; Vector2 tilepos16 = new Vector2(point.X, point.Y - 1) * 16; Projectile.NewProjectile(tilepos16, Vector2.Zero, ModContent.ProjectileType <ShockwaveSummon>(), (int)(projectile.damage * 0.25), 0, Main.myPlayer, ai0, ai1); Main.LocalPlayer.GetModPlayer <StarlightPlayer>().Shake += 10; for (float num315 = 2f; num315 < 15; num315 += 0.50f) { float angle = MathHelper.ToRadians(-Main.rand.Next(70, 130)); Vector2 vecangle = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * num315 * 3f; Vector2 position = new Vector2(projectile.position.X + projectile.spriteDirection * (int)(projectile.width * 0.60), projectile.Center.Y - projectile.height / 2f); int num316 = Dust.NewDust(position, projectile.width / 2, projectile.height, dusttype, 0f, 0f, 50, default, (12f - num315) / 5f);
public override void AI() { float JumpPower = 8f; int MaxDist = 500; if (Main.expertMode) { MaxDist = 400; JumpPower = 9.5f; } if (DRGNModWorld.MentalMode) { MaxDist = 300; JumpPower = 12.5f; } if (npc.collideY) { npc.velocity.X *= 0.9f; } Target(); npc.frame.Y = 96; if (npc.velocity.Y > 0) { npc.noTileCollide = false; } if (npc.ai[3] > -1 && (!Main.projectile[(int)npc.ai[3]].active || Main.projectile[(int)npc.ai[3]].type != mod.ProjectileType("FrogTongueHostile"))) { npc.ai[3] = -1; if (Main.netMode != 1) { npc.netUpdate = true; } } if (npc.ai[0] == 0 && npc.ai[3] == -1) { npc.frame.Y = 0; npc.ai[2] += 1; if (npc.ai[2] == 100) { npc.localAI[1] = player.Center.X; npc.localAI[2] = player.Top.Y - 16; } if (npc.ai[2] > 150) { npc.Center = new Vector2(npc.localAI[1], npc.localAI[2]); npc.ai[2] = 0; for (int i = 0; i < 250; i++) { int DustID = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 273, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 120, default(Color), 4f); Main.dust[DustID].noGravity = true; } if (Main.netMode != 1) { npc.netUpdate = true; } } if (player.Center.X > npc.Center.X + MaxDist) { if (npc.collideX) { npc.velocity.Y = -10; npc.velocity.X = 5; } if (npc.velocity.Y == 0 && npc.velocity.X == 0) { npc.velocity.X += JumpPower; npc.velocity.Y -= JumpPower; npc.spriteDirection = 1; } else if (npc.collideY == true) { npc.velocity.X = 0; npc.velocity.Y = 0; } } else if (player.Center.X < npc.Center.X - MaxDist) { if (npc.collideX) { npc.velocity.Y = -10; npc.velocity.X = -5; } if (npc.velocity.Y == 0 && npc.velocity.X == 0) { npc.velocity.X -= JumpPower; npc.velocity.Y -= JumpPower; npc.spriteDirection = -1; } else if (npc.collideY == true) { npc.velocity.X = 0; npc.velocity.Y = 0; } } else if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { npc.ai[0] = 1; npc.ai[1] = 0; npc.ai[2] = 0; npc.velocity = Vector2.Zero; if (Main.netMode != 1) { npc.netUpdate = true; } } } if (npc.ai[0] == 1 && npc.velocity == Vector2.Zero) { if (npc.ai[3] == -1 && npc.ai[1] > 10) { if (Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[3] = Projectile.NewProjectile(npc.Center, ShootTo(), mod.ProjectileType("FrogTongueHostile"), tongueDamage, 0f, Main.myPlayer, npc.whoAmI); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, (int)npc.ai[3]); npc.netUpdate = true; } if (player.Center.X > npc.Center.X) { npc.spriteDirection = 1; } else { npc.spriteDirection = -1; } if (Main.netMode != 1) { npc.netUpdate = true; } } npc.ai[1] += 1; if (npc.ai[1] >= 50) { npc.ai[0] = 2; if (Main.netMode != 1) { npc.netUpdate = true; } } } if (npc.ai[0] == 2) { for (int i = 0; i < 50; i++) { if (Main.rand.Next(0, 10) == 1) { if (Main.netMode != NetmodeID.MultiplayerClient) { if (DRGNModWorld.MentalMode) { int projid = Projectile.NewProjectile(npc.Center, new Vector2(-10, -10 + Main.rand.Next(-5, 5)), ProjectileID.JungleSpike, spikeDamage, 0); int projid2 = Projectile.NewProjectile(npc.Center, new Vector2(10, -10 + Main.rand.Next(-5, 5)), ProjectileID.JungleSpike, spikeDamage, 0); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid, projid2); } if (!Main.expertMode) { if (Main.rand.Next(5) == 1) { int npcid = NPC.NewNPC((int)npc.Center.X + Main.rand.Next(-40, 40), (int)npc.Center.Y + Main.rand.Next(-40, 40), NPCID.BeeSmall); NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcid); } } else if (Main.rand.Next(15) == 1) { int npcid = NPC.NewNPC((int)npc.Center.X + Main.rand.Next(-40, 40), (int)npc.Center.Y + Main.rand.Next(-40, 40), NPCID.BigHornetStingy); if (Main.netMode != NetmodeID.MultiplayerClient) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcid); } } } } int DustID = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width + 1, npc.height + 1, 273, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 120, default(Color), 4f); Main.dust[DustID].noGravity = true; } npc.ai[0] = 0; if (Main.netMode != 1) { npc.netUpdate = true; } } DespawnHandler(); }
public override void AI() { Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 244, npc.velocity.X * -0.5f, npc.velocity.Y * -0.5f, 255, default(Color), 0.5f); }
public override void Kill(int timeLeft) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.2f, projectile.oldVelocity.Y * 0.2f); }
public override void AI() { //int dustType = mod.DustType("DirtSolution"); if (minDistance >= 0) { if (projectile.owner == Main.myPlayer) { Player p = Main.player[Main.myPlayer]; float xCenter = projectile.position.X + (float)(projectile.width / 2); float yCenter = projectile.position.Y + (float)(projectile.height / 2); float pxCenter = p.position.X + (float)(p.width / 2); float pyCenter = p.position.Y + (float)(p.height / 2); double distance = Math.Sqrt((xCenter - pxCenter) * (xCenter - pxCenter) + (yCenter - pyCenter) * (yCenter - pyCenter)); if (distance > minDistance) { Convert((int)(projectile.position.X + (float)(projectile.width / 2)) / 16, (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16, radius); } } } if (projectile.timeLeft > maxTime) { projectile.timeLeft = maxTime; } if (projectile.ai[0] > 7f) { float dustScale = 1f; if (projectile.ai[0] == 8f) { dustScale = 0.2f; } else if (projectile.ai[0] == 9f) { dustScale = 0.4f; } else if (projectile.ai[0] == 10f) { dustScale = 0.6f; } else if (projectile.ai[0] == 11f) { dustScale = 0.8f; } projectile.ai[0] += 1f; for (int i = 0; i < radius * 2 + 1; i++) { int dustIndex = -1; ModDust md = ModDust.GetDust(dustType); if (md == null || !(md is BaseLightlessDust)) { dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); } else { dustIndex = Dust.NewDust(new Vector2(projectile.position.X - radius * 16, projectile.position.Y), projectile.width + radius * 32, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); } Dust dust = Main.dust[dustIndex]; dust.noGravity = true; dust.scale *= 1.75f; dust.velocity.X = dust.velocity.X * 2f; dust.velocity.Y = dust.velocity.Y * 2f; dust.scale *= dustScale; } } else { projectile.ai[0] += 1f; } projectile.rotation += 0.3f * (float)projectile.direction; }
public override void Update(NPC npc, ref int buffIndex) { int DustID = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width + 1, npc.height + 1, 174, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 120, default(Color), 2f); Main.dust[DustID].noGravity = true; }
public override void AI() { Lighting.AddLight(projectile.Center, 1.0f, 0.42f, 0.0f); int fire = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X, projectile.position.Y - projectile.velocity.Y), 10, 10, DustID.Fire, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 0.75f);
public override void Kill(int timeLeft) { int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <Dusts.StarDust>(), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, Color.White, 1f); Main.dust[dustID].velocity = new Vector2(MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble()), MathHelper.Lerp(-1f, 1f, (float)Main.rand.NextDouble())); }
public override bool PreAI() { //THE END OF DAYS COMES AND HELL COMES TO EARTH AND IN THOSE DAYS MEN SHALL SEEK DEATH, AND SHALL IN NO WISE FIND IT; AND THEY SHALL DESIRE TO DIE, AND DEATH FLEETH FROM THEM. //UPON SOUNDING THE FIFTH TRUMPET, A STAR FELL FROM HEAVEN TO THE EARTH. HAVING CEASED TO BE A MINISTER OF CHRIST, HE WHO IS REPRESENTED BY THIS STAR BECOMES THE MINISTER OF THE DEVIL; AND LETS LOOSE THE POWERS OF HELL AGAINST THE CHURCHES OF CHRIST. ON THE OPENING OF THE BOTTOMLESS PIT, THERE AROSE A GREAT SMOKE. THE DEVIL CARRIES ON HIS DESIGNS BY BLINDING THE EYES OF MEN, BY PUTTING OUT LIGHT AND KNOWLEDGE, AND PROMOTING IGNORANCE AND ERROR. OUT OF THIS SMOKE THERE CAME A SWARM OF LOCUSTS, EMBLEMS OF THE DEVIL'S AGENTS, WHO PROMOTE SUPERSTITION, IDOLATRY, ERROR, AND CRUELTY. THE TREES AND THE GRASS, THE TRUE BELIEVERS, WHETHER YOUNG OR MORE ADVANCED, SHOULD BE UNTOUCHED. BUT A SECRET POISON AND INFECTION IN THE SOUL, SHOULD ROB MANY OTHERS OF PURITY, AND AFTERWARDS OF PEACE. THE LOCUSTS HAD NO POWER TO HURT THOSE WHO HAD THE SEAL OF GOD. GOD'S ALL-POWERFUL, DISTINGUISHING GRACE WILL KEEP HIS PEOPLE FROM TOTAL AND FINAL APOSTACY. THE POWER IS LIMITED TO A SHORT SEASON; BUT IT WOULD BE VERY SHARP. IN SUCH EVENTS THE FAITHFUL SHARE THE COMMON CALAMITY, BUT FROM THE PESTILENCE OF ERROR THEY MIGHT AND WOULD BE SAFE. WE COLLECT FROM SCRIPTURE, THAT SUCH ERRORS WERE TO TRY AND PROVE THE CHRISTIANS, 1CO 11:19. AND EARLY WRITERS PLAINLY REFER THIS TO THE FIRST GREAT HOST OF CORRUPTERS WHO OVERSPREAD THE CHRISTIAN CHURCH. npc.TargetClosest(true); Player player10 = Main.player[npc.target]; if (!player10.active || player10.dead) { npc.TargetClosest(false); npc.velocity.Y = -100; } Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.0f, 0.04f, 0.8f); if (npc.ai[0] == 0) { if (npc.life > (npc.lifeMax / 2)) { #region ai phase 1 movementCounter++; npc.TargetClosest(true); if (movementCounter < 800) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity *= 0.985f; int dust2 = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust2].noGravity = true; if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) >= 7f) { int dust = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 2f; dust = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 2f; } if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) < 13f) { if (Main.rand.Next(18) == 1) { direction.X = direction.X * Main.rand.Next(21, 27); direction.Y = direction.Y * Main.rand.Next(21, 27); npc.velocity.X = direction.X; npc.velocity.Y = direction.Y; } } // if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) < 10f) // { // if (Main.rand.Next(18) == 1) // { // direction.X = direction.X * Main.rand.Next(20, 23); // direction.Y = direction.Y * Main.rand.Next(20, 23); // npc.velocity.X = direction.X; // npc.velocity.Y = direction.Y; // } // } if (movementCounter % 150 == 50) { Vector2 direction9 = Main.player[npc.target].Center - npc.Center; direction9.Normalize(); direction9.X *= 15f; direction9.Y *= 15f; int amountOfProjectiles = Main.rand.Next(7, 11); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-250, 250) * 0.01f; float B = (float)Main.rand.Next(-250, 250) * 0.01f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction9.X + A, direction9.Y + B, mod.ProjectileType("CoreShard"), 120, 1, Main.myPlayer, 0, 0); } } } if (movementCounter == 800) { npc.velocity.X = 0; npc.velocity.Y = 0; } if (movementCounter > 800) { if (movementCounter % 100 == 50) { Vector2 direction8 = Main.player[npc.target].Center - npc.Center; direction8.Normalize(); direction8.X *= 28f; direction8.Y *= 28f; int amountOfProjectiles = Main.rand.Next(10, 15); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-250, 250) * 0.01f; float B = (float)Main.rand.Next(-250, 250) * 0.01f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction8.X + A, direction8.Y + B, mod.ProjectileType("SpiritShard"), 80, 1, Main.myPlayer, 0, 0); } } float speed = 14f; float acceleration = 0.15f; Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float xDir = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector2.X; float yDir = (float)(Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120) - vector2.Y; float length = (float)Math.Sqrt(xDir * xDir + yDir * yDir); if (length > 400 && Main.expertMode) { ++speed; acceleration += 0.05F; if (length > 600) { ++speed; acceleration += 0.08F; if (length > 800) { ++speed; acceleration += 0.05F; } } } float num10 = speed / length; xDir = xDir * num10; yDir = yDir * num10; if (npc.velocity.X < xDir) { npc.velocity.X = npc.velocity.X + acceleration; if (npc.velocity.X < 0 && xDir > 0) { npc.velocity.X = npc.velocity.X + acceleration; } } else if (npc.velocity.X > xDir) { npc.velocity.X = npc.velocity.X - acceleration; if (npc.velocity.X > 0 && xDir < 0) { npc.velocity.X = npc.velocity.X - acceleration; } } if (npc.velocity.Y < yDir) { npc.velocity.Y = npc.velocity.Y + acceleration; if (npc.velocity.Y < 0 && yDir > 0) { npc.velocity.Y = npc.velocity.Y + acceleration; } } else if (npc.velocity.Y > yDir) { npc.velocity.Y = npc.velocity.Y - acceleration; if (npc.velocity.Y > 0 && yDir < 0) { npc.velocity.Y = npc.velocity.Y - acceleration; } } } if (movementCounter > 1400) { movementCounter = 0; } #endregion } if (npc.life <= (npc.lifeMax / 2)) { #region Ai phase 2 if (!secondphase) { Main.NewText("BEHOLD MY TRUE POWER", 0, 80, 200, true); secondphase = true; } movementCounter++; npc.TargetClosest(true); if (movementCounter < 800) { if (movementCounter % 120 == 50) { Vector2 direction9 = Main.player[npc.target].Center - npc.Center; direction9.Normalize(); direction9.X *= 16f; direction9.Y *= 16f; int amountOfProjectiles = Main.rand.Next(7, 11); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-250, 250) * 0.01f; float B = (float)Main.rand.Next(-250, 250) * 0.01f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction9.X + A, direction9.Y + B, mod.ProjectileType("CoreShard"), 130, 1, Main.myPlayer, 0, 0); } } Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity *= 0.983f; int dust2 = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust2].noGravity = true; if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) >= 7f) { int dust = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 2f; dust = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 206, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 2f; } if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) < 14f) { if (Main.rand.Next(18) == 1) { direction.X = direction.X * Main.rand.Next(27, 31); direction.Y = direction.Y * Main.rand.Next(27, 31); npc.velocity.X = direction.X; npc.velocity.Y = direction.Y; } } // if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) < 10f) // { // if (Main.rand.Next(18) == 1) // { // direction.X = direction.X * Main.rand.Next(20, 23); // direction.Y = direction.Y * Main.rand.Next(20, 23); // npc.velocity.X = direction.X; // npc.velocity.Y = direction.Y; // } // } } if (movementCounter == 800) //spawn portals { npc.velocity.X = 0; npc.velocity.Y = 0; } if (movementCounter > 800) { if (movementCounter % 75 == 50) { Vector2 direction8 = Main.player[npc.target].Center - npc.Center; direction8.Normalize(); direction8.X *= 24f; direction8.Y *= 28f; int amountOfProjectiles = Main.rand.Next(10, 15); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-350, 350) * 0.01f; float B = (float)Main.rand.Next(-350, 350) * 0.01f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction8.X + A, direction8.Y + B, mod.ProjectileType("SpiritShard"), 87, 1, npc.target, 0, 0); } } float speed = 16f; float acceleration = 0.17f; Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float xDir = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector2.X; float yDir = (float)(Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120) - vector2.Y; float length = (float)Math.Sqrt(xDir * xDir + yDir * yDir); if (length > 400 && Main.expertMode) { ++speed; acceleration += 0.05F; if (length > 600) { ++speed; acceleration += 0.08F; if (length > 800) { ++speed; acceleration += 0.05F; } } } float num10 = speed / length; xDir = xDir * num10; yDir = yDir * num10; if (npc.velocity.X < xDir) { npc.velocity.X = npc.velocity.X + acceleration; if (npc.velocity.X < 0 && xDir > 0) { npc.velocity.X = npc.velocity.X + acceleration; } } else if (npc.velocity.X > xDir) { npc.velocity.X = npc.velocity.X - acceleration; if (npc.velocity.X > 0 && xDir < 0) { npc.velocity.X = npc.velocity.X - acceleration; } } if (npc.velocity.Y < yDir) { npc.velocity.Y = npc.velocity.Y + acceleration; if (npc.velocity.Y < 0 && yDir > 0) { npc.velocity.Y = npc.velocity.Y + acceleration; } } else if (npc.velocity.Y > yDir) { npc.velocity.Y = npc.velocity.Y - acceleration; if (npc.velocity.Y > 0 && yDir < 0) { npc.velocity.Y = npc.velocity.Y - acceleration; } } } if (movementCounter > 1600) { for (int I = 0; I < 2; I++) { //cos = y, sin = x int portal = Projectile.NewProjectile((int)(Main.player[npc.target].Center.X + (Math.Sin(I * 180) * 500)), (int)(Main.player[npc.target].Center.Y + (Math.Cos(I * 180) * 500)), 0, 0, mod.ProjectileType("SpiritPortal"), npc.damage, 1, npc.target, 0, 0); Projectile Eye = Main.projectile[portal]; Eye.ai[0] = I * 180; } movementCounter = 0; } #endregion } if (player10.active && !player10.dead) { #region teleportation if (Main.rand.Next(300) == 0) { int teleport = Projectile.NewProjectile(Main.player[npc.target].Center.X + Main.rand.Next(-600, 600), Main.player[npc.target].Center.Y + Main.rand.Next(-600, 600), 0, 0, mod.ProjectileType("SeerPortal"), 55, 0, npc.target); Projectile tele = Main.projectile[teleport]; } #endregion } npc.ai[1]++; if (npc.ai[1] >= 180) { npc.TargetClosest(true); Vector2 dir = Main.player[npc.target].Center - npc.Center; dir.Normalize(); dir *= 8; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, dir.X, dir.Y, mod.ProjectileType("HauntedWisp"), 10, 0, Main.myPlayer); npc.ai[1] = 0; } } return(false); }
public override bool PreAI() { if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 34); } else if (projectile.ai[1] == 1f && Main.netMode != 1) { int num = -1; float num2 = 2000f; for (int i = 0; i < 200; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { Vector2 center = Main.npc[i].Center; float num3 = Vector2.Distance(center, projectile.Center); if ((num3 < num2 || num == -1) && Collision.CanHit(projectile.Center, 1, 1, center, 1, 1)) { num2 = num3; num = i; } } } if (num2 < 20f) { projectile.Kill(); return(false); } if (num != -1) { projectile.ai[1] = 21f; projectile.ai[0] = (float)num; projectile.netUpdate = true; } } else if (projectile.ai[1] > 20f && projectile.ai[1] < 200f) { projectile.ai[1] += 1f; int num4 = (int)projectile.ai[0]; if (!Main.npc[num4].CanBeChasedBy(projectile, false)) { projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.netUpdate = true; } else { float num5 = Utils.ToRotation(projectile.velocity); Vector2 vector = Main.npc[num4].Center - projectile.Center; if (vector.Length() < 20f) { projectile.Kill(); return(false); } float num6 = Utils.ToRotation(vector); if (vector == Vector2.Zero) { num6 = num5; } float num7 = Utils.AngleLerp(num5, num6, 0.008f); projectile.velocity = Utils.RotatedBy(new Vector2(projectile.velocity.Length(), 0f), (double)num7, default(Vector2)); } } if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) { projectile.ai[1] += 1f; if (projectile.ai[1] == 20f) { projectile.ai[1] = 1f; } } projectile.alpha -= 40; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.spriteDirection = projectile.direction; projectile.frameCounter++; if (projectile.frameCounter >= 3) { projectile.frame++; projectile.frameCounter = 0; if (projectile.frame >= 4) { projectile.frame = 0; } } projectile.localAI[0] += 1f; if (projectile.localAI[0] == 12f) { projectile.localAI[0] = 0f; for (int j = 0; j < 12; j++) { Vector2 vector2 = Vector2.UnitX * -(float)projectile.width / 2f; vector2 += -Utils.RotatedBy(Vector2.UnitY, j * (Math.PI / 6)) * new Vector2(8f, 16f); vector2 = Utils.RotatedBy(vector2, (projectile.rotation - (Math.PI / 2))); int num8 = Dust.NewDust(projectile.Center, 0, 0, 6, 0f, 0f, 160); Main.dust[num8].scale = 1.1f; Main.dust[num8].noGravity = true; Main.dust[num8].position = projectile.Center + vector2; Main.dust[num8].velocity = projectile.velocity * 0.1f; Main.dust[num8].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num8].position) * 1.25f; } } if (Main.rand.Next(4) == 0) { for (int k = 0; k < 1; k++) { Vector2 value = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, (Math.PI / 16)), Utils.ToRotation(projectile.velocity)); int num9 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100); Main.dust[num9].velocity *= 0.1f; Main.dust[num9].noGravity = true; Main.dust[num9].position = projectile.Center + value * projectile.width * .5f; Main.dust[num9].fadeIn = 0.9f; } } if (Main.rand.Next(32) == 0) { for (int l = 0; l < 1; l++) { Vector2 value2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.39269909262657166), (double)Utils.ToRotation(projectile.velocity), default(Vector2)); int num10 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 155, default(Color), 0.8f); Main.dust[num10].velocity *= 0.3f; Main.dust[num10].noGravity = true; Main.dust[num10].position = projectile.Center + value2 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num10].fadeIn = 1.4f; } } } if (Main.rand.Next(2) == 0) { for (int m = 0; m < 2; m++) { Vector2 value3 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.78539818525314331), (double)Utils.ToRotation(projectile.velocity), default(Vector2)); int num11 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default(Color), 1.2f); Main.dust[num11].velocity *= 0.3f; Main.dust[num11].noGravity = true; Main.dust[num11].position = projectile.Center + value3 * (float)projectile.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num11].fadeIn = 1.4f; } } } return(true); }
public override void AI() { int num613 = 10; int num614 = 15; float num615 = 1f; int num616 = 150; int num617 = 42; if (Main.rand.Next(15) == 0) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 172, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.velocity.X != 0f) { projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); } projectile.frameCounter++; if (projectile.frameCounter > 2) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame >= 6) { projectile.frame = 0; } if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); projectile.width = (int)((float)num616 * projectile.scale); projectile.height = (int)((float)num617 * projectile.scale); projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (projectile.ai[1] != -1f) { projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); projectile.width = (int)((float)num616 * projectile.scale); projectile.height = (int)((float)num617 * projectile.scale); } if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.alpha -= 30; if (projectile.alpha < 60) { projectile.alpha = 60; } } else { projectile.alpha += 30; if (projectile.alpha > 150) { projectile.alpha = 150; } } if (projectile.ai[0] > 0f) { projectile.ai[0] -= 1f; } if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) { projectile.netUpdate = true; Vector2 center = projectile.Center; center.Y -= (float)num617 * projectile.scale / 2f; float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); } if (projectile.ai[0] <= 0f) { float num622 = 0.104719758f; float num623 = (float)projectile.width / 5f; float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); projectile.ai[0] -= 1f; num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); return; } }
public override bool PreAI() { { npc.spriteDirection = npc.direction; } { npc.TargetClosest(true); Player player = Main.player[npc.target]; Vector2 delta = player.position - npc.position; Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.4f, 1.07f, .66f); //64 pixel radius if (Math.Sqrt((delta.X * delta.X) + (delta.Y * delta.Y)) <= 250f && circling == false) //circle starting { npc.ai[1] = 0; //reset rotation npc.aiStyle = -1; circling = true; //launch circle action into effect } if (Math.Sqrt((delta.X * delta.X) + (delta.Y * delta.Y)) > 250f && circling == false) //normal AI { npc.aiStyle = 22; aiType = NPCID.Wraith; Counter++; if (Counter > 50) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); direction.X *= 5f; direction.Y *= 5f; int amountOfProjectiles = Main.rand.Next(1, 2); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-150, 150) * 0.03f; float B = (float)Main.rand.Next(-150, 150) * 0.03f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ProjectileID.Fireball, 28, 1, Main.myPlayer, 0, 0); Counter = 0; } } timer++; if (timer == 200) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X + 300f; npc.position.Y = player.position.Y - 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer == 400) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X - 300f; npc.position.Y = player.position.Y - 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer == 600) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X - 300f; npc.position.Y = player.position.Y + 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer >= 600) { timer = 0; } return(true); } if (Math.Sqrt((delta.X * delta.X) + (delta.Y * delta.Y)) > 500f && circling == true) //stop circling { circling = false; npc.velocity = Vector2.Zero; } if (circling == true) { double deg = (double)npc.ai[1]; //The degrees, you can multiply npc.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 = 250; //Distance away from the player Counter++; if (Counter > 100) { Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); direction.X *= 5f; direction.Y *= 5f; int amountOfProjectiles = Main.rand.Next(1, 2); for (int i = 0; i < amountOfProjectiles; ++i) { float A = (float)Main.rand.Next(-150, 150) * 0.03f; float B = (float)Main.rand.Next(-150, 150) * 0.03f; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ProjectileID.InfernoHostileBolt, 40, 1, Main.myPlayer, 0, 0); Counter = 0; } } /*Position the npc 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 npc's width / * /and height divided by two so the center of the npc is at the right place. */ target.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; target.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.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 npc.ai[1] += 1f; Vector2 Vel = target - npc.Center; Vel.Normalize(); Vel *= 4f; npc.velocity = Vel; timer++; if (timer == 200) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X + 300f; npc.position.Y = player.position.Y - 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer == 400) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X - 300f; npc.position.Y = player.position.Y - 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer == 600) { for (int i = 0; i < 50; ++i) //Create dust before teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 2f, 2f, ProjectileID.InfernoHostileBolt, 30, 1, Main.myPlayer, 0, 0); //Make projectilllllelelelelele npc.position.X = player.position.X - 300f; npc.position.Y = player.position.Y + 300f; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); npc.velocity.Y = direction.Y * 12f; npc.velocity.X = direction.X * 12f; for (int i = 0; i < 50; ++i) //Create dust after teleport { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); Main.dust[dust].scale = 1.5f; } } if (timer >= 600) { timer = 0; } return(true); } } return(true); }
public override void AI() { npc.spriteDirection = npc.direction; Player target = Main.player[npc.target]; Vector2 direction = Main.player[npc.target].Center - npc.Center; direction.Normalize(); direction.X *= 3.75f; direction.Y *= 8f; int distance = (int)Math.Sqrt((npc.Center.X - target.Center.X) * (npc.Center.X - target.Center.X) + (npc.Center.Y - target.Center.Y) * (npc.Center.Y - target.Center.Y)); if (!chargePhase && distance < 62) { npc.velocity.X = 0; npc.noGravity = false; if (target.position.X < npc.position.X) { npc.spriteDirection = -1; } else { npc.spriteDirection = 1; } frameTimer++; if (frameTimer >= 8) { frameTimer = 0; frame++; } if (frame > 10 || frame < 7) { frame = 7; } } else if (!chargePhase) { frameTimer++; if (frameTimer >= 6) { frameTimer = 0; frame++; } if (frame >= 7) { frame = 0; } } npc.localAI[1]++; if (npc.life >= npc.lifeMax * .4f) { if (npc.localAI[1] >= 340 && npc.localAI[1] < 400) { npc.velocity.X = 0f; npc.noGravity = false; if (target.position.X < npc.position.X) { npc.spriteDirection = -1; } else { npc.spriteDirection = 1; } if (Main.rand.Next(3) == 0) { Dust dust = Main.dust[Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, ModContent.DustType<Dusts.PoisonGas>(), npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, new Color(), 7f)]; dust.noGravity = true; dust.velocity.X = dust.velocity.X * 0.3f; dust.velocity.Y = (dust.velocity.Y * 0.2f) - 1; } } if (npc.localAI[1] == 360) { Main.PlaySound(SoundID.Grass, (int)npc.position.X, (int)npc.position.Y, 0); if (Main.netMode != NetmodeID.MultiplayerClient) { int amountOfProjectiles = Main.rand.Next(2, 4); for (int i = 0; i < amountOfProjectiles; ++i) { float A = Main.rand.Next(-60, 60) * 0.05f; float B = Main.rand.Next(-80, -10) * 0.05f; int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, -direction.Y + B, ModContent.ProjectileType<SnaptrapperSpore>(), 18, 1, Main.myPlayer, 0, 0); Main.projectile[p].hostile = true; Main.projectile[p].friendly = false; } } } if (npc.localAI[1] == 400) { Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 5); } if (npc.localAI[1] >= 400 && npc.localAI[1] <= 530) { npc.netUpdate = true; Charging(); if (npc.collideY) { for (int i = 0; i < 5; i++) { Dust dust = Main.dust[Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, ModContent.DustType<Dusts.PoisonGas>(), npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, new Color(), 5.3f)]; dust.noGravity = true; dust.velocity.X = dust.velocity.X * 0.3f; dust.velocity.Y = (dust.velocity.Y * 0.2f) - 1; } frame = 7; } else { frame = 8; } } else { chargePhase = false; npc.aiStyle = 3; aiType = NPCID.SnowFlinx; } if (npc.localAI[1] >= 800) { npc.localAI[1] = 0; } } else { if (npc.localAI[1] >= 240 && npc.localAI[1] < 300) { npc.velocity.X = 0f; npc.noGravity = false; if (target.position.X < npc.position.X) { npc.spriteDirection = -1; } else { npc.spriteDirection = 1; } if (Main.rand.Next(2) == 0) { Dust dust = Main.dust[Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, ModContent.DustType<Dusts.PoisonGas>(), npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, new Color(), 7f)]; dust.noGravity = true; dust.velocity.X = dust.velocity.X * 0.3f; dust.velocity.Y = (dust.velocity.Y * 0.2f) - 1; } } if (npc.localAI[1] == 260) { { Main.PlaySound(SoundID.Grass, (int)npc.position.X, (int)npc.position.Y, 0); } if (Main.netMode != NetmodeID.MultiplayerClient) { int amountOfProjectiles = Main.rand.Next(3, 6); for (int i = 0; i < amountOfProjectiles; ++i) { float A = Main.rand.Next(-60, 60) * 0.05f; float B = Main.rand.Next(-80, -10) * 0.05f; int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, -direction.Y + B, ModContent.ProjectileType<SnaptrapperSpore>(), 18, 1, Main.myPlayer, 0, 0); Main.projectile[p].hostile = true; Main.projectile[p].friendly = false; } } } if (npc.localAI[1] == 300) { Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 5); } if (npc.localAI[1] >= 300 && npc.localAI[1] <= 510) { if (npc.collideY && Main.rand.Next(6) == 0) { int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-2, 2), Main.rand.Next(-3, -1), ModContent.ProjectileType<SnaptrapperGas>(), 12, 1, Main.myPlayer, 0, 0); Main.projectile[p].hostile = true; Main.projectile[p].friendly = false; } npc.netUpdate = true; Charging(); ChargeFrames(); if (npc.collideY) { for (int i = 0; i < 5; i++) { Dust dust = Main.dust[Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, ModContent.DustType<Dusts.PoisonGas>(), npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, new Color(), 5.4f)]; dust.noGravity = true; dust.velocity.X = dust.velocity.X * 0.3f; dust.velocity.Y = (dust.velocity.Y * 0.2f) - 1; } frame = 7; } } else { chargePhase = false; npc.aiStyle = 3; aiType = NPCID.SnowFlinx; } if (npc.localAI[1] >= 540) { npc.localAI[1] = 0; } } }
public override void AI() { Player player = Main.player[projectile.owner]; Vector2 idlePosition = player.Center; idlePosition.X = player.Center.X - 7; idlePosition.Y = player.Center.Y - 6; float distanceToIdlePosition = (idlePosition - projectile.Center).Length(); if (Main.myPlayer == player.whoAmI && distanceToIdlePosition > 2000f) { projectile.position = idlePosition; projectile.velocity *= 0.1f; projectile.netUpdate = true; } projectile.position = idlePosition; float projectileAngle = (Main.MouseWorld - projectile.position).ToRotation() % 6.28318548f; if (projectileAngle < 1.57079637f && projectileAngle > -1.57079637f) { projectile.rotation = projectileAngle; projectile.spriteDirection = 1; } else { projectile.rotation = projectileAngle + 3.14159274f; projectile.spriteDirection = -1; } Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 0.78f); if (projectile.owner == Main.myPlayer) { if (player.velocity.Y != 0) { int dustIndex = Dust.NewDust(new Vector2(projectile.position.X - 5, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default(Color), 2f); Main.dust[dustIndex].scale *= 0.925f; Main.dust[dustIndex].noGravity = true; int dustFeet = Dust.NewDust(new Vector2(projectile.position.X - 5, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default(Color), 2f); Main.dust[dustFeet].scale *= 0.625f; Main.dust[dustFeet].noGravity = true; Main.PlaySound(SoundID.Item13, projectile.position); player.GetModPlayer <HollowPlayer>().desolateDiveFall = true; } if (player.velocity.Y == 0f && player.oldVelocity.Y == 0f && !(player.mount.CanFly && player.mount.Active)) { player.GetModPlayer <HollowPlayer>().desolateDiveFall = false; player.GetModPlayer <HollowPlayer>().shakeTimer = 27; Main.PlaySound(SoundID.Item13, projectile.position); Projectile.NewProjectile(player.Center, new Vector2(0f, 0f), mod.ProjectileType("DesolateDivePound"), 150 * 3, 10.5f, projectile.owner); projectile.netUpdate = true; fallTimer = 0; Main.PlaySound(SoundLoader.customSoundType, (int)projectile.Center.X, (int)projectile.Center.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/Custom/Splat")); for (int i = 0; i < 12; i++) { int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default(Color), 2f); Main.dust[dustIndex].scale *= 0.85f; Main.dust[dustIndex].noGravity = true; } projectile.Kill(); } } }
public override void MeleeEffects(Player player, Rectangle hitbox) { int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 60); }
public override void AI() { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); int dust2 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); Main.dust[dust].noGravity = true; Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity *= 0f; Main.dust[dust2].velocity *= 0f; Main.dust[dust2].scale = 0.9f; Main.dust[dust].scale = 0.9f; bool flag64 = projectile.type == mod.ProjectileType("Terror3Summon"); Player player = Main.player[projectile.owner]; MyPlayer modPlayer = player.GetModPlayer <MyPlayer>(mod); if (flag64) { if (player.dead) { modPlayer.terror3Summon = false; } if (modPlayer.terror3Summon) { projectile.timeLeft = 2; } } for (int num526 = 0; num526 < 1000; num526++) { if (num526 != projectile.whoAmI && Main.projectile[num526].active && Main.projectile[num526].owner == projectile.owner && Main.projectile[num526].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[num526].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num526].position.Y) < (float)projectile.width) { if (projectile.position.X < Main.projectile[num526].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[num526].position.Y) { projectile.velocity.Y = projectile.velocity.Y - 0.05f; } else { projectile.velocity.Y = projectile.velocity.Y + 0.05f; } } } float num527 = projectile.position.X; float num528 = projectile.position.Y; float num529 = 900f; bool flag19 = false; int num530 = 500; if (projectile.ai[1] != 0f || projectile.friendly) { num530 = 1400; } //if (Math.Abs(Projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(Projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num530) //{ // projectile.ai[0] = 1f; //} if (projectile.ai[0] == 0f) { for (int num531 = 0; num531 < 200; num531++) { if (Main.npc[num531].CanBeChasedBy(projectile, false)) { float num532 = Main.npc[num531].position.X + (float)(Main.npc[num531].width / 2); float num533 = Main.npc[num531].position.Y + (float)(Main.npc[num531].height / 2); float num534 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num532) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num533); if (num534 < num529 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num531].position, Main.npc[num531].width, Main.npc[num531].height)) { num529 = num534; num527 = num532; num528 = num533; flag19 = true; } } } } else { projectile.tileCollide = false; } if (!flag19) { projectile.friendly = true; float num535 = 8f; if (projectile.ai[0] == 1f) { num535 = 12f; } Vector2 vector38 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float num536 = Main.player[projectile.owner].Center.X - vector38.X; float num537 = Main.player[projectile.owner].Center.Y - vector38.Y - 60f; float num538 = (float)Math.Sqrt((double)(num536 * num536 + num537 * num537)); if (num538 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; } if (num538 > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); } if (num538 > 70f) { num538 = num535 / num538; num536 *= num538; num537 *= num538; projectile.velocity.X = (projectile.velocity.X * 20f + num536) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num537) / 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; 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 num539 = 8f; Vector2 vector39 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float num540 = num527 - vector39.X; float num541 = num528 - vector39.Y; float num542 = (float)Math.Sqrt((double)(num540 * num540 + num541 * num541)); if (num542 < 100f) { num539 = 10f; } num542 = num539 / num542; num540 *= num542; num541 *= num542; projectile.velocity.X = (projectile.velocity.X * 14f + num540) / 15f; projectile.velocity.Y = (projectile.velocity.Y * 14f + num541) / 15f; } else { projectile.friendly = false; if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) { projectile.velocity *= 1.05f; } } 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; } else if (projectile.frame > 7) { projectile.frame = 4; } if (Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; return; } } if (projectile.frameCounter < 8) { projectile.frame = 0; } else if (projectile.frameCounter >= 8 && projectile.frameCounter < 10) { projectile.frame = 1; } else { projectile.frameCounter = 0; } projectile.frameCounter++; if (Main.rand.Next(50) == 0) { float num = 8000f; int num2 = -1; for (int i = 0; i < 200; i++) { float num3 = Vector2.Distance(projectile.Center, Main.npc[i].Center); if (num3 < num && num3 < 640f && Main.npc[i].CanBeChasedBy(projectile, false)) { num2 = i; num = num3; } } if (num2 != -1) { bool flag = Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num2].position, Main.npc[num2].width, Main.npc[num2].height); if (flag) { Vector2 value = Main.npc[num2].Center - projectile.Center; float num4 = 5f; float num5 = (float)Math.Sqrt((double)(value.X * value.X + value.Y * value.Y)); if (num5 > num4) { num5 = num4 / num5; } value *= num5; int p = Terraria.Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value.X, value.Y, mod.ProjectileType("WitherShard2"), 34, projectile.knockBack / 2f, projectile.owner, 0f, 0f); Main.projectile[p].friendly = true; Main.projectile[p].hostile = false; } } } }
public override void OnHitTarget(NPC target) { framesInAir = Math.Max(framesInAir, 12); // force a return shortly after hitting a target Dust.NewDust(projectile.position, 16, 16, DustID.PinkCrystalShard, projectile.velocity.X / 2, projectile.velocity.Y / 2); }
public override void AI() { projectile.localAI[1] += 1; if (projectile.localAI[1] > 60) { projectile.aiStyle = -1; projectile.velocity *= 0.90f; if ((int)projectile.localAI[1] % 30 == 0) { SoundEffectInstance sound = Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 25); if (sound != null) { sound.Pitch += (projectile.localAI[1] - 60) / 420f; } } for (int num654 = 0; num654 < 1 + projectile.localAI[1] / 9f; num654++) { Vector2 randomcircle = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, 8000)); randomcircle.Normalize(); Vector2 ogcircle = randomcircle; randomcircle *= (float)(num654 / 9.00); Dust num655 = Dust.NewDustPerfect(projectile.Center + new Vector2(2, 2) + ogcircle * 10f, 59, -projectile.velocity + randomcircle * 2f, 150, Color.Aqua, 1.5f); num655.noGravity = true; num655.noLight = true; } if (projectile.localAI[1] > 360) { NPC FakeNPC = new NPC(); FakeNPC.SetDefaults(ModContent.NPCType <Cirno>()); if (Main.netMode == NetmodeID.SinglePlayer) { int npc = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 24, ModContent.NPCType <Cirno>()); } else { if (Main.netMode != NetmodeID.Server && Main.myPlayer == projectile.owner) { ModPacket packet = mod.GetPacket(); packet.Write((ushort)999); packet.Write((int)projectile.Center.X); packet.Write((int)projectile.Center.Y); packet.Write(ModContent.NPCType <NPCs.Cirno>()); packet.Write(0); packet.Write(0); packet.Write(0); packet.Write(0); packet.Write(projectile.owner); packet.Send(); } } string typeName2 = FakeNPC.TypeName; if (Main.netMode == 0) { Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName2), 175, 75); } else if (Main.netMode == 2) { NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", FakeNPC.GetTypeNetName()), new Color(175, 75, 255)); } Main.PlaySound(SoundID.Roar, (int)projectile.position.X, (int)projectile.position.Y, 0); for (float num654 = 0; num654 < 25 + projectile.localAI[1] / 10f; num654 += 0.25f) { Vector2 randomcircle = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, 8000)); randomcircle.Normalize(); Vector2 ogcircle = randomcircle; randomcircle *= (float)(num654 / 10.00); int num655 = Dust.NewDust(projectile.Center + new Vector2(2, 2) + ogcircle * 16f, 0, 0, 88, -projectile.velocity.X + randomcircle.X * 6f, -projectile.velocity.Y + randomcircle.Y * 6f, 150, Color.Aqua, 1.6f); Main.dust[num655].noGravity = true; Main.dust[num655].noLight = true; } projectile.Kill(); } } }
public override void AI() { int dustnumber = Dust.NewDust(projectile.position, projectile.width, projectile.height, 228); }
public override void AI() { Player player = Main.player[projectile.owner]; projectile.frameCounter++; if (projectile.frameCounter >= 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame >= (int)Main.projFrames[projectile.type]) { projectile.frame = 0; } if (projectile.timeLeft > 30 && projectile.alpha > 0) { projectile.alpha -= 12; } if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.alpha = 128; } if (projectile.alpha < 0) { projectile.alpha = 0; } Vector2 vector = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); Vector2 vector2 = new Vector2(player.position.X + (float)player.width * 0.5f, player.position.Y + (float)player.height * 0.5f); float newMoveToX = vector2.X - vector.X; float newMoveToY = vector2.Y - vector.Y; float newDistance = (float)Math.Sqrt((double)newMoveToX * (double)newMoveToX + (double)newMoveToY * (double)newMoveToY); float speed = 5.0f; projectile.velocity.X = (float)(((double)projectile.velocity.X * 20.0 + (double)newMoveToX * (speed / newDistance)) / 21.0); projectile.velocity.Y = (float)(((double)projectile.velocity.Y * 20.0 + (double)newMoveToY * (speed / newDistance)) / 21.0); if (player.active && ((double)Vector2.Distance(player.Center, projectile.Center) < 25.0)) { player.AddBuff(mod.BuffType("EmeraldEssence"), 300, true); projectile.Kill(); } float ai2 = 0.5f; if (projectile.timeLeft < 120) { ai2 = 1.1f; } if (projectile.timeLeft < 60) { ai2 = 1.6f; } ++projectile.ai[0]; double ai = (double)projectile.ai[0] / 180.0; for (float k = 0.0f; (double)k < 3.0; k++) { if (Main.rand.Next(3) == 0) { Dust dust = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 61, 0.0f, -2.0f, 0, new Color(), 1.0f)]; dust.position = projectile.Center + Vector2.UnitY.RotatedBy((double)k * 6.28318548202515 / 3.0 + (double)projectile.ai[0], new Vector2()) * 10.0f; dust.noGravity = true; dust.velocity = projectile.DirectionFrom(dust.position); dust.scale = ai2; dust.fadeIn = 0.5f; dust.alpha = 200; } } }
public override bool PreAI() { if (Projectile.ai[0] == 1) { Projectile.ai[1]++; Projectile.rotation += Projectile.direction * -0.4f; if (Projectile.ai[1] <= 50) { Projectile.velocity = Vector2.Lerp(Projectile.velocity, Vector2.Zero, 0.1f); //fire lasers at cursor if (Projectile.ai[1] % 10 == 0) { Vector2 cursor = Main.MouseWorld; Vector2 velocity = Vector2.Normalize(cursor - Projectile.Center); if (Projectile.ai[1] > 10) { velocity = velocity.RotatedByRandom(Math.PI / 24); } float num = 24f; for (int index1 = 0; index1 < num; ++index1) { int type = 235; Vector2 v = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy(index1 * (MathHelper.TwoPi / num), new Vector2()) * new Vector2(1f, 4f)).RotatedBy(velocity.ToRotation()); int index2 = Dust.NewDust(Projectile.Center, 0, 0, type, 0.0f, 0.0f, 150, new Color(255, 153, 145), 1f); Main.dust[index2].scale = 1.5f; Main.dust[index2].fadeIn = 1.3f; Main.dust[index2].noGravity = true; Main.dust[index2].position = Projectile.Center + (v * Projectile.scale * 1.5f); Main.dust[index2].velocity = v.SafeNormalize(Vector2.UnitY); } Player player = Main.player[Projectile.owner]; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType <RetiDeathray>(), Projectile.damage, 1f, Projectile.owner, 0, Projectile.identity); Projectile.velocity = -velocity * 8; if (empowered) { float baseRotation = Main.rand.NextFloat(MathHelper.TwoPi); const int max = 3; for (int i = 0; i < max; i++) { int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 1.25f * velocity.RotatedBy(MathHelper.TwoPi / max * i + baseRotation), ModContent.ProjectileType <DarkStarHomingFriendly>(), Projectile.damage, 1f, Projectile.owner, -1, 0); if (p != Main.maxProjectiles) { Main.projectile[p].DamageType = DamageClass.Melee; Main.projectile[p].timeLeft = 90; } } } } } if (Projectile.ai[1] > 60) { Projectile.ai[1] = 15; Projectile.ai[0] = 2; } return(false); } return(true); }
public override void Update(Player player, ref int buffIndex) { if (Main.rand.Next(20) == 0) { int num1 = Dust.NewDust(player.position, player.width, player.height, 14); Main.dust[num1].scale = 1.5f; Main.dust[num1].velocity *= 3f; Main.dust[num1].noGravity = true; } player.statDefense -= 10; player.meleeDamage *= 0.95f; player.minionDamage *= 0.95f; player.rangedDamage *= 0.95f; player.magicDamage *= 0.95f; player.thrownDamage *= 0.95f; if (Main.rand.Next(2000) == 0) { int choice = Main.rand.Next(12); if (choice == 0) { Main.NewText("Death will consume all.", Color.Purple.R, Color.Purple.G, Color.Purple.B); Main.NewText("Void Leviathan has awoken!", Color.MediumPurple.R, Color.MediumPurple.G, Color.MediumPurple.B); Main.PlaySound(15, (int)player.Center.X, (int)player.Center.Y, 0, 1f, 0f); } else if (choice == 1) { Main.NewText("Impending doom approaches...", Color.PaleGreen.R, Color.PaleGreen.G, Color.PaleGreen.B); } else if (choice == 2) { Main.NewText("You're not ready for this", Color.Red.R, Color.Red.G, Color.Red.B); } else if (choice == 3) { Main.NewText("Leave", Color.Red.R, Color.Red.G, Color.Red.B); } else if (choice == 4) { Main.PlaySound(4, (int)player.Center.X, (int)player.Center.Y, 62, 1f, 0f); } else if (choice == 5) { Main.PlaySound(4, (int)player.Center.X, (int)player.Center.Y, 59, 1f, 0f); } else if (choice == 6) { Main.PlaySound(4, (int)player.Center.X, (int)player.Center.Y, 51, 1f, 0f); } else if (choice == 7) { Main.PlaySound(15, (int)player.Center.X, (int)player.Center.Y, 0, 1f, 0f); } else if (choice == 8) { Main.PlaySound(15, (int)player.Center.X, (int)player.Center.Y, 2, 1f, 0f); } else if (choice == 9) { Main.PlaySound(29, (int)player.Center.X, (int)player.Center.Y, 105, 1f, 0f); } else if (choice == 10) { Main.PlaySound(29, (int)player.Center.X, (int)player.Center.Y, 104, 1f, 0f); } else if (choice == 11) { int guide = NPC.FindFirstNPC(NPCID.Guide); if (guide >= 0 && Main.rand.Next(5) == 0) { Main.NewText(Main.npc[guide].GivenName + "the Guide was slain...", Color.Red.R, Color.Red.G, Color.Red.B); } } } if (Main.rand.Next(1500) == 0) { int add1 = 0; int choice = Main.rand.Next(2); if (choice == 0) { add1 = Main.rand.Next(750, 2000); } else if (choice == 1) { add1 = Main.rand.Next(-2000, -750); } int type = 0; int choice2 = Main.rand.Next(6); if (choice2 == 0) { type = 524; // ghoul } else if (choice2 == 1) { type = 524; // ghoul //type = 480; // medusa // can hurt u so dont do this one } else if (choice2 == 2) { type = 258; // ladybug } else if (choice2 == 3) { type = 93; // giant bat } else if (choice2 == 4) { type = 78; // mummy } else if (choice2 == 5) { type = 34; // cursed skull } int random = NPC.NewNPC((int)player.Center.X + add1, (int)player.Center.Y - 800, type); NPC npc = Main.npc[random]; npc.color = new Color(66, 66, 66); npc.alpha = 200; npc.damage = 0; npc.lifeMax = 10; npc.life = 10; npc.DeathSound = SoundID.NPCDeath6; } }
public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.width = 80; projectile.height = 80; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.Next(2) == 0) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 35; num623++) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num624].velocity *= 2f; } for (int num625 = 0; num625 < 3; num625++) { float scaleFactor10 = 0.33f; if (num625 == 1) { scaleFactor10 = 0.66f; } else if (num625 == 2) { scaleFactor10 = 1f; } int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; } projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.width = 10; projectile.height = 10; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); }
/// <summary> /// The AI of the projectile /// </summary> public override void AI() { Vector2 mousePos = Main.MouseWorld; Player player = Main.player[projectile.owner]; #region Set projectile position if (projectile.owner == Main.myPlayer) // Multiplayer support { Vector2 diff = mousePos - player.Center; diff.Normalize(); projectile.velocity = diff; projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; projectile.netUpdate = true; } projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; projectile.timeLeft = 2; int dir = projectile.direction; player.ChangeDir(dir); player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * dir, projectile.velocity.X * dir); #endregion #region Charging process // Kill the projectile if the player stops channeling if (!player.channel) { projectile.Kill(); ((AlchemistNPCPlayer)player.GetModPlayer(mod, "AlchemistNPCPlayer")).chargetime = 0; } else { if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true)) { projectile.Kill(); ((AlchemistNPCPlayer)player.GetModPlayer(mod, "AlchemistNPCPlayer")).chargetime = 0; } Vector2 offset = projectile.velocity; offset *= MOVE_DISTANCE - 20; Vector2 pos = player.Center + offset - new Vector2(10, 10); if (Charge < MAX_CHARGE) { Charge++; } int chargeFact = (int)(Charge / 20f); Vector2 dustVelocity = Vector2.UnitX * 18f; dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f, default(Vector2)); Vector2 spawnPos = projectile.Center + dustVelocity; for (int k = 0; k < chargeFact + 1; k++) { Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - (chargeFact * 2)); Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 57, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 0, default(Color), 1f)]; dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; dust.noGravity = true; dust.scale = Main.rand.Next(10, 20) * 0.05f; } } #endregion #region Set laser tail position and dusts if (Charge < MAX_CHARGE) return; Vector2 start = player.Center; Vector2 unit = projectile.velocity; unit *= -1; for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f) { start = player.Center + projectile.velocity * Distance; if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1)) { Distance -= 5f; break; } } Vector2 dustPos = player.Center + projectile.velocity * Distance; //Imported dust code from source because I'm lazy for (int i = 0; i < 2; ++i) { float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f); Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2); Dust dust = Main.dust[Dust.NewDust(dustPos, 0, 0, 57, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; dust.noGravity = true; dust.scale = 1.2f; // At this part, I was messing with the dusts going across the laser beam very fast, but only really works properly horizontally now dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + unit * 5f, 0, 0, 57, unit.X, unit.Y, 0, new Color(), 1f)]; dust.fadeIn = 0f; dust.noGravity = true; dust.scale = 0.88f; } if (Main.rand.Next(5) == 0) { Vector2 offset = projectile.velocity.RotatedBy(1.57f, new Vector2()) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; Dust dust = Main.dust[Dust.NewDust(dustPos + offset - Vector2.One * 4f, 8, 8, 57, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity = dust.velocity * 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); unit = dustPos - Main.player[projectile.owner].Center; unit.Normalize(); dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + 55 * unit, 8, 8, 57, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity = dust.velocity * 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); } #endregion //Add lights DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE), 26, new Utils.PerLinePoint(DelegateMethods.CastLight)); if (MAX_CHARGE >= 30) { supercharge++; if (supercharge >= 180) { hypercharge++; } } }
public override void AI() { int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6); npc.spriteDirection = npc.direction; }
public override void AI() { Player player = Main.player[projectile.owner]; if (player != Main.player[Main.myPlayer]) { projectile.active = false; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 65) { projectile.frame = 1; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 70) { projectile.frame = 2; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 75) { projectile.frame = 3; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 80) { projectile.frame = 4; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 85) { projectile.frame = 5; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 90) { projectile.frame = 6; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 95) { projectile.frame = 7; } if (player.GetModPlayer <OrchidModPlayer>().timer120 == 100) { projectile.frame = 0; } if (player.GetModPlayer <OrchidModPlayer>().shamanOrbSmall != ShamanOrbSmall.CORRUPTION || player.GetModPlayer <OrchidModPlayer>().orbCountSmall == 0) { projectile.Kill(); } if (projectile.timeLeft == 12960000) { int nbOrb = player.GetModPlayer <OrchidModPlayer>().orbCountSmall; int offsetX = 7; if (nbOrb == 1) { startX = -15 - offsetX; startY = -20 - offsetX; } if (nbOrb == 2) { startX = +0 - offsetX; startY = -25 - offsetX; } if (nbOrb == 3) { startX = +15 - offsetX; startY = -20 - offsetX; } if (projectile.damage != 0) { projectile.damage = 0; startX = -15 - offsetX; startY = -20 - offsetX; } } projectile.velocity.X = player.velocity.X; projectile.position.X = player.position.X + player.width / 2 + startX; projectile.position.Y = player.position.Y + startY; if (Main.rand.Next(20) == 0) { int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27); Main.dust[dust].velocity /= 3f; Main.dust[dust].scale = 1f; Main.dust[dust].noGravity = true; } }
public override void Update(NPC npc, ref int buffIndex) { int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.CopperCoin); Main.dust[dust].scale = 2.9f; Main.dust[dust].velocity *= 3f; Main.dust[dust].noGravity = true; }