public override bool CanUseItem(Player player) => !NPC.AnyNPCs(ModContent.NPCType <StarjinxMeteorite>());
public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() - (float)Math.PI / 2; if (Projectile.localAI[0] == 0) //choose a texture to use { Projectile.localAI[0] += Main.rand.Next(1, 4); } if (Projectile.timeLeft % Projectile.MaxUpdates == 0) { //if (Projectile.timeLeft < 45 * Projectile.MaxUpdates) Projectile.velocity *= 1.015f; if (++Projectile.frameCounter >= 6) { Projectile.frameCounter = 0; if (++Projectile.frame >= Main.projFrames[Projectile.type]) { Projectile.frame = 0; } } } if (++Projectile.localAI[1] > 10 && FargoSoulsUtil.BossIsAlive(ref NPCs.EModeGlobalNPC.mutantBoss, ModContent.NPCType <NPCs.MutantBoss.MutantBoss>())) { float yOffset = Projectile.Center.Y - Main.npc[NPCs.EModeGlobalNPC.mutantBoss].Center.Y; if (Math.Sign(yOffset) == Math.Sign(Projectile.velocity.Y) && Projectile.Distance(Main.npc[NPCs.EModeGlobalNPC.mutantBoss].Center) > 1200 + Projectile.ai[0]) { Projectile.timeLeft = 0; } } }
public override void HitWire(int i, int j) { // Find the coordinates of top left tile square through math int y = j - Main.tile[i, j].frameY / 18; int x = i - Main.tile[i, j].frameX / 18; Wiring.SkipWire(x, y); Wiring.SkipWire(x, y + 1); Wiring.SkipWire(x, y + 2); Wiring.SkipWire(x + 1, y); Wiring.SkipWire(x + 1, y + 1); Wiring.SkipWire(x + 1, y + 2); // We add 16 to x to spawn right between the 2 tiles. We also want to right on the ground in the y direction. int spawnX = x * 16 + 16; int spawnY = (y + 3) * 16; // This example shows both item spawning code and npc spawning code, you can use whichever code suits your mod // If you want to make an NPC spawning statue, see below. int npcIndex = -1; // 30 is the time before it can be used again. NPC.MechSpawn checks nearby for other spawns to prevent too many spawns. 3 in immediate vicinity, 6 nearby, 10 in world. if (Wiring.CheckMech(x, y, 30) && NPC.MechSpawn((float)spawnX, (float)spawnY, (ModContent.NPCType <PlagueFrog>()))) { npcIndex = NPC.NewNPC(spawnX, spawnY - 12, (ModContent.NPCType <PlagueFrog>())); } if (npcIndex >= 0) { Main.npc[npcIndex].value = 0f; Main.npc[npcIndex].npcSlots = 0f; // Prevents Loot if NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue and !Main.HardMode or NPCID.Sets.StatueSpawnedDropRarity != -1 and NextFloat() >= NPCID.Sets.StatueSpawnedDropRarity or killed by traps. // Prevents CatchNPC Main.npc[npcIndex].SpawnedFromStatue = true; } }
public override void AI() { projectile.velocity = Vector2.Zero; if (!firsttick) { for (int i = 0; i < 8; i++) { Vector2 dir = Vector2.UnitX.RotatedBy(2 * (float)Math.PI / 8 * i); Vector2 vel = Vector2.Normalize(dir); Projectile.NewProjectile(projectile.Center, vel, mod.ProjectileType("TerraLightningOrbDeathray"), projectile.damage, 0, Main.myPlayer, dir.ToRotation(), projectile.whoAmI); } projectile.rotation = projectile.localAI[0]; firsttick = true; } if (projectile.localAI[0] > 0) //rotate fast, then slow down over time { projectile.rotation += projectile.localAI[1] * (6 - projectile.scale) * 0.012f; } int ai0 = (int)projectile.ai[0]; if (ai0 > -1 && ai0 < Main.maxNPCs && Main.npc[ai0].active && Main.npc[ai0].type == ModContent.NPCType <NPCs.Champions.TerraChampion>()) { projectile.alpha -= 10; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = 4f * projectile.DirectionTo(Main.player[Main.npc[ai0].target].Center); if (++projectile.ai[1] > 60) //grow { projectile.ai[1] = 0; projectile.netUpdate = true; projectile.position = projectile.Center; projectile.width = (int)(projectile.width / projectile.scale); projectile.height = (int)(projectile.height / projectile.scale); projectile.scale++; projectile.width = (int)(projectile.width * projectile.scale); projectile.height = (int)(projectile.height * projectile.scale); projectile.Center = projectile.position; MakeDust(); Main.PlaySound(SoundID.Item92, projectile.Center); } } else { if (projectile.timeLeft < 2) { projectile.timeLeft = 2; } projectile.alpha += 10; if (projectile.alpha > 255) { projectile.alpha = 255; projectile.Kill(); } } Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); projectile.frameCounter++; if (projectile.frameCounter > 3) { projectile.frameCounter = 0; projectile.frame++; if (projectile.frame > 3) { projectile.frame = 0; } } if (Main.rand.Next(3) == 0) { float num11 = (float)(Main.rand.NextDouble() * 1.0 - 0.5); //vanilla dust :echbegone: if ((double)num11 < -0.5) { num11 = -0.5f; } if ((double)num11 > 0.5) { num11 = 0.5f; } Vector2 vector21 = new Vector2((float)-projectile.width * 0.2f * projectile.scale, 0.0f).RotatedBy((double)num11 * 6.28318548202515, new Vector2()).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index21 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 226, (float)(-(double)projectile.velocity.X / 3.0), (float)(-(double)projectile.velocity.Y / 3.0), 150, Color.Transparent, 0.7f); Main.dust[index21].position = projectile.Center + vector21 * projectile.scale; Main.dust[index21].velocity = Vector2.Normalize(Main.dust[index21].position - projectile.Center) * 2f; Main.dust[index21].noGravity = true; float num1 = (float)(Main.rand.NextDouble() * 1.0 - 0.5); if ((double)num1 < -0.5) { num1 = -0.5f; } if ((double)num1 > 0.5) { num1 = 0.5f; } Vector2 vector2 = new Vector2((float)-projectile.width * 0.6f * projectile.scale, 0.0f).RotatedBy((double)num1 * 6.28318548202515, new Vector2()).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()); int index2 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 226, (float)(-(double)projectile.velocity.X / 3.0), (float)(-(double)projectile.velocity.Y / 3.0), 150, Color.Transparent, 0.7f); Main.dust[index2].velocity = Vector2.Zero; Main.dust[index2].position = projectile.Center + vector2 * projectile.scale; Main.dust[index2].noGravity = true; } }
public override bool CanUseItem(Player player) => player.ZoneDesert && LaugicalityWorld.downedEtheria && NPC.CountNPCS(ModContent.NPCType <DuneSharkron>()) < 1;
public override void RightClick(Player player) { Main.npc[NPC.NewNPC((int)player.Center.X + player.direction * 30, (int)player.Center.Y, ModContent.NPCType <CopperChestBottom>(), 0)].netUpdate = true; }
public static void DrawFog() { DrawOverride.fogeffect += 1; bool isMurk = NPC.CountNPCS(ModContent.NPCType <Murk>()) > 0; if (DrawOverride.fogeffect < 120 || Main.dedServ) { return; } BlendState blind = new BlendState { ColorSourceBlend = Blend.Zero, ColorDestinationBlend = Blend.InverseSourceColor, AlphaSourceBlend = Blend.Zero, AlphaDestinationBlend = Blend.InverseSourceColor }; if (!Main.dedServ) { int lightingtotal = Main.LocalPlayer.GetModPlayer <SGADimPlayer>().lightSize; Matrix Custommatrix = Matrix.CreateScale(Main.screenWidth / 1920f, Main.screenHeight / 1024f, 0f); RenderTargetBinding[] binds = Main.graphics.GraphicsDevice.GetRenderTargets(); if (lightingtotal < 2600 && (!isMurk || (!SGAConfigClient.Instance.Murklite && isMurk))) { int fogDetail = Math.Max((SGAConfigClient.Instance.FogDetail) / 5, 1); float fogAlpha = 0.04f * (6f / (float)fogDetail); //Draw Texture Parts //Main.spriteBatch.End(); Main.graphics.GraphicsDevice.SetRenderTarget(SGAmod.drawnscreen); Main.graphics.GraphicsDevice.Clear(Color.Transparent); Texture2D pern = ModContent.GetTexture("SGAmod/Perlin"); Main.spriteBatch.Begin(SpriteSortMode.Texture, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Custommatrix); Main.spriteBatch.Draw(Main.blackTileTexture, new Vector2(0, 0), new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black, 0, new Vector2(0, 0), new Vector2(1f, 1f), SpriteEffects.None, 0f); if (SGAPocketDim.WhereAmI != null && SGAPocketDim.WhereAmI == typeof(SpaceDim)) { //pern = ModContent.GetTexture("SGAmod/Space"); //Main.spriteBatch.Draw(pern, Vector2.Zero, null, Color.White * 1f, 0, Vector2.Zero, new Vector2(Main.screenWidth / (float)pern.Width, Main.screenHeight / (float)pern.Height), SpriteEffects.None, 0f); SpaceSky.StarryNebulaSky(); goto skipdraw; } if (isMurk) { Murk.MurkFog(); } else { Main.spriteBatch.Draw(pern, new Vector2(Main.screenWidth, Main.screenHeight) / 2f, null, (Main.hslToRgb((Main.GlobalTime / 3) % 1f, 1f, 0.75f)).MultiplyRGB(Color.Lerp(Color.Black, Color.White, 0.50f)) * 0.5f, Main.GlobalTime * 0.24f, new Vector2(pern.Width / 2, pern.Height / 2), new Vector2(5f, 5f), SpriteEffects.None, 0f); Main.spriteBatch.Draw(pern, new Vector2(Main.screenWidth, Main.screenHeight) / 2f, null, Main.hslToRgb(((Main.GlobalTime + 1.5f) / 3) % 1f, 1f, 0.75f).MultiplyRGB(Color.Lerp(Color.Black, Color.White, 0.50f)) * 0.5f, Main.GlobalTime * -0.24f, new Vector2(pern.Width / 2, pern.Height / 2), new Vector2(5f, 5f), SpriteEffects.None, 0f); } skipdraw: Main.spriteBatch.End(); //Draw Additive Parts Main.graphics.GraphicsDevice.SetRenderTarget(SGAmod.drawnscreenAdditiveTextures); Main.graphics.GraphicsDevice.Clear(Color.Transparent); pern = ModContent.GetTexture("SGAmod/Extra_49c"); //Yay, finally we have Additive Blending! No more nega-blending! Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix); Vector2 half = new Vector2(pern.Width / 2, pern.Height / 2); foreach (PostDrawCollection postdraw in SGAmod.PostDraw) { Vector3 vecx = postdraw.light; float size = vecx.Z / pern.Width; Main.spriteBatch.Draw(pern, new Vector2(vecx.X, vecx.Y) - Main.screenPosition, null, Color.White, 0, half, new Vector2(1.5f, 1.5f) * size, SpriteEffects.None, 0f); for (float scale = 1f; scale < 2f; scale += 0.25f) { for (int i = 0; i < 360; i += 360 / fogDetail) { Main.spriteBatch.Draw(pern, new Vector2(vecx.X, vecx.Y) - Main.screenPosition, null, Color.White * fogAlpha, MathHelper.ToRadians(i), half, new Vector2(1.25f, 1.5f) * size * scale, SpriteEffects.None, 0f); } } //for (int i = 0; i < Main.maxNPCs; i += 1) //{ // if (Main.npc[i].active && Main.npc[i].townNPC) // { // for (int x = 0; x < 360; x += 360 / 30) // Main.spriteBatch.Draw(pern, (Main.npc[i].Center) - Main.screenPosition, null, Color.White * 0.25f, MathHelper.ToRadians(x), new Vector2(pern.Width / 2, pern.Height / 2), new Vector2(7f, 7f), SpriteEffects.None, 0f); // } //} //pern = ModContent.GetTexture("SGAmod/Extra_49"); /* * * for (int i = 0; i < 360; i += 360 / 30) * { * float sizer = 1f - (i / 1000f); * Main.spriteBatch.Draw(pern, new Vector2(vecx.X, vecx.Y) - Main.screenPosition, null, Color.White * 0.1f, MathHelper.ToRadians(i) + (Main.GlobalTime * ((i % (360 / 15)) == 0 ? 0.25f : -0.25f)), new Vector2(pern.Width / 2, pern.Height / 2), (new Vector2(1f, 1f) * size) * sizer, SpriteEffects.None, 0f); * } */ } Main.spriteBatch.End(); } SGAmod.postRenderEffectsTargetDoUpdates--; if (SGAmod.postRenderEffectsTargetDoUpdates < -4) { SGAmod.postRenderEffectsTargetDoUpdates = 1; } if (SGAmod.postRenderEffectsTargetDoUpdates > 0) { swaptargets = (swaptargets + 1) % 2; RenderTarget2D target = swaptargets == 0 ? SGAmod.postRenderEffectsTarget : SGAmod.postRenderEffectsTargetCopy; RenderTarget2D targetOther = swaptargets == 1 ? SGAmod.postRenderEffectsTarget : SGAmod.postRenderEffectsTargetCopy; Main.graphics.GraphicsDevice.SetRenderTarget(target); Main.graphics.GraphicsDevice.Clear(Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.Identity); //Main.spriteBatch.Begin(SpriteSortMode.Immediate, blind, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix); Main.spriteBatch.Draw(targetOther, new Vector2(0, 0), null, Color.Black * 0.96f, 0, new Vector2(0, 0), new Vector2(1f, 1f), SpriteEffects.None, 0f); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); foreach (Projectile proj in Main.projectile.Where(proj => proj.active && proj.modProjectile != null && proj.modProjectile is IPostEffectsDraw)) { SGAmod.postRenderEffectsTargetDoUpdates = 450; (proj.modProjectile as IPostEffectsDraw).PostEffectsDraw(Main.spriteBatch, 2f); } foreach (NPC npc in Main.npc.Where(npc => npc.active && npc.modNPC != null && npc.modNPC is IPostEffectsDraw)) { SGAmod.postRenderEffectsTargetDoUpdates = 450; (npc.modNPC as IPostEffectsDraw).PostEffectsDraw(Main.spriteBatch, 2f); } Main.spriteBatch.End(); } Main.graphics.GraphicsDevice.SetRenderTargets(binds); } }
// localai0 : 0 when spawned, 1 when otherNPC spawned. // ai0 = npc number of other NPC // ai1 = charge time for gun. // ai2 = used for frame?? // ai3 = public override void AI() { int otherNPC = -1; Vector2 offsetFromOtherNPC = Vector2.Zero; if (npc.localAI[0] == 0f && Main.netMode != 1) { npc.localAI[0] = 1f; int newNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 509, npc.whoAmI, 0f, 0f, 0f, 0f, 255); npc.ai[0] = (float)newNPC; npc.netUpdate = true; } int otherNPCCheck = (int)npc.ai[0]; if (Main.npc[otherNPCCheck].active && Main.npc[otherNPCCheck].type == 509) { if (npc.timeLeft < 60) { npc.timeLeft = 60; } otherNPC = otherNPCCheck; offsetFromOtherNPC = Vector2.UnitY * -24f; } // If otherNPC exists, do this if (otherNPC != -1) { NPC nPC7 = Main.npc[otherNPC]; npc.velocity = Vector2.Zero; npc.position = nPC7.Center; npc.position.X = npc.position.X - (float)(npc.width / 2); npc.position.Y = npc.position.Y - (float)(npc.height / 2); npc.position += offsetFromOtherNPC; npc.gfxOffY = nPC7.gfxOffY; npc.direction = nPC7.direction; npc.spriteDirection = nPC7.spriteDirection; npc.timeLeft = nPC7.timeLeft; npc.velocity = nPC7.velocity; npc.target = nPC7.target; if (npc.ai[1] < 60f) { npc.ai[1] += 1f; } if (npc.justHit) { npc.ai[1] = -30f; } int projectileType = Terraria.ID.ProjectileID.RayGunnerLaser;// 438; int projectileDamage = 30; float scaleFactor20 = 7f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { Vector2 vectorToPlayer = Main.player[npc.target].Center - npc.Center; Vector2 vectorToPlayerNormalized = Vector2.Normalize(vectorToPlayer); float num1547 = vectorToPlayer.Length(); float num1548 = 700f; if (num1547 < num1548) { if (npc.ai[1] == 60f && Math.Sign(vectorToPlayer.X) == npc.direction) { npc.ai[1] = -60f; Vector2 center12 = Main.player[npc.target].Center; Vector2 value26 = npc.Center - Vector2.UnitY * 4f; Vector2 vector188 = center12 - value26; vector188.X += (float)Main.rand.Next(-50, 51); vector188.Y += (float)Main.rand.Next(-50, 51); vector188.X *= (float)Main.rand.Next(80, 121) * 0.01f; vector188.Y *= (float)Main.rand.Next(80, 121) * 0.01f; vector188.Normalize(); if (float.IsNaN(vector188.X) || float.IsNaN(vector188.Y)) { vector188 = -Vector2.UnitY; } vector188 *= scaleFactor20; Projectile.NewProjectile(value26.X, value26.Y, vector188.X, vector188.Y, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } else { float oldAI2 = npc.ai[2]; npc.velocity.X = npc.velocity.X * 0.5f; npc.ai[2] = 3f; if (Math.Abs(vectorToPlayerNormalized.Y) > Math.Abs(vectorToPlayerNormalized.X) * 2f) { if (vectorToPlayerNormalized.Y > 0f) { npc.ai[2] = 1f; } else { npc.ai[2] = 5f; } } else if (Math.Abs(vectorToPlayerNormalized.X) > Math.Abs(vectorToPlayerNormalized.Y) * 2f) { npc.ai[2] = 3f; } else if (vectorToPlayerNormalized.Y > 0f) { npc.ai[2] = 2f; } else { npc.ai[2] = 4f; } if (npc.ai[2] != oldAI2) { npc.netUpdate = true; } } } } } else { // This code is called when Bottom is dead. Top is transformed into a new NPC. npc.Transform(ModContent.NPCType <AntlionAssassin>()); return; } }
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 <WillChampion>()) { if ((Main.npc[(int)projectile.ai[1]].ai[0] == 2 && Main.npc[(int)projectile.ai[1]].ai[1] < 30) || (Main.npc[(int)projectile.ai[1]].ai[0] == -1 && Main.npc[(int)projectile.ai[1]].ai[1] < 10)) { projectile.Kill(); return; } } else { projectile.Kill(); return; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { projectile.velocity = -Vector2.UnitY; } /*if (projectile.localAI[0] == 0f) * { * * }*/ float num801 = 0.2f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= maxTime) { projectile.Kill(); return; } projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / maxTime) * 2.5f * num801; if (projectile.scale > num801) { projectile.scale = num801; } //float num804 = projectile.velocity.ToRotation(); //num804 += projectile.ai[0]; //projectile.rotation = num804 - 1.57079637f; float num804 = projectile.velocity.ToRotation() - 1.57079637f; //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)); projectile.position -= projectile.velocity; }
int chargeDirection = -1; //-1 is left, 1 is right public override void AI() { npc.TargetClosest(true); Player player = Main.player[npc.target]; var list2 = Main.projectile.Where(x => x.Hitbox.Intersects(npc.Hitbox)); foreach (var proj in list2) { if (proj.type == ModContent.ProjectileType <ShamanBolt>() && proj.active && npc.life < npc.lifeMax - 30) { npc.life += 30; npc.HealEffect(30, true); proj.active = false; } else if (proj.type == ModContent.ProjectileType <ShamanBolt>() && proj.active && npc.life > npc.lifeMax - 30) { npc.life += npc.lifeMax - npc.life; npc.HealEffect(npc.lifeMax - npc.life, true); proj.active = false; } } if (npc.wet) { npc.noGravity = true; if (npc.velocity.Y > -7) { npc.velocity.Y -= .085f; } return; } else { npc.noGravity = false; } timer++; if (timer == 120) { charging = true; Main.PlaySound(3, npc.Center, 51); npc.velocity.X = 0; if (player.position.X > npc.position.X) { chargeDirection = 1; npc.spriteDirection = 1; } else { chargeDirection = -1; npc.spriteDirection = -1; } } if (charging) { if (timer == 180) { npc.velocity.X = 4.5f * chargeDirection; npc.velocity.Y = -7; } if (timer < 180) { npc.aiStyle = -1; npc.velocity.X = -0.6f * chargeDirection; } else { npc.aiStyle = 26; npc.spriteDirection = npc.direction; } if (Math.Abs(npc.velocity.X) < 3 && timer > 180) { charging = false; npc.aiStyle = 3; npc.rotation = 0; timer = 0; } if ((chargeDirection == 1 && player.position.X < npc.position.X) || (chargeDirection == -1 && player.position.X > npc.position.X) && timer > 180) { npc.rotation += 0.1f * npc.velocity.X; npc.velocity.Y = 5; } } else { npc.aiStyle = 3; npc.spriteDirection = npc.direction; npc.rotation = 0; var list = Main.npc.Where(x => x.Hitbox.Intersects(npc.Hitbox)); foreach (var npc2 in list) { if (npc2.type == ModContent.NPCType <LargeCrustecean>() && npc.Center.Y > npc2.Center.Y && npc2.active) { npc.velocity.X = npc2.direction * 7; npc.velocity.Y = -2; Main.PlaySound(SoundLoader.customSoundType, npc.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Kakamora/KakamoraHit")); } } } }
public override void PreUpdate() { if (NPC.CountNPCS(mod.NPCType("Cirno")) < 1) { SGAWorld.CirnoBlizzard = Math.Max(SGAWorld.CirnoBlizzard - 3, 0); } if (ModLoader.GetMod("Idglibrary") != null) { Idglibrary.Idglib.nightmaremode = NightmareHardcore; } Hellion.HellionManager(); SharkvernHead.DoStormThings(null, null); SnapCooldown = Math.Max(SnapCooldown - 1, 0); /* * int width = 32; int height = 256; * SGAmod.hellionLaserTex = new Texture2D(Main.graphics.GraphicsDevice, width, height); * Color[] dataColors = new Color[width * height]; * * Color lerptocolor = Color.Red; * //if (projectile.ai[1] < 100) * // lerptocolor = Color.Green; * float scroll = (float)SGAWorld.modtimer; * * if (SGAWorld.updatelasers) { * * if (SGAmod.hellionLaserTex != null) * { * for (int y = 0; y < height; y++) * { * for (int x = 0; x < width; x += 1) * { * dataColors[(int)x + y * width] = Color.Lerp(Main.hslToRgb(((float)Math.Sin((x + scroll) * (width / (float)Math.PI)) * (1f)) % 1f, 0.75f, 0.5f), lerptocolor, 0.5f); * } * * } * } * SGAWorld.updatelasers = false; * * SGAmod.hellionLaserTex.SetData(dataColors); * * } */ if (Main.netMode != NetmodeID.Server) { if (Filters.Scene["SGAmod:ShockwaveBanshee"].IsActive() && !NPC.AnyNPCs(ModContent.NPCType <PrismBanshee>())) { Filters.Scene.Deactivate("SGAmod:ShockwaveBanshee", new object[0]); } } }
public override bool CanUseItem(Player player) { return(!NPC.AnyNPCs(ModContent.NPCType <EnragedDemon>())); }
public WillRitual() : base(MathHelper.Pi / 140f, 1200f, ModContent.NPCType <WillChampion>(), 87, 5) { }
public override void AI() { if (!npc.HasPlayerTarget) { npc.TargetClosest(); } Player player = Main.player[npc.target]; if (internalAI[2] == 0 && npc.life < npc.lifeMax / 3 && Main.netMode != 1) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, ModContent.NPCType <AthenaDark>()); NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, ModContent.NPCType <AthenaLight>()); internalAI[2] = 1; npc.netUpdate = true; } Vector2 targetPos; switch ((int)npc.ai[0]) { case 0: if (!AliveCheck(player)) { break; } targetPos = player.Center; targetPos.X += 500 * (npc.Center.X < targetPos.X ? -1 : 1); for (int pos = -200; pos < 200; pos += 50) { targetPos.Y = player.Center.Y - pos; if (Collision.CanHit(targetPos, npc.width, npc.height, player.position, player.width, player.height)) { break; } } MoveToVector2(targetPos); BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <AthenaMagic>(), ref npc.ai[1], 50, npc.damage / 3, 10, true); if (internalAI[3]++ >= 250 && Main.netMode != 1) { int Choice = Main.rand.Next(2); if (Choice == 0) { NPC.NewNPC((int)npc.Center.X + 100, (int)npc.Center.Y, ModContent.NPCType <OlympianDragon>()); NPC.NewNPC((int)npc.Center.X - 100, (int)npc.Center.Y, ModContent.NPCType <OlympianDragon>()); } else { NPC Seraph1 = Main.npc[NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 150, ModContent.NPCType <SeraphA>())]; for (int i = 0; i < 3; i++) { Dust.NewDust(Seraph1.position, Seraph1.height, Seraph1.width, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0); } NPC Seraph2 = Main.npc[NPC.NewNPC((int)npc.Center.X + 150, (int)npc.Center.Y - 75, ModContent.NPCType <SeraphA>())]; for (int i = 0; i < 3; i++) { Dust.NewDust(Seraph2.position, Seraph2.height, Seraph2.width, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0); } NPC Seraph3 = Main.npc[NPC.NewNPC((int)npc.Center.X + 150, (int)npc.Center.Y - 75, ModContent.NPCType <SeraphA>())]; for (int i = 0; i < 3; i++) { Dust.NewDust(Seraph3.position, Seraph3.height, Seraph3.width, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0); } } internalAI[3] = 0; npc.netUpdate = true; } if (npc.ai[2]++ > 560) { Teleport(1); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; case 1: if (!AliveCheck(player)) { break; } targetPos = player.Center; targetPos.X += 500 * (npc.Center.X < targetPos.X ? -1 : 1); for (int pos = -200; pos < 200; pos += 50) { targetPos.Y = player.Center.Y - pos; if (Collision.CanHit(targetPos, npc.width, npc.height, player.position, player.width, player.height)) { break; } } MoveToVector2(targetPos); BaseAI.ShootPeriodic(npc, player.position, player.width, player.height, ModContent.ProjectileType <SwiftwindStrikeSpear>(), ref npc.ai[1], 100, npc.damage / 3, 10, true); if (npc.ai[2]++ > 400) { npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; case 2: if (!AliveCheck(player)) { break; } npc.velocity *= 0; if (npc.ai[2] == 0) { Teleport(0); } npc.ai[2]++; if (npc.ai[2] == 120) { int projType = ModContent.ProjectileType <RazorGust>(); float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - npc.Center); dir *= 14f; float baseSpeed = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y)); double startAngle = Math.Atan2(dir.X, dir.Y) - .1d; double deltaAngle = spread / 6f; for (int i = 0; i < 3; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, npc.damage / 2, 5, Main.myPlayer); } } if (npc.ai[2] == 180 && npc.life < npc.lifeMax / 2) { int projType = ModContent.ProjectileType <RazorGust>(); float spread = 45f * 0.0174f; Vector2 dir = Vector2.Normalize(player.Center - npc.Center); dir *= 14f; float baseSpeed = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y)); double startAngle = Math.Atan2(dir.X, dir.Y) - .1d; double deltaAngle = spread / 6f; for (int i = 0; i < 3; i++) { double offsetAngle = startAngle + (deltaAngle * i); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, npc.damage / 2, 5, Main.myPlayer); } } if (npc.ai[2] > 220) { if (npc.ai[3] < Repeats()) { npc.ai[2] = 0; npc.ai[3]++; } else { Teleport(2); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } } break; case 3: npc.ai[1]++; targetPos = player.Center; targetPos.Y -= 500; MoveToVector2(targetPos); if (npc.ai[1] == 120) { int a = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, -8f), mod.ProjectileType("RuneSpawn"), npc.damage / 2, 3); Main.projectile[a].Center = npc.Center; int b = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(8f, 8f), mod.ProjectileType("RuneSpawn"), npc.damage / 2, 3); Main.projectile[b].Center = npc.Center; int c = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, 8f), mod.ProjectileType("RuneSpawn"), npc.damage / 2, 3); Main.projectile[c].Center = npc.Center; int d = Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y), new Vector2(-8f, -8f), mod.ProjectileType("RuneSpawn"), npc.damage / 2, 3); Main.projectile[d].Center = npc.Center; } if (npc.ai[1] > 180) { npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; } break; case 4: //prepare for queen bee dashes if (!AliveCheck(player)) { break; } if (++npc.ai[1] > 30) { targetPos = player.Center; targetPos.X += 1000 * (npc.Center.X < targetPos.X ? -1 : 1); DashMovement(targetPos, 0.8f); if (npc.ai[1] > 180 || Math.Abs(npc.Center.Y - targetPos.Y) < 50) //initiate dash { npc.ai[0]++; npc.ai[1] = 0; npc.netUpdate = true; npc.velocity.X = -30 * (npc.Center.X < player.Center.X ? -1 : 1); npc.velocity.Y *= 0.1f; } } else { npc.velocity *= 0.9f; //decelerate briefly } npc.rotation = 0; break; case 5: //dashing if (++npc.ai[1] > 240 || (Math.Sign(npc.velocity.X) > 0 ? npc.Center.X > player.Center.X + 900 : npc.Center.X < player.Center.X - 900)) { npc.ai[1] = 0; npc.ai[2] = 0; if (++npc.ai[3] >= Repeats()) //repeat dash three times { npc.ai[0]++; npc.ai[3] = 0; } else { npc.ai[0]--; } npc.netUpdate = true; } break; default: npc.ai[0] = 0; goto case 0; } if (player.Center.X < npc.Center.X + 200) { npc.direction = -1; } else { npc.direction = 1; } npc.rotation = 0; }
public override bool OnPickup(Player player) { player.GetModPlayer <SpookyPlayer>().pageDisplayTimer = 100; int randChoice = Main.rand.Next(0, 2); if (SpookyPlayer.pages == 0) { NPC.NewNPC(randChoice == 0 ? (int)player.Center.X - 2500 : (int)player.Center.X + 2500, (int)player.Center.Y + Main.rand.Next(-100, 100), ModContent.NPCType <Slenderman>()); } SpookyPlayer.pages += item.stack; Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Action/PagePickup"), player.Center); item.TurnToAir(); return(true); }
public override void AI() { Player player = Main.player[npc.target]; bool expertMode = Main.expertMode; Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.0375f * 2, 0.125f * 2); if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } if (npc.target < 0 || npc.target == 255 || player.dead) { npc.TargetClosest(true); } if (npc.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 226, 0f, 0f, 100, default(Color), 1f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } } npc.alpha -= 12; if (npc.alpha < 0) { npc.alpha = 0; } if (Main.netMode != 1) { if (!tail && npc.ai[0] == 0f) { int current = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { int trailing = 0; if (num36 >= 0 && num36 < minLength) { trailing = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType <CogTrapperBody>(), npc.whoAmI); } else { trailing = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType <CogTrapperTail>(), npc.whoAmI); } Main.npc[trailing].realLife = npc.whoAmI; Main.npc[trailing].ai[2] = (float)npc.whoAmI; Main.npc[trailing].ai[1] = (float)current; Main.npc[current].ai[0] = (float)trailing; npc.netUpdate = true; current = trailing; } tail = true; } if (!npc.active && Main.netMode == 2) { NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } int num180 = (int)(npc.position.X / 16f) - 1; int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; if (num180 < 0) { num180 = 0; } if (num181 > Main.maxTilesX) { num181 = Main.maxTilesX; } if (num182 < 0) { num182 = 0; } if (num183 > Main.maxTilesY) { num183 = Main.maxTilesY; } bool flag94 = flies; npc.localAI[1] = 0f; if (directional) { if (npc.velocity.X < 0f) { npc.spriteDirection = 1; } else if (npc.velocity.X > 0f) { npc.spriteDirection = -1; } } if (player.dead) { npc.TargetClosest(false); flag94 = false; npc.velocity.Y = npc.velocity.Y + 10f; if ((double)npc.position.Y > Main.worldSurface * 16.0) { npc.velocity.Y = npc.velocity.Y + 10f; } if ((double)npc.position.Y > Main.rockLayer * 16.0) { for (int num957 = 0; num957 < 200; num957++) { if (Main.npc[num957].aiStyle == npc.aiStyle) { Main.npc[num957].active = false; } } } } float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = player.position.X + (float)(player.width / 2); float num192 = player.position.Y + (float)(player.height / 2); int num42 = -1; int num43 = (int)(player.Center.X / 16f); int num44 = (int)(player.Center.Y / 16f); for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) { for (int num46 = num44; num46 <= num44 + 15; num46++) { if (WorldGen.SolidTile2(num45, num46)) { num42 = num46; break; } } if (num42 > 0) { break; } } if (num42 > 0) { npc.defense = 5; num42 *= 16; float num47 = (float)(num42 - 200); //was 800 if (player.position.Y > num47) { num192 = num47; if (Math.Abs(npc.Center.X - player.Center.X) < 125f) //was 500 { if (npc.velocity.X > 0f) { num191 = player.Center.X + 150f; //was 600 } else { num191 = player.Center.X - 150f; //was 600 } } } } else { npc.defense = 0; num188 = expertMode ? 10.83f : 8.66f; //added 2.5 num189 = expertMode ? 0.208f : 0.166f; //added 0.05 } float num48 = num188 * 1.5f; float num49 = num188 * 0.8f; float num50 = npc.velocity.Length(); if (num50 > 0f) { if (num50 > num48) { npc.velocity.Normalize(); npc.velocity *= num48; } else if (num50 < num49) { npc.velocity.Normalize(); npc.velocity *= num49; } } if (num42 > 0) { for (int num51 = 0; num51 < 200; num51++) { if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) { Vector2 vector3 = Main.npc[num51].Center - npc.Center; if (vector3.Length() < 400f) { vector3.Normalize(); vector3 *= 1000f; num191 -= vector3.X; num192 -= vector3.Y; } } } } else { for (int num52 = 0; num52 < 200; num52++) { if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) { Vector2 vector4 = Main.npc[num52].Center - npc.Center; if (vector4.Length() < 60f) { vector4.Normalize(); vector4 *= 200f; num191 -= vector4.X; num192 -= vector4.Y; } } } } num191 = (float)((int)(num191 / 16f) * 16); num192 = (float)((int)(num192 / 16f) * 16); vector18.X = (float)((int)(vector18.X / 16f) * 16); vector18.Y = (float)((int)(vector18.Y / 16f) * 16); num191 -= vector18.X; num192 -= vector18.Y; float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) { try { vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); int num194 = npc.width; num193 = (num193 - (float)num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; if (directional) { if (num191 < 0f) { npc.spriteDirection = 1; } if (num191 > 0f) { npc.spriteDirection = -1; } } } else { num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); float num196 = System.Math.Abs(num191); float num197 = System.Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; bool flag21 = false; if (!flag21) { if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) { if (npc.velocity.X < num191) { npc.velocity.X = npc.velocity.X + num189; } else if (npc.velocity.X > num191) { npc.velocity.X = npc.velocity.X - num189; } if (npc.velocity.Y < num192) { npc.velocity.Y = npc.velocity.Y + num189; } else if (npc.velocity.Y > num192) { npc.velocity.Y = npc.velocity.Y - num189; } if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) { npc.velocity.Y = npc.velocity.Y + num189 * 2f; } else { npc.velocity.Y = npc.velocity.Y - num189 * 2f; } } if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) { npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 } else { npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 } } } else { if (num196 > num197) { if (npc.velocity.X < num191) { npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 } else if (npc.velocity.X > num191) { npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 } if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) { if (npc.velocity.Y > 0f) { npc.velocity.Y = npc.velocity.Y + num189; } else { npc.velocity.Y = npc.velocity.Y - num189; } } } else { if (npc.velocity.Y < num192) { npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; } else if (npc.velocity.Y > num192) { npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; } if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) { if (npc.velocity.X > 0f) { npc.velocity.X = npc.velocity.X + num189; } else { npc.velocity.X = npc.velocity.X - num189; } } } } } } npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; }
public override bool NewRightClick(int i, int j) { Player player = Main.LocalPlayer; int type = ModContent.ItemType <Items.BossSummons.Owl>(); bool Athena = NPC.AnyNPCs(ModContent.NPCType <Athena>()) || NPC.AnyNPCs(ModContent.NPCType <AthenaFlee>()) || NPC.AnyNPCs(ModContent.NPCType <AthenaDefeat>()) || NPC.AnyNPCs(ModContent.NPCType <AthenaA>()); if (BasePlayer.HasItem(player, type, 1) && !Athena) { for (int m = 0; m < 50; m++) { Item item = player.inventory[m]; if (item != null && item.type == type && item.stack >= 1) { item.stack--; SpawnBoss(player, ModContent.NPCType <Athena>(), player.Center, Language.GetTextValue("Mods.AAMod.Common.Athena")); } } } return(true); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { NPC.NewNPC(i * 16, j * 16 - 1024, ModContent.NPCType <Npcs.Nimboss>(), 0); Main.NewText("King Cloud has awoken!", 171, 64, 255); }
public override void PostSetupContent() { Mod bossChecklist = ModLoader.GetMod("BossChecklist"); if (bossChecklist != null) { bossChecklist.Call( "AddBoss", 2.33f, new List <int> { ModContent.NPCType <NPCs.Dirtball.Dirtball>() }, this, "$Mods.Azercadmium.NPCName.Dirtball", (Func <bool>)(() => AzercadmiumWorld.downedDirtball), ModContent.ItemType <Items.Dirtball.CreepyMud>(), new List <int> { ModContent.ItemType <Items.Dirtball.MuddyGreatsword>() }, //collectables new List <int> { ModContent.ItemType <Items.Dirtball.MuddyGreatsword>() }, //other $"Dirtball has an extremely low chance of spawning if not defeated and any player's max health is 300 or more. It can also be manually summoned with a [i:{ModContent.ItemType<Items.Dirtball.CreepyMud>()}], which can be crafted or rarely dropped from enemies." ); bossChecklist.Call( "AddBoss", 6.75f, new List <int> { ModContent.NPCType <NPCs.Titan.TitanTankorb>() }, this, "$Mods.Azercadmium.NPCName.TitanTankorb", (Func <bool>)(() => AzercadmiumWorld.downedTitan), ModContent.ItemType <Items.Titan.TitansCapsule>(), new List <int> { ModContent.ItemType <Items.Titan.TitanicEnergy>() }, //collectables new List <int> { ModContent.ItemType <Items.Titan.TitanicEnergy>() }, //other $"Use a [i:{ModContent.ItemType<Items.Titan.TitansCapsule>()}]." ); bossChecklist.Call( "AddBoss", 9.25f, new List <int> { ModContent.NPCType <NPCs.Scavenger.MatrixScavenger>() }, this, "$Mods.Azercadmium.NPCName.MatrixScavenger", (Func <bool>)(() => AzercadmiumWorld.downedScavenger), ModContent.ItemType <Items.Scavenger.FloppyDisc>(), new List <int> { ModContent.ItemType <Items.Scavenger.SoulofByte>() }, //collectables new List <int> { ModContent.ItemType <Items.Scavenger.SoulofByte>() }, //other $"Use a [i:{ModContent.ItemType<Items.Scavenger.FloppyDisc>()}]." ); } JavelinCache = new bool[ProjectileLoader.ProjectileCount]; JavelinCache[ProjectileID.JavelinFriendly] = true; JavelinCache[ProjectileID.BoneJavelin] = true; JavelinCache[ProjectileID.Daybreak] = true; JavelinCache[ProjectileID.TinyEater] = true; JavelinCache[ProjectileID.FrostDaggerfish] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Wood.WoodenSplinter>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Corruption.DemoniteJavelin>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Crimson.CrimtaneJavelin>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Jungle.Snarevine>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Underworld.InfernalJavelin>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Underworld.HungeringJavelin>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Underworld.HungeringJavelin2>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Mech.France>()] = true; JavelinCache[ModContent.ProjectileType <Projectiles.Ember.CinderCedarJavelin>()] = true; TileEmberGladesCache = new bool[TileLoader.TileCount]; TileEmberGladesCache[ModContent.TileType <EmberGrass>()] = true; TileEmberGladesCache[ModContent.TileType <EmberThornTile>()] = true; ItemCastCache = new bool[ItemLoader.ItemCount]; NPCAITimerCache = new int[NPCLoader.NPCCount]; for (int i = 0; i < NPCLoader.NPCCount; i++) { NPCAITimerCache[i] = 4; } NPCAITimerCache[NPCID.EyeofCthulhu] = 5; NPCNoEnviroDropsCache = new bool[NPCLoader.NPCCount]; NPCNoEnviroDropsCache[NPCID.ServantofCthulhu] = true; NPCNoEnviroDropsCache[NPCID.EaterofWorldsHead] = true; NPCNoEnviroDropsCache[NPCID.EaterofWorldsBody] = true; NPCNoEnviroDropsCache[NPCID.EaterofWorldsTail] = true; NPCNoEnviroDropsCache[NPCID.MeteorHead] = true; NPCNoEnviroDropsCache[NPCID.BurningSphere] = true; NPCNoEnviroDropsCache[NPCID.WaterSphere] = true; NPCNoEnviroDropsCache[NPCID.ChaosBall] = true; NPCNoEnviroDropsCache[NPCID.VileSpit] = true; NPCNoEnviroDropsCache[NPCID.Slimer] = true; NPCNoEnviroDropsCache[NPCID.ShadowFlameApparition] = true; NPCNoEnviroDropsCache[NPCID.WyvernHead] = true; NPCNoEnviroDropsCache[NPCID.WyvernBody] = true; NPCNoEnviroDropsCache[NPCID.WyvernBody2] = true; NPCNoEnviroDropsCache[NPCID.WyvernBody3] = true; NPCNoEnviroDropsCache[NPCID.WyvernLegs] = true; NPCNoEnviroDropsCache[NPCID.WyvernTail] = true; NPCNoEnviroDropsCache[NPCID.SlimeSpiked] = true; NPCNoEnviroDropsCache[NPCID.BlueSlime] = true; NPCXPCache = new int[NPCLoader.NPCCount]; AzercadmiumUtils.Initialize(); }
public override bool CanUseItem(Player player) { bool alreadySpawned = NPC.AnyNPCs(ModContent.NPCType <NPCs.Bosses.Org13.xion_firstPhase>()) || NPC.AnyNPCs(ModContent.NPCType <NPCs.Bosses.Org13.xion_secondPhase>()) || NPC.AnyNPCs(ModContent.NPCType <NPCs.Bosses.Org13.xion_finalPhase>()); return(!alreadySpawned); }
public override void AI() { Player owner = Main.player[Projectile.owner]; if (first) { int id = NPC.NewNPC((int)Projectile.position.X, (int)Projectile.position.Y, ModContent.NPCType <NPC_Dog>()); NPC summonedNPC = Main.npc[id]; MNPC modSummonedNPC = summonedNPC.GetGlobalNPC <MNPC>(); modSummonedNPC.barrel = Projectile; first = false; } //int DDustID = Dust.NewDust(Projectile.position - new Vector2(2f, 2f), Projectile.width + 4, Projectile.height + 4, 17, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100, default(Color), 1.1f); //Spawns dust //Main.dust[DDustID].noGravity = true; }
public override bool?UseItem(Player player) { NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <NPCs.Bosses.Org13.xion_firstPhase>()); SoundEngine.PlaySound(SoundID.FemaleHit, player.position, 0); return(true); }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType <GeneralBossSpawn>(), ModContent.NPCType <DuneSharkron>(), knockBack, player.whoAmI); return(false); }
public override void PostSetupContent() { Main.OnPostDraw += Main_OnPostDraw; Main.OnPreDraw += Main_OnPreDraw; //IL.Terraria.Main.DrawMenu += UpdateExtraWorldDiff; Mod bossChecklist = ModLoader.GetMod("BossChecklist"); if (bossChecklist != null) { bossChecklist.Call( "AddBoss", 2.7f, new List <int>() { ModContent.NPCType <Volutio>(), ModContent.NPCType <Embryo>() }, // Boss ID this, // Mod "$Mods.Entrogic.NPCName.Volutio", // Boss Name (Func <bool>)(() => EntrogicWorld.downedGelSymbiosis), ModContent.ItemType <GelCultureFlask>(), // Summon Items new List <int> { ModContent.ItemType <VolutioMask>(), ModContent.ItemType <VTrophy>() }, // Collections new List <int> { ModContent.ItemType <VolutioTreasureBag>(), ModContent.ItemType <GelAnkh>(), ModContent.ItemType <GelOfLife>() }, // Normal Loots "$Mods.Entrogic.BossSpawnInfo.GelSymb", // Spawn Info "", // Despawn Info "Entrogic/Images/GelSym_Textures"); // 这里切记别用ModTexturesTable,不然服务器会炸 bossChecklist.Call( "AddBoss", 5.7f, ModContent.NPCType <Antanasy>(), // Boss ID this, // Mod "$Mods.Entrogic.NPCName.Antanasy", // Boss Name (Func <bool>)(() => EntrogicWorld.downedAthanasy), ModContent.ItemType <TitansOrder>(), new List <int> { ModContent.ItemType <AthanasyMask>(), ModContent.ItemType <AthanasyTrophy>() }, new List <int> { ModContent.ItemType <AthanasyTreasureBag>(), ModContent.ItemType <RockSpear>(), ModContent.ItemType <RockShotgun>(), ModContent.ItemType <EyeofImmortal>(), ModContent.ItemType <StoneSlimeStaff>() }, "$Mods.Entrogic.BossSpawnInfo.Athanasy"); bossChecklist.Call( "AddBoss", 6.8f, ModContent.NPCType <PollutionElemental>(), // Boss ID this, // Mod "$Mods.Entrogic.NPCName.PollutionElemental", // Boss Name (Func <bool>)(() => EntrogicWorld.IsDownedPollutionElemental), ModContent.ItemType <ContaminatedLiquor>(), new List <int> { ModContent.ItemType <PollutionElementalMask>(), ModContent.ItemType <PETrophy>() }, new List <int> { ModContent.ItemType <ContaminatedElementalTreasureBag>(), ModContent.ItemType <BottleofStorm>(), ModContent.ItemType <WaterElementalStaff>(), ModContent.ItemType <ContaminatedLongbow>(), ModContent.ItemType <ContaminatedCurrent>(), ModContent.ItemType <HelmetofContamination>(), ModContent.ItemType <HeadgearofContamination>(), ModContent.ItemType <MaskofContamination>(), ModContent.ItemType <BreastplateofContamination>(), ModContent.ItemType <GreavesofContamination>() }, "$Mods.Entrogic.BossSpawnInfo.PollutionElement", " 在大海中继续沉睡..."); } Mod fargos = ModLoader.GetMod("Fargowiltas"); if (fargos != null) { // AddSummon, order or value in terms of vanilla bosses, your mod internal name, summon // item internal name, inline method for retrieving downed value, price to sell for in copper fargos.Call("AddSummon", 2.7f, "Entrogic", "EmbryoCultureFlask", (Func <bool>)(() => EntrogicWorld.downedGelSymbiosis), new Money(gold: 9).ToInt()); fargos.Call("AddSummon", 5.7f, "Entrogic", "TitansOrder", (Func <bool>)(() => EntrogicWorld.downedAthanasy), new Money(gold: 18).ToInt()); fargos.Call("AddSummon", 6.8f, "Entrogic", "ContaminatedLiquor", (Func <bool>)(() => EntrogicWorld.IsDownedPollutionElemental), new Money(gold: 32).ToInt()); } }
public override void AI() { if (projectile.localAI[0] == 0) { projectile.localAI[0] = 1; Main.PlaySound(SoundID.Item92, projectile.Center); projectile.localAI[1] += (float)Math.PI / 2; if (projectile.ai[0] < 0) { projectile.localAI[1] += (float)Math.PI; } projectile.rotation = projectile.localAI[1]; } int ai1 = (int)projectile.ai[1]; if (!(ai1 > -1 && ai1 < Main.maxNPCs && Main.npc[ai1].active && Main.npc[ai1].type == ModContent.NPCType <NPCs.Champions.CosmosChampion>())) { projectile.Kill(); return; } projectile.timeLeft = 2; const float maxAmplitude = 850; float offset = Math.Abs(maxAmplitude * (float)Math.Sin(Main.npc[ai1].ai[2] * 2 * (float)Math.PI / 200)); offset += 150; projectile.localAI[1] += 0.01f; projectile.rotation += 0.04f; projectile.Center = Main.npc[ai1].Center + offset * projectile.localAI[1].ToRotationVector2(); }
public override void Load() { PassHotkey = RegisterHotKey("过牌快捷键", "E"); WashHotkey = RegisterHotKey("洗牌快捷键", "Q"); HookCursorHotKey = RegisterHotKey("设置钩爪指针快捷键", "C"); On.Terraria.Player.QuickGrapple += Player_QuickGrapple; On.Terraria.Player.ItemCheck += UnderworldTransportCheck; On.Terraria.Main.DrawInterface_40_InteractItemIcon += CustomHandIcon; //On.Terraria.Main.DrawTiles += Main_DrawTiles; foolTexts = Main.rand.Next(3); Unloading = false; IsCalamityLoaded = ModLoader.GetMod("CalamityMod") != null; Mod yabhb = ModLoader.GetMod("FKBossHealthBar"); if (yabhb != null) { #region Wlta yabhb yabhb.Call("RegisterCustomHealthBar", ModContent.NPCType <Embryo>(), null, //ForceSmall null, //displayName GetTexture("UI/yabhb/瓦卢提奥血条Fill"), //fillTexture GetTexture("UI/yabhb/瓦卢提奥血条头"), GetTexture("UI/yabhb/瓦卢提奥血条条"), GetTexture("UI/yabhb/瓦卢提奥血条尾"), null, //midBarOffsetX 0, //midBarOffsetY null, //fillDecoOffsetX 32, //bossHeadCentreOffsetX 30, //bossHeadCentreOffsetY null, //fillTextureSM null, //leftBarSM null, //midBarSM null, //rightBarSM null, //fillDecoOffsetXSM null, //bossHeadCentreOffsetXSM null, //bossHeadCentreOffsetYSM true); //LoopMidBar yabhb.Call("RegisterCustomHealthBar", ModContent.NPCType <Volutio>(), null, //ForceSmall null, //displayName GetTexture("UI/yabhb/瓦卢提奥血条Fill"), //fillTexture GetTexture("UI/yabhb/瓦卢提奥血条头"), GetTexture("UI/yabhb/瓦卢提奥血条条"), GetTexture("UI/yabhb/瓦卢提奥血条尾"), null, //midBarOffsetX 0, //midBarOffsetY null, //fillDecoOffsetX 32, //bossHeadCentreOffsetX 32, //bossHeadCentreOffsetY null, //fillTextureSM null, //leftBarSM null, //midBarSM null, //rightBarSM null, //fillDecoOffsetXSM null, //bossHeadCentreOffsetXSM null, //bossHeadCentreOffsetYSM true); //LoopMidBar #endregion } MimicryCustomCurrencyId = CustomCurrencyManager.RegisterCurrency(new EntrogicMimicryCurrency(ModContent.ItemType <拟态魔能>(), 999L)); if (!Main.dedServ) { ResourceLoader.LoadAllTextures(); ResourceLoader.LoadAllCardMissions(); AddEquipTexture(new PollutionElementalMask1(), null, EquipType.Head, "PollutionElementalMask1", "Entrogic/Items/PollutElement/PollutionElementalMask1_Head"); AddEquipTexture(new PollutionElementalMask2(), null, EquipType.Head, "PollutionElementalMask2", "Entrogic/Items/PollutElement/PollutionElementalMask2_Head"); AddEquipTexture(new PollutionElementalMask3(), null, EquipType.Head, "PollutionElementalMask3", "Entrogic/Items/PollutElement/PollutionElementalMask3_Head"); AddEquipTexture(new PollutionElementalMask4(), null, EquipType.Head, "PollutionElementalMask4", "Entrogic/Items/PollutElement/PollutionElementalMask4_Head"); AddEquipTexture(new PolluWings1(), null, EquipType.Wings, "PolluWings1", "Entrogic/Items/PollutElement/PolluWings1_Wings"); AddEquipTexture(new PolluWings2(), null, EquipType.Wings, "PolluWings2", "Entrogic/Items/PollutElement/PolluWings2_Wings"); AddEquipTexture(new PolluWings3(), null, EquipType.Wings, "PolluWings3", "Entrogic/Items/PollutElement/PolluWings3_Wings"); AddEquipTexture(new PolluWings4(), null, EquipType.Wings, "PolluWings4", "Entrogic/Items/PollutElement/PolluWings4_Wings"); AddEquipTexture(new PolluWings5(), null, EquipType.Wings, "PolluWings5", "Entrogic/Items/PollutElement/PolluWings5_Wings"); AddEquipTexture(new PolluWings6(), null, EquipType.Wings, "PolluWings6", "Entrogic/Items/PollutElement/PolluWings6_Wings"); AddEquipTexture(new PolluWings7(), null, EquipType.Wings, "PolluWings7", "Entrogic/Items/PollutElement/PolluWings7_Wings"); AddEquipTexture(new PolluWings8(), null, EquipType.Wings, "PolluWings8", "Entrogic/Items/PollutElement/PolluWings8_Wings"); ResourceLoader.LoadAllShaders(); BookUI = new BookUI(); BookUI.Activate(); BookUIE = new UserInterface(); BookUIE.SetState(BookUI); //BookPageUI = new BookPageUI(); //BookPageUI.Activate(); //BookPageUIE = new UserInterface(); //BookPageUIE.SetState(BookPageUI); CardUI = new CardUI(); CardUI.Activate(); CardUIE = new UserInterface(); CardUIE.SetState(CardUI); CardInventoryUI = new CardInventoryUI(); CardInventoryUI.Activate(); CardInventoryUIE = new UserInterface(); CardInventoryUIE.SetState(CardInventoryUI); CardGameUI = new CardGameUI(); CardGameUI.Activate(); CardGameUIE = new UserInterface(); CardGameUIE.SetState(CardGameUI); /*SinsBar.visible = true; * Sinsbar = new SinsBar(); * Sinsbar.Activate(); * SinsBarInterface = new UserInterface(); * SinsBarInterface.SetState(Sinsbar);*/ } Buildings.Cache("Buildings/CardShrine0.ebuilding", "Buildings/CardShrine1.ebuilding", "Buildings/UnderworldPortal.ebuilding"); new PiggyBankAmmo(); new ModHandler(); #region Armor Translates Translation.RegisterTranslation("mspeed", GameCulture.Chinese, "移动速度", " movement speed"); Translation.RegisterTranslation("and", GameCulture.Chinese, "与", " and"); Translation.RegisterTranslation("csc", GameCulture.Chinese, "暴击率", " critical strike chance"); Translation.RegisterTranslation("knockback", GameCulture.Chinese, "击退", " knockback"); Translation.RegisterTranslation("damage", GameCulture.Chinese, "伤害", " damage"); Translation.RegisterTranslation("cntca", GameCulture.Chinese, "的几率不消耗弹药", " chance not to consume ammo"); Translation.RegisterTranslation("immb", GameCulture.Chinese, "最大魔力值增加", "Increases maximum mana by "); Translation.RegisterTranslation("rmub", GameCulture.Chinese, "魔力消耗减少", "Reduces mana usage by "); #endregion #region Boss Checklist Translates ModTranslation bctext = CreateTranslation("BossSpawnInfo.GelSymb"); bctext.AddTranslation(GameCulture.Chinese, "在地下原汤湖使用 [i:" + ModContent.ItemType <GelCultureFlask>() + "] 召唤一只史莱姆, 并将其掷于地下原汤湖中召唤"); bctext.SetDefault("Use [i:" + ModContent.ItemType <GelCultureFlask>() + "] in the underground pool to summon a slime, and thorw it into the pool to summon."); AddTranslation(bctext); bctext = CreateTranslation("BossSpawnInfo.Athanasy"); bctext.AddTranslation(GameCulture.Chinese, "使用 [i:" + ModContent.ItemType <TitansOrder>() + "] 召唤(由地牢怪物掉落或在上锁的金箱中找到)"); bctext.SetDefault("Use [i:" + ModContent.ItemType <TitansOrder>() + "] to spawn, you can find it from locked chests or drop from dungeon monsters"); AddTranslation(bctext); bctext = CreateTranslation("BossSpawnInfo.PollutionElement"); bctext.AddTranslation(GameCulture.Chinese, "在海边使用 [i:" + ModContent.ItemType <ContaminatedLiquor>() + "] 召唤"); bctext.SetDefault("Use [i:" + ModContent.ItemType <ContaminatedLiquor>() + "] in ocean to spawn"); AddTranslation(bctext); #endregion #region Another Translates ModTranslation transform = CreateTranslation("RightClickToTransform"); transform.AddTranslation(GameCulture.Chinese, "右键点击物品以切换状态"); transform.SetDefault("Right click to switch status"); AddTranslation(transform); ModTranslation modTranslation = CreateTranslation("ArcaneDamage"); modTranslation.AddTranslation(GameCulture.Chinese, "奥术"); modTranslation.SetDefault("arcane "); AddTranslation(modTranslation); modTranslation = CreateTranslation("Pollution_SkyDarkened"); modTranslation.AddTranslation(GameCulture.Chinese, "天空变得更加黑暗"); modTranslation.SetDefault("The sky is becomes darkened"); AddTranslation(modTranslation); modTranslation = CreateTranslation("Pollution_Pollutional"); modTranslation.AddTranslation(GameCulture.Chinese, "污染生物正在聚集..."); modTranslation.SetDefault("Pollutional creatures are gathering..."); AddTranslation(modTranslation); modTranslation = CreateTranslation("Pollution_Summon"); modTranslation.AddTranslation(GameCulture.Chinese, "永远不要尝试去挑战自然..."); modTranslation.SetDefault("Never try to challenge the nature..."); AddTranslation(modTranslation); modTranslation = CreateTranslation("Pollution_Summon2"); modTranslation.AddTranslation(GameCulture.Chinese, "呵..."); modTranslation.SetDefault("Heh..."); AddTranslation(modTranslation); ModTranslation text = CreateTranslation("NPCTalk"); text.SetDefault("<{0}> {1}"); AddTranslation(text); text = CreateTranslation("Common.RandomCardImage"); text.SetDefault($"[i:{ModContent.ItemType<RandomCard>()}] [c/ffeb6e:卡牌系统自定义项]"); AddTranslation(text); ModTranslation modGen = CreateTranslation("GenLifeLiquid"); modGen.AddTranslation(GameCulture.Chinese, "正在生成生命湖"); modGen.SetDefault("Life."); AddTranslation(modGen); modGen = CreateTranslation("SmoothLifeLiquid"); modGen.AddTranslation(GameCulture.Chinese, "正在平整生命湖"); modGen.SetDefault("Life."); AddTranslation(modGen); modGen = CreateTranslation("GenCardShrine"); modGen.AddTranslation(GameCulture.Chinese, "正在生成卡牌神龛"); modGen.SetDefault("Card."); AddTranslation(modGen); #endregion }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (MyWorld.downedSnaptrapper) { return(spawnInfo.player.ZoneJungle && NPC.downedBoss2 && !NPC.AnyNPCs(ModContent.NPCType <Snaptrapper>()) && spawnInfo.player.ZoneOverworldHeight ? 0.008125f : 0f); } return(spawnInfo.player.ZoneJungle && NPC.downedBoss2 && !NPC.AnyNPCs(ModContent.NPCType <Snaptrapper>()) && spawnInfo.player.ZoneOverworldHeight ? 0.036f : 0f); }
public override void AI() { DespawnCheck(); Retarget(); bitherial = true; if (anim == true) { anDel++; if (anDel >= 120) { anim = false; } } npc.spriteDirection = 0; center = npc.Center; position = npc.position; bitherial = true; //DESPAWN int despawn = 0; if (!Main.player[npc.target].active || Main.player[npc.target].dead || Main.player[npc.target].ZoneRockLayerHeight == false) { npc.TargetClosest(true); if (!Main.player[npc.target].active || Main.player[npc.target].dead || Main.dayTime) { if (despawn == 0) { despawn++; } } } if (despawn >= 1) { despawn++; //ResetValues(); npc.noTileCollide = true; npc.velocity.Y = 8f; if (despawn >= 300) { npc.active = false; } } Vector2 delta = Main.player[npc.target].Center - npc.Center; float magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y); npc.spriteDirection = 0; target = Main.player[npc.target]; posX = npc.Center.X; posY = npc.Center.Y; npc.netUpdate = true; //if (anim == false) //{ //Checking which direction to move when spawned if (dir == 0) { if (delta.X < 0) { dir = 1; } else { dir = -1; } } //Moving across top of screen if (moveType == 1) { //attacking = false; //Horizontal Movement npc.velocity.X = accel; if (npc.position.X < Main.player[npc.target].position.X - 400 && hovDir == -1) { hovDir = 1; /*if (npc.life > npc.lifeMax / 2) * shoot = 1; * else * shoot = 2;*/ attacks += 1; } if (npc.position.X > Main.player[npc.target].position.X + 400 && hovDir == 1) { hovDir = -1; /*if (npc.life > npc.lifeMax / 2) * shoot = 1; * else * shoot = 2;*/ attacks += 1; } if (Math.Abs(accel) < maxAccel) { accel += (float)hovDir / 4f; } else { accel *= .9f; } //Vertical Movement npc.velocity.Y = vaccel; if (npc.position.Y - Main.player[npc.target].position.Y + 280 > 0) { vDir = -1; } if (npc.position.Y - Main.player[npc.target].position.Y + 280 < 0) { vDir = 1; } if (Math.Abs(vaccel) < maxVaccel / 4) { vaccel += (float)vDir / 3f; } else { vaccel *= .2f; } npc.velocity.Y = vaccel; if (boosted == false) { if (Math.Abs(npc.position.Y - Main.player[npc.target].position.Y + 280) > 20) { if (npc.position.Y - Main.player[npc.target].position.Y + 280 < 0) { if (vaccel < maxVaccel) { vaccel += .4f; } } if (npc.position.Y - Main.player[npc.target].position.Y + 280 > 0) { if (vaccel < maxVaccel) { vaccel -= .4f; } } } else { if (Math.Abs(vaccel) > .01f) { vaccel *= .9f; } else { vaccel = 0f; } } } else { vaccel = 0; } //Attack 2 if (Math.Abs(delta.X) < 10 && attacks >= 8 && moveType == 1) { attacks = 0; moveType = 2; npc.velocity.X = 0; npc.velocity.Y = 0; } } //Dash down if (moveType == 2) { //attacking = true; npc.velocity.Y = 14; npc.velocity.X = 0; vaccel = 0; accel = 0; if (npc.position.Y - Main.player[npc.target].position.Y > 280) { moveType = 3; delay = reload; //shoot = 2; } } //Floating if (moveType == 3) { moveDelay -= 1; if (moveDelay <= 0) { moveDelay = 4; moveType = 4; } //Horizontal Movement npc.velocity.X = accel; if (npc.position.X < Main.player[npc.target].position.X - 200 && hovDir == -1) { hovDir = 1; } if (npc.position.X > Main.player[npc.target].position.X + 200 && hovDir == 1) { hovDir = -1; } if (Math.Abs(accel) < maxAccel) { accel += (float)hovDir / 3f; } else { accel *= .98f; } //Vertical Movement npc.velocity.Y = vaccel; if (npc.position.Y - Main.player[npc.target].position.Y + 70 > 0) { vDir = -1; } if (npc.position.Y - Main.player[npc.target].position.Y + 70 < 0) { vDir = 1; } if (Math.Abs(vaccel) < maxVaccel / 6) { vaccel += (float)vDir / 6f; } else { vaccel *= .98f; } } //Dashing if (moveType == 4) { //Horizontal Movement npc.velocity.X = accel; if (dir == 1) { if (accel < maxAccel / 2) { accel += .2f; } else { if (boosted == false) //Play boosted sound effect { moveDelay -= 1; boosted = true; } accel = maxAccel; } if (delta.X < -range) { boosted = false; dir = -1; } } if (dir == -1) { if (accel > maxAccel / -2) { accel -= .2f; } else { if (boosted == false) //Play boosted sound effect { moveDelay -= 1; boosted = true; } accel = -maxAccel; } if (delta.X > range) { boosted = false; dir = 1; } } //Vertical Movement npc.velocity.Y = vaccel; if (boosted == false) { if (Math.Abs(delta.Y) > 40) { if (delta.Y > 40) { if (vaccel < maxVaccel) { vaccel += .4f; } } if (delta.Y < -40) { if (vaccel < maxVaccel) { vaccel -= .4f; } } } else { if (Math.Abs(vaccel) > .01f) { vaccel *= .5f; } else { vaccel = 0f; } } } else { vaccel = 0; } if (moveDelay <= 0) { moveDelay = 600; moveType = 1; } } //} //Attacks delay--; if (delay <= 0 && Main.netMode != 1) { delay = reload; if (attackNum >= 4) { attackNum = 0; shoot = 1; } else { shoot = Main.rand.Next(2, 5); attackNum++; } } if (shoot == 1 && Main.netMode != 1)//Lazer { shoot = 0; laserCharge = 1; rotSpeed = .25f; dist = 0; if (NPC.CountNPCS(ModContent.NPCType <AnDioLaserBall>()) < 1 && !LaugicalityWorld.downedEtheria) { for (int i = 0; i < 8; i++) { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <AnDioLaserBall>()); } } } if (laserCharge > 0) { laserCharge++; delay = reload; if (laserCharge < 120) { dist += 1; rotSpeed += .01f; } else if (laserCharge > 160) { dist -= 3; rotSpeed += .01f; } if (laserCharge > 240) { Main.PlaySound(SoundLoader.customSoundType, -1, -1, mod.GetSoundSlot(SoundType.Custom, "Sounds/zawarudo")); if (Main.netMode != 1) { if (Laugicality.zaWarudo < 4 * 60) { Laugicality.zaWarudo += 4 * 60; LaugicalGlobalNPCs.zTime += 4 * 60; } if (NPC.CountNPCS(ModContent.NPCType <AnDioLaserBall>()) > 1) { laser = 120; } else { moveType = 1; } } else { delay = 1; } AnDioLaserBall.life = 0; laserCharge = 0; } //Theta Rotation & Position Setting theta += 3.14f / 60 * rotSpeed; } if (laser > 0) { delay = reload; laser--; if (Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AndeLaser3>(), damage / 2, 3, Main.myPlayer); } } if (shoot == 2)//Spiral Orbs { shoot = 0; if (Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AndeEnergy>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioSpiral2>(), damage / 2, 3, Main.myPlayer); } spiralDur++; } if (spiralDur > 0) { spiralDur++; if (spiralDur > 200) { spiralDur = 0; } spiralDelay++; if (spiralDelay >= 50) { if (Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AndeEnergy>(), damage / 2, 3f, Main.myPlayer); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioSpiral2>(), damage / 2, 3, Main.myPlayer); } spiralDelay = 0; delay = reload; } } if (shoot == 3 && Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioEnergy>(), damage / 2, 3f, Main.myPlayer); shoot = 0; attackDuration = 1; } if (attackDuration == 90 && Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioEnergy>(), damage / 2, 3f, Main.myPlayer); } if (attackDuration == 180 && Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioEnergy>(), damage / 2, 3f, Main.myPlayer); } if (attackDuration == 270 && Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AnDioEnergy>(), damage / 2, 3f, Main.myPlayer); } if (attackDuration > 0) { attackDuration++; } if (attackDuration > 270) { attackDuration = 0; delay = reload; } if (shoot == 4 && Main.netMode != 1)//Split Ball { int rng = 480; int yHeight = 480; shoot = 0; Projectile.NewProjectile(Main.player[npc.target].position.X, Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer); yHeight = -480; Projectile.NewProjectile(Main.player[npc.target].position.X, Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <AndeShard>(), damage / 2, 3, Main.myPlayer); } npc.netUpdate = true; }
public override bool PreAI() { bool expertMode = Main.expertMode; { npc.spriteDirection = npc.direction; Player player = Main.player[npc.target]; if (npc.Center.X >= player.Center.X && moveSpeed >= -53) // flies to players x position { moveSpeed--; } if (npc.Center.X <= player.Center.X && moveSpeed <= 53) { moveSpeed++; } npc.velocity.X = moveSpeed * 0.1f; if (npc.Center.Y >= player.Center.Y - HomeY && moveSpeedY >= -30) //Flies to players Y position { moveSpeedY--; HomeY = 150f; } if (npc.Center.Y <= player.Center.Y - HomeY && moveSpeedY <= 30) { moveSpeedY++; } npc.velocity.Y = moveSpeedY * 0.1f; if (Main.rand.Next(220) == 6) { HomeY = -35f; } if (!rotationspawns) { for (int I = 0; I < 4; I++) { //cos = y, sin = x int GeyserEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 90) * 100)), (int)(npc.Center.Y + (Math.Cos(I * 90) * 100)), ModContent.NPCType <SpiritRotator>(), npc.whoAmI, 0, 0, 0, -1); NPC Eye = Main.npc[GeyserEye]; Eye.ai[0] = I * 90; Eye.ai[3] = I * 90; rotationspawns = true; } } int npcType1 = ModContent.NPCType <SpiritRotator>(); bool shadow = false; bool spirit = false; for (int num569 = 0; num569 < 200; num569++) { if ((Main.npc[num569].active && Main.npc[num569].type == (npcType1))) { spirit = true; } } if (shadow || spirit) { npc.dontTakeDamage = true; } if (spirit) { npc.defense = 22; timer++; { if (timer == 220) { for (int i = 0; i < 6; ++i) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 92); Vector2 targetDir = ((((float)Math.PI * 2) / 6) * i).ToRotationVector2(); targetDir.Normalize(); targetDir *= 15; int damageAmount = expertMode ? 34 : 50; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, targetDir.X, targetDir.Y, ModContent.ProjectileType <CurvingFlame>(), damageAmount, 0.5F, Main.myPlayer); timer = 0; } } timer1++; if (timer1 >= 1000 && timer <= 1400) //Rains red comets { if (Main.rand.Next(8) == 0) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); int A = Main.rand.Next(-200, 200) * 6; int B = Main.rand.Next(-200, 200) - 1000; int damageAmount = expertMode ? 21 : 44; Projectile.NewProjectile(player.Center.X + A, player.Center.Y + B, 0f, 14f, ModContent.ProjectileType <SpiritRainHostile>(), damageAmount, 1, Main.myPlayer, 0, 0); } } if (timer1 == 1500) { timer1 = 0; } } } if (!spirit) { if (npc.Center.X >= player.Center.X && moveSpeed >= -68) // flies to players x position { moveSpeed--; } if (npc.Center.X <= player.Center.X && moveSpeed <= 68) { moveSpeed++; } npc.velocity.X = moveSpeed * 0.1f; if (npc.Center.Y >= player.Center.Y - HomeY && moveSpeedY >= -44) //Flies to players Y position { moveSpeedY--; } HomeY = 160f; if (npc.Center.Y <= player.Center.Y - HomeY && moveSpeedY <= 44) { moveSpeedY++; } npc.velocity.Y = moveSpeedY * 0.15f; if (Main.rand.Next(220) == 6) { HomeY = -25f; } npc.defense = 11; if (!mirage) { int Mirage = NPC.NewNPC((int)(npc.Center.X - 100), (int)(npc.Center.Y), ModContent.NPCType <Mirage>(), npc.whoAmI, 0, 0, 0, -1); mirage = true; } if (!rotationspawns1) { for (int I = 0; I < 2; I++) { //cos = y, sin = x int GeyserEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 180) * 100)), (int)(npc.Center.Y + (Math.Cos(I * 180) * 100)), ModContent.NPCType <ShadowRotator>(), npc.whoAmI, 0, 0, 0, -1); NPC Eye = Main.npc[GeyserEye]; Eye.ai[0] = I * 180; Eye.ai[3] = I * 180; rotationspawns1 = true; } } timer2++; if (timer2 == 100) { for (int i = 0; i < 6; ++i) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 92); Vector2 targetDir = ((((float)Math.PI * 2) / 6) * i).ToRotationVector2(); targetDir.Normalize(); targetDir *= 15; int damageAmount = expertMode ? 34 : 60; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, targetDir.X, targetDir.Y, ModContent.ProjectileType <ShadowPulse>(), damageAmount, 0.5F, Main.myPlayer); timer2 = 0; } } if (!text) { Main.NewText("You force me to draw power from the Shadows!", 180, 80, 250, true); text = true; } } int npcType = ModContent.NPCType <ShadowRotator>(); for (int num569 = 0; num569 < 200; num569++) { if ((Main.npc[num569].active && Main.npc[num569].type == (npcType))) { spirit = true; } } if (!spirit) { if (!shadow) { npc.defense = 0; if (npc.Center.X >= player.Center.X && moveSpeed >= -90) // flies to players x position { moveSpeed--; } if (npc.Center.X <= player.Center.X && moveSpeed <= 90) { moveSpeed++; } npc.velocity.X = moveSpeed * 0.1f; if (npc.Center.Y >= player.Center.Y - HomeY && moveSpeedY >= -60) //Flies to players Y position { moveSpeedY--; HomeY = 175f; } if (npc.Center.Y <= player.Center.Y - HomeY && moveSpeedY <= 60) { moveSpeedY++; } npc.velocity.Y = moveSpeedY * 0.22f; if (Main.rand.Next(219) == 6) { HomeY = -25f; } if (!txt) { Main.NewText("I will finish you...", 80, 80, 210, true); txt = true; } } if (Main.rand.Next(19) == 0) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); int A = Main.rand.Next(-200, 200) * 6; int B = Main.rand.Next(-200, 200) - 1000; int damageAmount = expertMode ? 18 : 44; Projectile.NewProjectile(player.Center.X + A, player.Center.Y + B, 0f, 14f, ModContent.ProjectileType <SpiritRainHostile>(), damageAmount, 1, Main.myPlayer, 0, 0); } timer3++; if (timer3 == 100) { for (int i = 0; i < 6; ++i) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 92); Vector2 targetDir = ((((float)Math.PI * 2) / 6) * i).ToRotationVector2(); targetDir.Normalize(); targetDir *= 15; int damageAmount = expertMode ? 34 : 50; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, targetDir.X, targetDir.Y, ModContent.ProjectileType <CurvingFlame>(), damageAmount, 0.5F, Main.myPlayer); timer3 = 0; } } npc.dontTakeDamage = false; } if (Main.rand.Next(6) == 1) { int dust = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); int dust1 = Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 187, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f); Main.dust[dust].velocity *= 0f; Main.dust[dust1].velocity *= 0f; Main.dust[dust].noGravity = true; Main.dust[dust1].noGravity = true; } } return(true); }
public override bool PreAI() { var exposedBodies = Main.npc.Where(x => x.active && (x.type == ModContent.NPCType <SteamRaiderBody>() || x.type == ModContent.NPCType <SteamRaiderBody2>()) && x.localAI[0] > 0).Count(); if (Main.netMode != NetmodeID.MultiplayerClient) { if (exposedBodies < 7 && Main.rand.NextBool(50) || (++npc.localAI[1] % 60 == 0 && Main.rand.NextBool(50))) { if (!Exposed) { npc.localAI[0] = 1; npc.netUpdate = true; } } if (exposedBodies > 10 || (npc.localAI[1] % 60 == 0 && Main.rand.NextBool(50))) { if (Exposed) { npc.localAI[0] = 0; npc.netUpdate = true; } } if (npc.localAI[2] >= 601) { npc.localAI[2] = 0f; } } if (Exposed) { npc.defense = 8; npc.dontTakeDamage = false; } else { npc.defense = 9999; npc.dontTakeDamage = true; } Player player = Main.player[npc.target]; Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.075f, 0.25f); if (Head.ai[2] == 1) { if (Main.netMode != NetmodeID.MultiplayerClient) { if (--npc.ai[3] == 0) { Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 9); npc.TargetClosest(true); npc.netUpdate = true; if (Main.rand.NextBool(2)) { float num941 = 1f; //speed Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); float num942 = player.position.X + (float)player.width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); num944 = num941 / num944; num942 *= num944; num943 *= num944; num942 += (float)Main.rand.Next(-10, 11) * 0.0125f; num943 += (float)Main.rand.Next(-10, 11) * 0.0125f; int num946 = ModContent.ProjectileType <Starshock>(); vector104.X += num942 * 4f; vector104.Y += num943 * 2.5f; int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, NPCUtils.ToActualDamage(30, 1.25f), 0f, Main.myPlayer, 0f, 0f); Main.projectile[num947].timeLeft = 350; } } } } else { npc.ai[3] = Main.rand.Next(175, 190); } if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].life <= Main.npc[(int)npc.ai[1]].lifeMax * .2f) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 226, 0f, 0f, 100, default, 2f);