public void DustCircle(Vector2 position, int Dusts, float Radius, int DustType, float DustSpeed, float DustScale = 1f) //Thanks to seraph for this code { float currentAngle = Main.rand.Next(360); for (int i = 0; i < Dusts; ++i) { Vector2 direction = Vector2.Normalize(new Vector2(1, 1)).RotatedBy(MathHelper.ToRadians(((360 / Dusts) * i) + currentAngle)); direction.X *= Radius; direction.Y *= Radius; Dust dust = Dust.NewDustPerfect(position + direction, DustType, (direction / Radius) * DustSpeed, 0, default(Color), DustScale); dust.noGravity = true; dust.noLight = true; dust.alpha = 125; } }
public override void AI() { Player player = Main.player[projectile.owner]; Main.PlaySound(SoundID.Item62, projectile.position); for (int i = 0; i < 1600; i++) { float theta = Main.rand.NextFloat(-(float)Math.PI, (float)Math.PI); Dust dust = Dust.NewDustPerfect(projectile.Center, mod.DustType("AncientGlow"), QwertyMethods.PolarVector(Main.rand.Next(2, 120), theta)); dust.noGravity = true; } }
// Create a square of pixels around the NPC on teleport. public void StatueTeleport() { for (int i = 0; i < 30; i++) { Vector2 position = Main.rand.NextVector2Square(-20, 21); if (Math.Abs(position.X) > Math.Abs(position.Y)) { position.X = Math.Sign(position.X) * 20; } else { position.Y = Math.Sign(position.Y) * 20; } Dust.NewDustPerfect(npc.Center + position, DustID.Smoke, Vector2.Zero).noGravity = true; } }
public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 107); Gore.NewGore(projectile.position, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.position, -projectile.oldVelocity * 0.2f, 705, 1f); for (float k = 0; k < 6.28f; k += 0.25f) { Dust.NewDustPerfect(projectile.position, DustType <BasicDust>(), Vector2.One.RotatedBy(k) * 2); } if (Main.LocalPlayer.HasBuff(BuffType <Buffs.RisingStar>()) && projectile.owner == Main.myPlayer) { Dust dust; dust = Terraria.Dust.NewDustPerfect(projectile.position, DustType <RisingStar>(), new Vector2(0f, -1f), 0, new Color(255, 255, 255), 5f); } }
public void makeSpirals(int spiralCount, float length, float angleIntensity, float rotationOffset, Dust dust) { Vector2 cachedPos = dust.position; for (float k = 0; k <= spiralCount; k++) { for (float i = 0; i < length; i++) { float rotation = 6.28f * (i / length) * angleIntensity + rotationOffset; float rot = k / spiralCount * 6.28f + rotation * 6.28f; float posX = cachedPos.X + (float)(Math.Cos(rot) * i); float posY = cachedPos.Y + (float)(Math.Sin(rot) * i); Vector2 pos = new Vector2(posX + (float)(Math.Cos(rot) * i), posY + (float)(Math.Sin(rot) * i)); Dust newDust = Dust.NewDustPerfect(pos, dust.type, Vector2.Zero, dust.alpha, default, dust.scale);
// Create a square of pixels around the NPC on teleport. public void StatueTeleport() { for (int i = 0; i < 30; i++) { Vector2 position = Main.rand.NextVector2Square(-20, 21); if (Math.Abs(position.X) > Math.Abs(position.Y)) { position.X = Math.Sign(position.X) * 20; } else { position.Y = Math.Sign(position.Y) * 20; } Dust.NewDustPerfect(position, mod.DustType <Dusts.Pixel>(), Vector2.Zero).noGravity = true; } }
public override void UpdateActiveEffects() { Vector2 prevPos = Player.Center + Vector2.Normalize(Player.velocity) * 10; int direction = Time % 2 == 0 ? -1 : 1; for (int k = 0; k < 60; k++) { float rot = 0.1f * k * direction; Dust dus = Dust.NewDustPerfect( prevPos + Vector2.Normalize(Player.velocity).RotatedBy(rot) * (k / 2) * (0.5f + Time / 8f), DustType <AirDash>(), Vector2.UnitX.RotatedByRandom(Math.PI) / 3f ); dus.fadeIn = k - Time * 3; } }
public sealed override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[projectile.owner]; player.statLife += LifeSteal; player.HealEffect(LifeSteal); if (!HealedTeam) { foreach (Player ally in Main.player.Where(ally => Vector2.Distance(player.Center, ally.Center) <= HealRadius && ally != player)) { ally.statLife += Heal; ally.HealEffect(Heal); } for (int k = 0; k <= 100; k++) { Dust.NewDustPerfect(player.Center + Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(HealRadius), DustType <Dusts.Starlight>(), Vector2.Zero, 0, default, Main.rand.NextFloat(0.6f));
public override void AI() { if (projectile.timeLeft == 0) { return; } for (int y = -10; y < 10; y++) { Vector2 velocity = projectile.velocity.SafeNormalize(new Vector2(160 / projectile.timeLeft, 0)).RotatedBy(MathHelper.ToRadians(y * 6)); Dust d = Dust.NewDustPerfect(projectile.Center + velocity, 267, null, 0, Color.DodgerBlue, 0.6f); d.velocity = velocity * 4 * (5 - projectile.timeLeft); //d.position -= d.velocity * 8; d.fadeIn = 0.7f; d.noGravity = true; } }
public override void UpdateVanity(Player player, EquipType type) { float dir = Main.rand.NextFloat(-2f, -1.14f); float midMultiplier = 1.4f - Math.Abs(dir + 1.57f) * 1.5f; Vector2 velocity = dir.ToRotationVector2() * Main.rand.NextFloat(1f, 3f) * midMultiplier; Vector2 center = player.MountedCenter; Dust dust = Dust.NewDustPerfect(center - player.velocity + new Vector2(0, -10), ModContent.DustType <FriendlyStargoopDust>(), velocity + player.velocity * 0.5f, Scale: Main.rand.NextFloat(1.4f, 1.8f)); base.UpdateVanity(player, type); }
public static void MakeDusts(Rectangle rect, int dustcount = 5, Color color = default, int dust = DustID.Fire, float scale = 1f) { for (int k = 0; k <= dustcount; k++) { Dust.NewDustPerfect(new Vector2(rect.Left, rect.Top) + new Vector2(Main.rand.NextFloat(0, rect.Width), Main.rand.NextFloat(0, rect.Height)), dust, Vector2.Zero, 255, color, scale); for (int i = 0; i <= 3; i++) { Vector2 velo = new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(-2, 2)); Dust.NewDustPerfect(new Vector2(rect.Left, rect.Top) + new Vector2(Main.rand.NextFloat(0, rect.Width), Main.rand.NextFloat(0, rect.Height)), dust, velo, 100, color, scale * 0.5f); } } if (dustcount > 5) { Main.PlaySound(SoundID.Item27); } }
private void Effects() { lightPulse += 0.005f; if (lightPulse > 1) { lightPulse = -1; } Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(3, 3), DustType <LightWispDust>(), Vector2.Zero, Scale: npc.scale).noGravity = true; Lighting.AddLight(npc.Center, new Vector3(0.89f, 0.58f, 0.76f) * Math.Abs(lightPulse * 1.3f) * npc.scale); if (Main.rand.NextBool(500)) { Main.PlaySound(27, (int)npc.Center.X, (int)npc.Center.Y, 0, 0.4f, 0.4f); } }
public override void SafeNearbyEffects(int i, int j, bool closer) { if (Main.rand.Next(300) == 0) { Vector2 pos = new Vector2(i * 16 + Main.rand.Next(16), j * 16 + Main.rand.Next(16)); if (Main.rand.NextBool()) { Dust.NewDustPerfect(pos, ModContent.DustType <CrystalSparkle>(), Vector2.Zero); } else { Dust.NewDustPerfect(pos, ModContent.DustType <CrystalSparkle2>(), Vector2.Zero); } } base.SafeNearbyEffects(i, j, closer); }
public override void PostUpdate(Item item) { Color color = new Color(220 + (int)(Math.Sin(LegendWorld.rottime * 3) * 25), 140, 255) * 0.5f; if (crafted) { Dust.NewDustPerfect(item.Center, ModContent.DustType <Dusts.VitricBossTell>(), Vector2.One.RotatedByRandom(6.28f) * 20, 0, color); Lighting.AddLight(item.Center, color.ToVector3()); } if (starless) { item.color = new Color(50, 50, 50); } base.PostUpdate(item); }
public override bool DrawEffects(int x, int y) { var tile = Framing.GetTileSafely(x, y - 1); if (Main.rand.Next(45) == 0 && tile.liquid == 0 && tile.collisionType != 1) { Dust.NewDustPerfect(new Vector2(x, y + 1) * 16, ModContent.DustType <Dusts.LavaSpark>(), -Vector2.UnitY.RotatedByRandom(0.8f) * Main.rand.NextFloat(2, 3), 0, new Color(255, 150, 50), Main.rand.NextFloat(0.2f, 0.3f)); } if (tile.liquid > 0) { Main.spriteBatch.Draw(Main.magicPixel, new Rectangle((x + (int)Helpers.Helper.TileAdj.X) * 16 - (int)Main.screenPosition.X, (y + (int)Helpers.Helper.TileAdj.Y) * 16 - (int)Main.screenPosition.Y, 16, 16), new Color(255, 175, 0) * GetOpacity(x, y)); } return(true); }
public override void HitEffect(int hitDirection, double damage) { for (int a = 0; a < 3; a++) { Vector2 rand = Main.rand.NextVector2CircularEdge(6, 6); Projectile.NewProjectile(npc.Center, rand, ProjectileType <FlowerProj>(), 24, 1); } for (int h = 0; h < 10; h++) { float rotation = h / 10f * MathHelper.Pi; Dust.NewDustPerfect(npc.Center, DustType <FlowerDust>(), rotation.ToRotationVector2() * 6, Scale: 2).noGravity = true; } Main.PlaySound(SoundID.PlayerKilled, (int)npc.Center.X, (int)npc.Center.X, 0, 1, 0.625f); }
public override void AI() { if (projectile.ai[0] == 0) { projectile.ai[0] = Main.MouseWorld.Y; } if (projectile.Bottom.Y > projectile.ai[0]) { projectile.tileCollide = true; } else { projectile.tileCollide = false; } if (!stuck) { var d = Dust.NewDustPerfect(projectile.Bottom + Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(15), ModContent.DustType <Dusts.Aurora>(), Vector2.Zero, 0, new Color(20, 20, 100), 0.8f); d.customData = Main.rand.NextFloat(0.6f, 1.3f); d.fadeIn = 10; Dust.NewDustPerfect(projectile.Bottom + Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(15), ModContent.DustType <Dusts.Glow>(), Vector2.Zero, 0, new Color(50, 50, 255), 0.4f).fadeIn = 10; ManageCaches(); projectile.rotation = projectile.velocity.ToRotation() - 1.44f; } else { projectile.friendly = false; if (projectile.timeLeft <= 30) { projectile.alpha += 10; } trailWidth *= 0.93f; if (trailWidth > 0.05f) { trailWidth -= 0.05f; } else { trailWidth = 0; } } ManageTrail(); }
public override void AI() { if (Falling) { if (projectile.velocity.Y < MaxFallSpeed) { projectile.velocity.Y += Gravity; } } if (Rotation != null) { projectile.rotation = (float)Rotation; } Lighting.AddLight(projectile.Center, Light.ToVector3()); if (DustTrailType != DustTrailTypes.None) { for (int i = 0; i < TrailThickness; i++) { if (DustTrailType == DustTrailTypes.PerfectNoGravity) { Dust dust = Dust.NewDustPerfect(projectile.Center, DustType, Scale: TrailScale); dust.noGravity = true; if (NoDustLight) { dust.noLight = true; } } if (DustTrailType == DustTrailTypes.Perfect) { Dust dust = Dust.NewDustPerfect(projectile.Center, DustType, Scale: TrailScale); if (NoDustLight) { dust.noLight = true; } } if (DustTrailType == (int)DustTrailTypes.Normal) { Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, DustType, Scale: TrailScale)]; if (NoDustLight) { dust.noLight = true; } } } } }
public override void AI() { projectile.spriteDirection = 1; if (projectile.ai[0] > 0) { projectile.spriteDirection = 0; } projectile.rotation = projectile.velocity.ToRotation(); distance += 0.5f; counter += rotationalSpeed; if (projNeg == 1) { Vector2 initialSpeed = new Vector2(projectile.ai[0], projectile.ai[1]); Vector2 offset = initialSpeed.RotatedBy(Math.PI / 2); offset.Normalize(); offset *= (float)(Math.Cos(counter * (Math.PI / 180)) * (distance / 20) * -1); projectile.velocity = initialSpeed + offset; } else { Vector2 initialSpeed = new Vector2(projectile.ai[0], projectile.ai[1]); Vector2 offset = initialSpeed.RotatedBy(Math.PI / 2); offset.Normalize(); offset *= (float)(Math.Cos(counter * (Math.PI / 180)) * (distance / 20)); projectile.velocity = initialSpeed + offset; } Dust dust; dust = Dust.NewDustPerfect(projectile.position, 133, new Vector2(0f, 0f), 0, new Color(255, 255, 255), 0.4f); dust.noGravity = true; Dust dust2; dust2 = Dust.NewDustPerfect(projectile.position, 130, new Vector2(0f, 0f), 0, new Color(255, 255, 255), 0.3f); dust2.noGravity = true; Dust dust3; dust3 = Main.dust[Terraria.Dust.NewDust(projectile.position, 0, 0, 6, 0f, 0f, 0, new Color(255, 255, 255), 1.513158f)]; dust3.noGravity = true; if (Main.rand.NextFloat() < 0.15f) { _ = Main.dust[Terraria.Dust.NewDust(projectile.position, 0, 0, 6, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; } }
public override void FindFrame(int frameHeight) { if ((npc.collideY || npc.wet) && !blocking) { npc.frameCounter += 0.2f; npc.frameCounter %= 4; int frame = (int)npc.frameCounter; npc.frame.Y = frame * frameHeight; } if (npc.wet) { return; } if (blocking) { npc.frameCounter += 0.05f; if (npc.frameCounter > 2 && !healed) { var list = Main.npc; foreach (var npc2 in list) { if (npc2.type == ModContent.NPCType <KakamoraRunner>() || npc2.type == ModContent.NPCType <KakamoraShielder>() || npc2.type == ModContent.NPCType <KakamoraShielderRare>() || npc2.type == ModContent.NPCType <SpearKakamora>() || npc2.type == ModContent.NPCType <SwordKakamora>()) { if (Math.Abs(npc2.position.X - npc.position.X) < 500 && npc2.active && npc2.life < npc2.lifeMax) //500 is distance away he heals { int bolt = Terraria.Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-66, 66), npc.Center.Y - Main.rand.Next(60, 120), 0, 0, ModContent.ProjectileType <ShamanBolt>(), 0, 0); Projectile p = Main.projectile[bolt]; Vector2 direction = npc2.Center - p.Center; direction.Normalize(); direction *= 4; p.velocity = direction; p.ai[0] = direction.X; p.ai[1] = direction.Y; } } } for (int j = 0; j < 25; j++) { Dust.NewDustPerfect(new Vector2(npc.Center.X + npc.direction * 22, npc.Center.Y), 173, new Vector2(Main.rand.NextFloat(-6, 6), Main.rand.NextFloat(-16, 0))); } healed = true; } npc.frameCounter = MathHelper.Clamp((float)npc.frameCounter, 0, 2.9f); int frame = (int)npc.frameCounter; npc.frame.Y = (frame + 4) * frameHeight; } }
public override void AI() { Player player = Main.player[projectile.owner]; // Add light in place of the explosion. Color.White can be any color you want, and 1f at the end is a radius multiplier. //Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1f); // Make the explosion larger overtime. By the time of death (60 ticks) it grows by 0.6f. projectile.ai[1] += 0.035f; projectile.scale = projectile.ai[1]; projectile.ai[0]++; // The larger amount of frames the explosion has, the longer it takes to die (still up to 60 ticks.) if (projectile.ai[0] >= 5 * Main.projFrames[projectile.type]) { projectile.Kill(); return; } // Animates the explosion. if (++projectile.frameCounter >= 6) { projectile.frameCounter = 0; if (++projectile.frame >= 5) { projectile.frame = 0; } } projectile.Damage(); // Basic explosion dust int dusts = 5; for (int i = 0; i < dusts; i++) { // If a random number including 0, 1, 2, and 3, lands 0, (basically 25% chance), spawn the dust. if (Main.rand.NextBool(3)) { float speed = 6f; // This velocity takes the speed, multiplies it by a random number from 0.5, to 1.2, then rotates it to be evenly spread like a circle based on what dusts is set to, and then randomly offsets it. Vector2 velocity = new Vector2(0f, -speed * Main.rand.NextFloat(0.5f, 1.2f)).RotatedBy(MathHelper.ToRadians(360f / i * dusts + Main.rand.NextFloat(-50f, 50f))); Dust dust1 = Dust.NewDustPerfect(projectile.Center, 111, velocity, 150, Color.White, 1.5f); dust1.noGravity = true; } } }
public override void Update(ref float gravity, ref float maxFallSpeed) { if (Entrogic.ModTimer % 3 == 0) { for (double i = 0.0; i <= MathHelper.TwoPi; i += MathHelper.TwoPi / 50f) { Vector2 vec = ((float)i).ToRotationVector2() * 48f; vec += item.Center; vec -= new Vector2(0f, 24f); Dust d = Dust.NewDustPerfect(vec, 6, Vector2.Zero, 0, Color.MediumPurple, 3f); d.noGravity = true; d.noLight = false; } } maxFallSpeed = 0f; base.Update(ref gravity, ref maxFallSpeed); }
public override void AI() { npc.TargetClosest(true); Player player = Main.player[npc.target]; AbilityHandler mp = player.GetHandler(); if (npc.Hitbox.Intersects(player.Hitbox) && !mp.Unlocked <Pure>() && animate == 0) { animate = 500; } if (animate == 100) { mp.Unlock <Pure>(); for (float k = 3.48f; k >= -0.4f; k -= 0.1f) { Dust.NewDustPerfect(player.Center + new Vector2((float)Math.Cos(k) * 32, (float)Math.Sin(k) * 16 - 55), mod.DustType("Purify2"), new Vector2(0, -2), 0, default, 3f);
public override void AI() { if (projectile.timeLeft == 900) { Filters.Scene.Activate("PurityFilter", projectile.position).GetShader().UseDirection(new Vector2(0.1f, 0.1f)); } else if (projectile.timeLeft >= 750) { projectile.ai[0] += 2; } else if (projectile.timeLeft < 150) { projectile.ai[0] -= 2; } Filters.Scene["PurityFilter"].GetShader().UseProgress((projectile.ai[0] / 255) * 0.125f).UseIntensity((projectile.ai[0] / 255) * 0.006f); Dust.NewDust(projectile.Center - Vector2.One * 32, 32, 32, DustType <Dusts.Purify>()); for (int x = -40; x < 40; x++) { for (int y = -40; y < 40; y++) { Vector2 check = (projectile.position / 16) + new Vector2(x, y); if (Vector2.Distance((check * 16), projectile.Center) <= projectile.ai[0] - 2) { TransformTile((int)check.X, (int)check.Y); } else { RevertTile((int)check.X, (int)check.Y); } //just in case if (projectile.timeLeft == 1) { RevertTile((int)check.X, (int)check.Y); } } } if (projectile.timeLeft == 1) { for (int k = 0; k <= 50; k++) { Dust.NewDustPerfect(projectile.Center - Vector2.One * 8, DustType <Dusts.Purify2>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(2.4f), 0, default, 1.2f);
public override void Behaviour() { var player = Main.player[projectile.owner]; Rotation = MathHelper.WrapAngle(Rotation + 0.025f); float distance = (float)Math.Sin(Main.time / 18f + (double)projectile.whoAmI / 50) * 64; projectile.Center = player.MountedCenter + new Vector2(0, distance).RotatedBy(Rotation); Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 0.5f); ShootDelay--; if (ShootDelay <= 0) { int target = -1; for (int k = 0; k < Main.maxNPCs; k++) { var npc = Main.npc[k]; if (npc.active && npc.CanBeChasedBy(this)) { float distanceToNPC = Vector2.Distance(npc.Center, projectile.Center); if (distanceToNPC < TargetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { target = k; } } } if (target != -1) { var shootVel = Main.npc[target].Center - projectile.Center; shootVel.Normalize(); shootVel *= 6f; Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType <RedBullet>(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner); ShootDelay = 50; } } DustDelay--; if (DustDelay <= 0) { Dust.NewDustPerfect(projectile.Center, mod.DustType <RedDustStatic>(), Vector2.Zero, Alpha: 80, Scale: 1.3f); DustDelay = 20; } }
public override bool Update(Gore gore) { if (gore.timeLeft > 600) { gore.timeLeft = 600; } var color = Color.Aqua * MathHelper.Clamp((gore.timeLeft - 160) / 80f, 0f, 1f); if (Main.rand.NextFloat(MathHelper.Clamp((gore.timeLeft - 160) / 80f, 0f, 1f) * 100) < 98) { Dust dust = Dust.NewDustPerfect(gore.position + new Vector2(12, 12) + (Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 16f) * Main.rand.NextFloat(), 59, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1f), 255 - (int)(MathHelper.Clamp((gore.timeLeft - 160) / 180f, 0f, 1f) * 255f), color, 1.7f); dust.noGravity = false; Lighting.AddLight(gore.position, color.ToVector3() * 0.3f); } return(true); }
private void CrystalCage() { if (AttackTimer % 110 == 0 && AttackTimer != 0 && AttackTimer < 800) //the sand cones the boss fires { RandomizeTarget(); int index = Projectile.NewProjectile(npc.Center, Vector2.Zero, ProjectileType <SandCone>(), 1, 0); //spawn a sand cone attack Main.projectile[index].rotation = (npc.Center - Main.player[npc.target].Center).ToRotation() + Main.rand.NextFloat(-0.5f, 0.5f); } for (int k = 0; k < 4; k++) //each crystal { NPC crystal = crystals[k]; VitricBossCrystal crystalModNPC = crystal.modNPC as VitricBossCrystal; if (AttackTimer == 1) //set the crystal's home position to where they are { crystalModNPC.StartPos = crystal.Center; favoriteCrystal = Main.rand.Next(4); //randomize which crystal will have the opening } if (AttackTimer > 1 && AttackTimer <= 60) //suck the crystals in { crystal.Center = npc.Center + (Vector2.SmoothStep(crystalModNPC.StartPos, npc.Center, AttackTimer / 60) - npc.Center).RotatedBy(AttackTimer / 60f * 3.14f); } if (AttackTimer == 61) //Set the crystal's new endpoints. !! actual endpoints are offset by pi !! { crystalModNPC.StartPos = crystal.Center; crystalModNPC.TargetPos = npc.Center + new Vector2(0, -800).RotatedBy(1.57f * k); crystal.ai[2] = 2; //set them into this mode to get the rotational effect } if (AttackTimer >= 120 && AttackTimer < 360) //spiral outwards slowly { crystal.Center = npc.Center + (Vector2.SmoothStep(crystalModNPC.StartPos, crystalModNPC.TargetPos, (AttackTimer - 120) / 240) - npc.Center).RotatedBy((AttackTimer - 120) / 240 * 3.14f); } if (AttackTimer >= 360 && AttackTimer < 840) //come back in { crystal.Center = npc.Center + (Vector2.SmoothStep(crystalModNPC.TargetPos, crystalModNPC.StartPos, (AttackTimer - 360) / 480) - npc.Center).RotatedBy(-(AttackTimer - 360) / 480 * 4.72f); //the chosen "favorite" or master crystal is the one where our opening should be if (k != favoriteCrystal) { for (int i = 0; i < 8; i++) { Dust d = Dust.NewDustPerfect(npc.Center + (crystal.Center - npc.Center).RotatedBy(Main.rand.NextFloat(1.57f)), DustType <Dusts.BlueStamina>(), Vector2.Zero, 0, default, 2);
public override bool CheckDead() { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <DesertDweller>()); for (int i = 0; i < 6; i++) { ChooseBubble(); } for (int i = 0; i < 36; i++) { float angle = MathHelper.ToRadians(10 * i); Vector2 vector = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)); Dust dust = Dust.NewDustPerfect(npc.Center + (vector * 40), 245, vector * 8f); dust.noGravity = true; } NoxiumWorld.desertDwellerSpawned = true; return(true); }
public override void AI() { Vector2 velocity; for (int y = 0; y < 60; y++) { velocity = new Vector2((duration - projectile.timeLeft) * range_growth, 0).RotatedBy(MathHelper.ToRadians(y * 6 - projectile.timeLeft)); //Point pos = (projectile.Center+velocity).ToWorldCoordinates().ToPoint(); //if(Main.tile[pos.X,pos.Y].collisionType<=0)continue; Dust d = Dust.NewDustPerfect(projectile.Center + velocity, 267, null, 0, Color.OrangeRed, 0.6f); velocity.Normalize(); d.velocity = (velocity + velocity.RotatedBy(-MathHelper.PiOver2) * 3f) * range_growth / 4f; //d.position -= d.velocity * 8; d.fadeIn = 0.7f; d.noGravity = true; } }
public override bool OnTileCollide(Vector2 oldVelocity) { if (ai == BlueManUtils.AITypes.BounceSquare || ai == BlueManUtils.AITypes.ExplodingBounceSquare) { projectile.penetrate--; if (projectile.penetrate <= 0) { projectile.Kill(); } else { Vector2 direction = projectile.velocity; float bounceMultiplier = 0.8f; if (ai == BlueManUtils.AITypes.ExplodingBounceSquare) { bounceMultiplier = 0.4f; } if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X * bounceMultiplier; direction.X = projectile.velocity.X; } if (projectile.velocity.Y != oldVelocity.Y) { projectile.velocity.Y = -oldVelocity.Y * bounceMultiplier; direction.Y = projectile.velocity.Y; } float distance = Vector2.Distance(projectile.Center, projectile.Center + projectile.velocity * 2f); int dusts = (int)(distance / 16f * 3f); for (int i = 0; i < dusts; i++) { Vector2 dustPosition = Vector2.Lerp(projectile.Center, projectile.Center + projectile.velocity * 2f, i / (float)dusts); Dust dust1 = Dust.NewDustPerfect(dustPosition, ModContent.DustType <PixelDust>(), direction * Math.Abs(i - (float)dusts) / 2f, 0, Color.White, 1f); dust1.noGravity = true; } } return(false); } return(true); }