public override bool PreAI() { int damage = Main.expertMode? (npc.damage / 2) : npc.damage; bool isHead = npc.type == mod.NPCType("DaybringerHead") || npc.type == mod.NPCType("NightcrawlerHead"); if (Main.netMode != NetmodeID.MultiplayerClient && !initCustom) { initCustom = true; internalAI[7] += npc.whoAmI % 7 * 12; //so it doesn't pew all at once npc.velocity.X += 0.1f; npc.velocity.Y -= 4f; } if (isHead) { HandleDayNightCycle(); } bool isDay = Main.dayTime; bool wormStronger = (nightcrawler && !isDay) || (!nightcrawler && isDay); float wormDistance = -26f; int aiCount = 2; float moveSpeedMax = 16f; npc.damage = 200; npc.defense = 100; if (wormStronger != prevWormStronger) { int dustType = nightcrawler ? ModContent.DustType <NightcrawlerDust>() : ModContent.DustType <DaybringerDust>(); for (int k = 0; k < 10; k++) { int dustID = Dust.NewDust(npc.position, npc.width, npc.height, dustType, (int)(npc.velocity.X * 0.2f), (int)(npc.velocity.Y * 0.2f), 0, default, 1.5f);
public override void AI() { npc.rotation = 0; if (npc.active) { on = true; } else { on = false; } if (npc.velocity.X > 12) { npc.velocity.X = 12; } if (npc.velocity.Y > 12) { npc.velocity.Y = 12; } if (npc.life < npc.lifeMax && spawn < 1 && Main.netMode != 1) { poof = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 1; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .9 && spawn < 2 && Main.netMode != 1) { poof = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 2; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .8 && spawn < 3 && Main.netMode != 1) { poof = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 3; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .7 && spawn < 4 && Main.netMode != 1) { poof = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 4; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .6 && spawn < 5 && Main.netMode != 1) { poof = true; Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 5; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .5 && spawn < 6 && Main.netMode != 1) { poof = true; if (Main.expertMode) { npc.velocity *= 3; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); } Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 6; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .4 && spawn < 7 && Main.netMode != 1) { poof = true; if (Main.expertMode) { npc.velocity *= 3; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); } Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 7; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .3 && spawn < 8 && Main.netMode != 1) { poof = true; if (Main.expertMode) { npc.velocity *= 3; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); } Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 8; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .2 && spawn < 9 && Main.netMode != 1) { poof = true; if (Main.expertMode) { npc.velocity *= 2; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); } Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 9; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .12 && spawn < 10 && Main.netMode != 1) { poof = true; if (Main.expertMode) { spawn = 10; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalShelly>()); } Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); spawn = 10; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } if (npc.life < npc.lifeMax * .02 && spawn < 11 && Main.expertMode && Main.netMode != 1) { if (Main.expertMode) { poof = true; spawn = 11; NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalSlimer>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCreeper>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalCrawler>()); NPC.NewNPC((int)npc.position.X + rnd.Next(0, npc.width), (int)npc.position.Y + rnd.Next(0, npc.height), ModContent.NPCType <MechanicalMimic>()); } } if (poof) { poof = false; Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, ModContent.DustType <Steam>(), 0f, 0f); } delay++; int phase = 0; if (npc.life < npc.lifeMax * .5) { phase = 1; } if (delay >= 4) { delay = 0; frame++; if (frame > phase * 4 + 3) { frame = phase * 4; } } npc.frame.Y = fHeight * frame; }
public override void Kill(int timeLeft) { if (projectile.ai[0] >= 5 && projectile.ai[1] == 1) { Main.PlaySound(SoundID.Item14, projectile.position); } for (int k = 0; k < 18; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType <Magma>(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } }
public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) { //Emit dusts when swing the sword Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType <Dusts.IceDust>()); } }
public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType <Dusts.AlchFlask>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } SoundEngine.PlaySound(SoundID.Item25, Projectile.position); }
public override void DrawEffects(NPC npc, ref Color drawColor) { if (SoulFire) { if (Main.rand.Next(4) < 3) { int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, ModContent.DustType <WispDust>(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3.5f);
public override void SafeAI() { var player = Main.player[projectile.owner]; DrawbackTime++; if (DrawbackTime < 10) { Min -= 2; if (DrawbackTime < 6) { projectile.timeLeft += 2; } } if (projectile.timeLeft > (int)(20 * player.meleeSpeed) && projectile.timeLeft < (int)(50 * player.meleeSpeed)) { projectile.extraUpdates = 8; } else { projectile.extraUpdates = 0; } if (projectile.timeLeft == (int)(25 * player.meleeSpeed)) { Dust.NewDustPerfect(projectile.Center + Vector2.UnitX.RotatedBy(projectile.rotation + (float)Math.PI / 4f * 5f) * 124, ModContent.DustType <Dusts.AirSetColorNoGravity>(), Vector2.Zero, 0, default, 2);
public override void Kill(int timeLeft) { for (int _4 = 0; _4 < 5; _4++) { Dust _5 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <DustCodeParticle0>(), 0f, 0f, 10, Color.Green, 1f); _5.noLight = false; Dust _6 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <DustCodeNumberAll>(), 0f, 0f, 25, Color.Green, 1f); _6.noLight = false; } }
private void AILaunch() { //don't update actually, causes weird desync issues clientside... //if (Main.myPlayer == projectile.owner) projectile.netUpdate = true; if (projectile.ai[0] == chargeTime) { //move backwards projectile.position -= projectile.velocity * muzzleDist; //set laser size etc... projectile.ai[1] = 1.7f; projectile.scale = 1.2f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33, 0.4f, 0.2f); } //damage fall off once per 2 frames if (projectile.damage > 1 && projectile.timeLeft % 2 == 0) { projectile.damage -= 1; } //point in direction and shrink over time projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); projectile.scale *= 0.992f; if (projectile.ai[1] > 0.12f) { projectile.ai[1] *= 0.98f; } int d1 = Dust.NewDust(projectile.position + new Vector2(projectile.width / 2f, projectile.height / 2f), 1, 1, ModContent.DustType <VoidDust>(), 0f, 0f, 100, Color.White, 1f); Main.dust[d1].noGravity = true; Main.dust[d1].velocity *= 0.5f; //custom collision to match laser size, once per frame Vector2 halfVelo = projectile.velocity * 0.5f; Vector2 alteredVelo = Collision.TileCollision(new Vector2(projectile.position.X - hitboxHalfSize + projectile.width / 2, projectile.position.Y - hitboxHalfSize + projectile.height / 2), halfVelo, hitboxSize, hitboxSize, true, true); if (halfVelo != alteredVelo) { projectile.Kill(); } alteredVelo = Collision.TileCollision(new Vector2(projectile.position.X - hitboxHalfSize + projectile.width / 2, projectile.position.Y - hitboxHalfSize + projectile.height / 2) + halfVelo, halfVelo, hitboxSize, hitboxSize, true, true); if (halfVelo != alteredVelo) { projectile.Kill(); } }
public override void Kill(int timeleft) { int pieCut = 20; Main.PlaySound(SoundID.Item14, projectile.position); for (int m = 0; m < pieCut; m++) { int dustID = Dust.NewDust(new Vector2(projectile.Center.X - 1, projectile.Center.Y - 1), 2, 2, ModContent.DustType <Dusts.InfinityOverloadB>(), 0f, 0f, 100, Color.White, 1.6f); Main.dust[dustID].velocity = BaseUtility.RotateVector(default, new Vector2(6f, 0f), m / (float)pieCut * 6.28f);
public override void AI() { if (projectile.timeLeft < 597) { float _0 = Main.rand.NextFloatDirection() * 0.8f; Dust _1 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, MyDustId.SicklyGreen, _0, _0, 100, Color.Green, 3f); _1.noGravity = true; Dust _2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <DustCodeParticle0>(), _0, _0, 10, Color.Green, 1f); _2.noLight = false; Dust _3 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <DustCodeNumberAll>(), _0, _0, 25, Color.Green, 1f); _3.noLight = false; } }
public override void Kill(int timeLeft) { Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 124, Terraria.Audio.SoundType.Sound)); float spread = 12f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / (Main.expertMode ? 6: 3); double offsetAngle; int i; for (i = 0; i < (Main.expertMode ? 6 : 3); i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), mod.ProjectileType("Fireshot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), mod.ProjectileType("Fireshot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } for (int dust = 0; dust <= 10; dust++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType <Dusts.AkumaDust>(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } }
public override void AI() { if (projectile.timeLeft > 0) { projectile.timeLeft--; } if (projectile.timeLeft == 0) { projectile.Kill(); } projectile.frameCounter++; projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; if (projectile.frame > 3) { projectile.frame = 0; } } for (int num189 = 0; num189 < 1; num189++) { int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType <Dusts.AkumaDust>(), 0f, 0f, 0); Main.dust[num190].scale *= 1.3f; Main.dust[num190].fadeIn = 1f; Main.dust[num190].noGravity = true; } }
public override void AI() { projectile.velocity *= 0.94f; Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <TropidiumSteam>(), 0, 0, 0, Color.White, 1.1f); dust.noGravity = true; }
/* * public override float SpawnChance(NPCSpawnInfo spawnInfo) * { * if (LaugicalityWorld.obsidiumTiles > 150 && spawnInfo.spawnTileY > WorldGen.rockLayer) * return SpawnCondition.Cavern.Chance * 0.15f; * else return 0f; * }*/ public override void AI() { //Retarget (borrowed from Dan <3) Player p = Main.player[npc.target]; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); } npc.netUpdate = true; if (npc.Center.Y - Main.player[npc.target].Center.Y > 24) { if (npc.velocity.Y > 0) { npc.velocity.Y *= .9f; } else if (Main.rand.Next(5) == 0) { Dust.NewDust(npc.Center, npc.width / 2, 4, ModContent.DustType <Magma>(), 0f, 0f); } npc.velocity.Y -= .2f; } else if (npc.Center.Y - Main.player[npc.target].Center.Y < -36) { if (npc.velocity.Y < 0) { npc.velocity.Y *= .9f; } else if (Main.rand.Next(5) == 0) { Dust.NewDust(npc.Center, npc.width / 2, 4, ModContent.DustType <Magma>(), 0f, 0f); } npc.velocity.Y += .2f; } else { if ((float)Math.Abs(npc.velocity.Y) < 2f) { npc.velocity.Y = 0; if (Main.player[npc.target].Center.X < npc.Center.X) { if (npc.velocity.X > 0) { npc.velocity.X *= .9f; } else if (Main.rand.Next(5) == 0) { Dust.NewDust(npc.Center, npc.width / 2, 4, ModContent.DustType <Magma>(), 0f, 0f); } npc.velocity.X -= .5f; } if (Main.player[npc.target].Center.X > npc.Center.X) { if (npc.velocity.X < 0) { npc.velocity.X *= .9f; } else if (Main.rand.Next(5) == 0) { Dust.NewDust(npc.Center, npc.width / 2, 4, ModContent.DustType <Magma>(), 0f, 0f); } npc.velocity.X += .5f; } } npc.velocity.Y *= .9f; } }
public override void Kill(int timeLeft) { for (int j = 0; j < 40; j++) { int d2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <VoidDust>(), j / 90f * -projectile.velocity.X, j / 90f * -projectile.velocity.Y, 100, Color.White, 1.2f); Main.dust[d2].noGravity = true; Main.dust[d2].velocity *= 0.6f; } }
public override bool PreAI() { Player player = Main.player[projectile.owner]; player.ChangeDir(Main.MouseWorld.X > player.position.X ? 1 : -1); player.heldProj = projectile.whoAmI; if (player.statMana <= 0) { projectile.Kill(); } direction = Main.MouseWorld - (player.Center - new Vector2(4, 4)); direction.Normalize(); direction *= 7f; player.itemTime = 5; player.itemAnimation = 5; player.velocity.X *= 0.97f; if (counter == 7) { if (player.statMana > 0) { player.statMana -= 20; player.manaRegenDelay = 60; } else { firing = true; } } if (player.channel && !firing) { projectile.position = player.Center; if (counter < 100) { counter++; if (counter % 20 == 19) { Main.PlaySound(25, (int)projectile.position.X, (int)projectile.position.Y); } Vector2 dustUnit = direction.RotatedBy(Main.rand.NextFloat(-1, 1)) * 0.15f; Vector2 dustOffset = player.Center + (direction * 5.3f) + player.velocity; Dust dust = Dust.NewDustPerfect(dustOffset + (dustUnit * 30), ModContent.DustType <BubbleDust>()); dust.velocity = Vector2.Zero - (dustUnit * 1.5f); dust.noGravity = true; dust.scale = (float)Math.Sqrt(counter / 100f); projectile.ai[1]++; if (projectile.ai[1] % 20 == 19) { if (player.statMana > 0) { player.statMana -= 20; player.manaRegenDelay = 90; } else { firing = true; } } } if (counter == 100) { counter = 130; } direction = direction.RotatedBy(Main.rand.NextFloat(0 - ((float)Math.Sqrt(counter) / 120f), ((float)Math.Sqrt(counter) / 120f))); player.itemRotation = direction.ToRotation(); if (player.direction != 1) { player.itemRotation -= 3.14f; } } else { firing = true; if (counter > 0) { counter -= 2; if (counter % 5 == 0) { direction = direction.RotatedBy(Main.rand.NextFloat(-0.18f, 0.18f)); player.itemRotation = direction.ToRotation(); if (player.direction != 1) { player.itemRotation -= 3.14f; } int bubbleproj; bubbleproj = Main.rand.Next(new int[] { ModContent.ProjectileType <GunBubble1>(), ModContent.ProjectileType <GunBubble2>(), ModContent.ProjectileType <GunBubble3>(), ModContent.ProjectileType <GunBubble4>(), ModContent.ProjectileType <GunBubble5>() }); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 85); Projectile.NewProjectile(player.Center + (direction * 5), direction.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * Main.rand.NextFloat(0.85f, 1.15f), bubbleproj, projectile.damage, projectile.knockBack, projectile.owner); } } else { projectile.active = false; } } return(true); }
private void AICharge() { projectile.position -= projectile.velocity; //stay still (but keep velo in case) if (projectile.ai[0] == 0) //initial firing { //move forwards projectile.position += projectile.velocity * muzzleDist; projectile.ai[1] = 0.1f; //set rotation direction scale if (projectile.velocity.X > 0) { projectile.spriteDirection = 1; } else { projectile.spriteDirection = -1; } projectile.scale = 1.5f; //get end point of laser staPos = projectile.position + projectile.velocity * muzzleDist; endPos = projectile.position; for (int i = 0; i < projectile.timeLeft; i++) //roughly 1024 ft. { //custom collision to match laser size, once per frame Vector2 halfVelo = projectile.velocity * 0.5f; Vector2 alteredVelo = Collision.TileCollision(new Vector2(endPos.X - hitboxHalfSize + projectile.width / 2, endPos.Y - hitboxHalfSize + projectile.height / 2), halfVelo, hitboxSize, hitboxSize, true, true); if (halfVelo != alteredVelo) { endPos += alteredVelo; break; } alteredVelo = Collision.TileCollision(new Vector2(endPos.X - hitboxHalfSize + projectile.width / 2, endPos.Y - hitboxHalfSize + projectile.height / 2) + halfVelo, halfVelo, hitboxSize, hitboxSize, true, true); if (halfVelo != alteredVelo) { endPos += halfVelo + alteredVelo; break; } endPos += projectile.velocity; } //emit dust for (int i = 0; i < 5; i++) { int d1 = Dust.NewDust(projectile.position + new Vector2(projectile.width / 2, projectile.height / 2) + projectile.velocity * muzzleDist, 1, 1, ModContent.DustType <VoidDust>(), 0f, 0f, 100, Color.White, 1.5f); Main.dust[d1].noGravity = true; Main.dust[d1].velocity *= 0.4f; d1 = Dust.NewDust(endPos + new Vector2(projectile.width / 2, projectile.height / 2), 0, 0, ModContent.DustType <VoidDust>(), 0f, 0f, 100, Color.White, 1f); Main.dust[d1].noGravity = true; Main.dust[d1].velocity *= 0.4f; } } projectile.scale -= 0.007f; //shrink projectile.ai[1] *= 1.004f; //grow laser projectile.rotation += 0.05f * projectile.spriteDirection * (projectile.ai[0] * 0.2f); //spin faster and faster }
public override void AI() { float dustScale = 1f; if (projectile.ai[0] == 0f) { dustScale = 0.25f; } else if (projectile.ai[0] == 1f) { dustScale = 0.5f; } else if (projectile.ai[0] == 2f) { dustScale = 0.75f; } if (Main.rand.Next(2) == 0) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <ArkEnergy>(), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100); if (Main.rand.NextBool(3)) { dust.noGravity = true; dust.scale *= 3f; dust.velocity.X *= 2f; dust.velocity.Y *= 2f; } dust.scale *= 1.5f; dust.velocity *= 1.2f; dust.scale *= dustScale; } projectile.ai[0] += 1f; }
public override void AI() { OriginGlobalProj.ClentaminatorAI(projectile, OriginWorld.origin_conversion_type, ModContent.DustType <Solution_D>(), Color.GhostWhite); }
public override void AI() { Lighting.AddLight(projectile.position, 0.8f, 0.0f, 0.0f); if (projectile.velocity.X != projectile.velocity.X) { projectile.position.X = projectile.position.X + projectile.velocity.X; projectile.velocity.X = -projectile.velocity.X; } if (projectile.velocity.Y != projectile.velocity.Y) { projectile.position.Y = projectile.position.Y + projectile.velocity.Y; projectile.velocity.Y = -projectile.velocity.Y; } timer += 1f; if (timer > 9f) { if (timer == 10f) { float count = 25.0f; for (int k = 0; k < (double)count; k++) { Vector2 vector2 = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy(k * (6.22 / count), new Vector2()) * new Vector2(2.0f, 8.0f)).RotatedBy(projectile.velocity.ToRotation(), new Vector2()); int dust = Dust.NewDust(projectile.Center - new Vector2(0.0f, 4.0f), 1, 1, ModContent.DustType <BlueLaser>(), 0f, 0f, 200, Scale: 1.55f); Main.dust[dust].scale = 1.25f; Main.dust[dust].noGravity = true; Main.dust[dust].position = projectile.Center + vector2; Main.dust[dust].velocity = projectile.velocity * 0.0f + vector2.SafeNormalize(Vector2.UnitY) * 1.0f; } } for (int k = 0; k < 1; k++) { projectile.position -= projectile.velocity * (k * 0.25f); var dust = Dust.NewDustDirect(projectile.position, 1, 1, ModContent.DustType <BlueLaser>(), 0f, 0f, 200, Scale: 1.55f); dust.position = projectile.position; dust.velocity *= 0.1f; } return; } }
public override void PreUpdate() { if(Main.rand.Next(4) == 0) Dust.NewDust(Position + new Vector2(0, (float)Math.Sin(LegendWorld.rottime) * 5), 32, 32, ModContent.DustType<Dusts.Gold2>(), 0, 0, 0, default, 0.5f);
public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { for (int num468 = 0; num468 < 4; num468++) { int num469 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType <Dusts.StarDust>(), -npc.velocity.X * 0.2f, -npc.velocity.Y * 0.2f, 100, default, .8f);
public override void AI() { int d = projectile.ai[1] == 0 ? ModContent.DustType <Dusts.DragonflameDust>() : ModContent.DustType <Dusts.HydratoxinDust>(); for (int num572 = 0; num572 < 5; num572++) { float num573 = projectile.velocity.X * 0.2f * num572; float num574 = -(projectile.velocity.Y * 0.2f) * num572; int num575 = Dust.NewDust(Vector2.Zero, projectile.width, projectile.height, d, 0f, 0f, 100, default, 1f);
public override void AI() { Lighting.AddLight((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f), .37f, .8f, .89f); projectile.ai[0] += 1f; int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) { float scaleFactor2 = projectile.velocity.Length(); Vector2 vector17 = Main.player[num123].Center - projectile.Center; vector17.Normalize(); vector17 *= scaleFactor2; projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } if (projectile.velocity.Length() < 18f) { projectile.velocity *= 1.02f; } if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item8, projectile.position); for (int num124 = 0; num124 < 10; num124++) { int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType <Dusts.DarkmatterDust>(), projectile.velocity.X, projectile.velocity.Y, 100, Color.White, 2f); Main.dust[num125].noGravity = true; Main.dust[num125].velocity = projectile.Center - Main.dust[num125].position; Main.dust[num125].velocity.Normalize(); Main.dust[num125].velocity *= -5f; Main.dust[num125].velocity += projectile.velocity / 2f; } } projectile.frame++; if (projectile.frame > 4) { projectile.frame = 0; } if (projectile.ai[0] < 0f) { for (int num155 = 0; num155 < 2; num155++) { int num156 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, ModContent.DustType <Dusts.DarkmatterDust>(), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1.5f);
public override void AI() { projectile.ai[0] += 1f; if (projectile.ai[0] >= 20f) { projectile.alpha += 3; projectile.damage = (int)(projectile.damage * 0.95); projectile.knockBack = (int)(projectile.knockBack * 0.95); } if (projectile.ai[0] < 20f) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; bool flag17 = false; if (flag17) { float num483 = 18f; Vector2 vector35 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num484 = num472 - vector35.X; float num485 = num473 - vector35.Y; float num486 = (float)Math.Sqrt(num484 * num484 + num485 * num485); num486 = num483 / num486; num484 *= num486; num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; return; } if (Main.rand.Next(6) == 0) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType <Dusts.AbyssDust>(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } }
public override void AI() { if (projectile.velocity.Y < 12) { projectile.velocity.Y += .15f; } if (Main.rand.Next(6) == 0) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType <Magma>(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 1 && projectile.ai[0] >= 5 && projectile.ai[1] == 1) { projectile.velocity.X = 0f; projectile.velocity.Y = 0f; projectile.tileCollide = false; projectile.alpha = 255; projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.width = 96; projectile.height = 96; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); } }
public override void Kill(int timeLeft) { for (int num303 = 0; num303 < 3; num303++) { int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType <Dusts.AbyssDust>(), 0f, 0f, 100, default, 0.8f);
public override void HitEffect(int hitDirection, double damage) { for (int i = 0; i < 20; i++) //this i a for loop tham make the dust spawn , the higher is the value the more dust will spawn { int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType <DreamDust>(), npc.velocity.X * 1.2f, npc.velocity.Y * 1.2f, 120, default(Color), 2.50f); //this make so when this projectile disappear will spawn dust, change PinkPlame to what dust you want from Terraria, or add mod.DustType("CustomDustName") for your custom dust Main.dust[dust].noGravity = true; //this make so the dust has no gravity Main.dust[dust].velocity *= 1f; } }
public override void AI() { //dust! int dustId = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width / 2, projectile.height + 5, ModContent.DustType <Dusts.AkumaADust>(), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 2f);