public override void AI() { Player player = Main.player[projectile.owner]; int Dustid = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X * -0.4f, projectile.velocity.Y * -0.4f, 0, Color.White, 1f); Main.dust[Dustid].noGravity = true; if (player.dead || !player.active) { player.ClearBuff(mod.BuffType("FireballMinion")); } if (player.HasBuff(mod.BuffType("FireballMinion"))) { projectile.timeLeft = 2; } int target = DavesUtils.FindNearestTargettableNPC(projectile); if (player.MinionAttackTargetNPC > -1 && Main.npc[player.MinionAttackTargetNPC].CanBeChasedBy(this)) { OrbitTarget(player.MinionAttackTargetNPC); projectile.ai[1]++; Shoot(player.MinionAttackTargetNPC); return; } else if (target > -1) { Shoot(target); } OrbitTarget(); }
private void OrbitTarget(int npc = -1) { Player player = Main.player[projectile.owner]; Vector2 origin = player.Center; if (npc > -1) { origin = Main.npc[npc].Center; } float pos = 1; float max = 1; for (int i = 0; i < Main.projectile.Length; i++) { if (i != projectile.whoAmI) { if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("LivingFireballMinion") && Main.projectile[i].owner == projectile.owner) { max++; if (i < projectile.whoAmI) { pos++; } } } } Vector2 offset = new Vector2(0, -25 - max * 5); float rotation = pos / max; offset = DavesUtils.Rotate(offset, MathHelper.ToRadians(rotation * 360) + Main.GameUpdateCount / 25f); projectile.Center = origin + offset; }
public void Oval(Projectile proj, float topSpeed, float maxRange, float inc) { Player player = Main.player[proj.owner]; int MW = Math.Abs(proj.ai[0]) > player.Center.X ? -1 : 1; if (proj.velocity.Length() > topSpeed) { proj.velocity = Vector2.Normalize(proj.velocity) * topSpeed; } float extensionLength = Vector2.Distance(new Vector2(Math.Abs(proj.ai[0]), Math.Abs(proj.ai[1])), player.Center) / 2; if (extensionLength > maxRange * 0.55f) { extensionLength = maxRange * 0.55f; } inc *= MW; float rotationSpeed = 0.4f; proj.localAI[0] += GetVelMult(extensionLength, rotationSpeed, MW == -1); Vector2 SpinnyPlace = new Vector2((float)Math.Sin(proj.localAI[0] + inc) * extensionLength + (extensionLength), (float)Math.Cos(proj.localAI[0] + inc) * (extensionLength / 3)); float rotatyBoi = (new Vector2(Math.Abs(proj.ai[0]), Math.Abs(proj.ai[1])) - player.Center).ToRotation(); SpinnyPlace = DavesUtils.Rotate(SpinnyPlace, rotatyBoi); SpinnyPlace += player.Center; proj.rotation += 0.2f; proj.Center = SpinnyPlace; }
public override void AI() { npc.TargetClosest(true); npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1; Player player = Main.player[npc.target]; npc.ai[0] = GetAiType(player); float num = 25f; Vector2 vel = new Vector2(0, 200); float inc = MathHelper.ToRadians(360f / num); for (int i = 0; i < num; i++) { int dustid = Dust.NewDust(npc.Center + DavesUtils.Rotate(vel, i * inc), 1, 1, DustID.GreenBlood); Main.dust[dustid].noGravity = true; } if (Vector2.Distance(npc.Center, player.Center) < 200) { player.AddBuff(BuffID.Poisoned, 60); } float maxSpeed = 4.5f; float acceleration = 0.13f; if (npc.ai[0] < 2)//Long Range Stuff { if (npc.collideX && npc.velocity.Y == 0) { npc.velocity.Y -= maxSpeed + npc.ai[1]; npc.ai[1] += 1; } else if (!npc.collideX) { npc.ai[1] = 0; } int mult = (npc.ai[0] == 0 ? 1 : -1); if (npc.velocity.X * mult < 0) { mult *= 2; } npc.velocity.X += mult * acceleration; if (npc.velocity.X * mult > maxSpeed) { npc.velocity.X = maxSpeed * mult; } } else { if (npc.ai[0] == 2 && npc.velocity.Y == 0) { npc.velocity.Y += maxSpeed; } //Above Stuff else if (npc.ai[0] == 3 && npc.velocity.Y == 0) { npc.velocity.Y -= maxSpeed + npc.ai[1]; npc.ai[1] += 1; } //Below Stuff //Close Range Stuff } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 vel = new Vector2(speedX, speedY); vel = DavesUtils.Rotate(vel, MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))); Projectile.NewProjectile(position, vel, item.shoot, damage, knockBack, player.whoAmI); return(false); }
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { Vector2 velInit = Vector2.Normalize(target.Center - player.Center) * 16f; for (int i = -1; i < 3; i++) { Vector2 vel = DavesUtils.Rotate(velInit, MathHelper.ToRadians(2) * i); Projectile.NewProjectile(target.Center, vel, mod.ProjectileType("CrystilShard"), damage, knockBack, player.whoAmI); } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (type == ProjectileID.WoodenArrowFriendly) { type = mod.ProjectileType("Crystil"); } Vector2 baseVel = new Vector2(speedX, speedY); DavesUtils.CrystilExplosion(baseVel, damage, knockBack, player.whoAmI, position, type, player); return(false); }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int numShots = Main.rand.Next(3, 5); Vector2[] speeds = DavesUtils.GenerateRandomisedSpread(new Vector2(speedX, speedY), 15, numShots); for (int i = 0; i < numShots; ++i) { Projectile.NewProjectile(position.X, position.Y, speeds[i].X, speeds[i].Y, type, damage, knockBack, player.whoAmI); } return(false); }
public override void Kill(int timeleft) { int numBlasts = Main.rand.Next(3, 8); float step = 360 / numBlasts; for (int i = 0; i < numBlasts; i++) { Vector2 vel = DavesUtils.Rotate(new Vector2(0, -8), MathHelper.ToRadians(step * i)); Projectile.NewProjectile(projectile.Center, vel, mod.ProjectileType("FireOrbSplit"), (int)(projectile.damage * 0.8f), projectile.knockBack * 0.8f, projectile.owner); } }
public override void Kill(int timeleft) { if (projectile.ai[0] == 0) { for (int i = 0; i < 2; i++) { Vector2 vel = DavesUtils.Rotate(projectile.velocity * 1.4f, 0.5f * (i == 0 ? 1f : -1f)); Projectile.NewProjectile(projectile.Center, vel, projectile.type, (int)(projectile.damage * 0.8f), projectile.knockBack, projectile.owner, 1); } Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.4f, projectile.type, (int)(projectile.damage * 0.8f), projectile.knockBack, projectile.owner, 1); } }
private void CrystilLasersFromNPC(Player player, int num = 3) { if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vel = Vector2.Normalize(player.Center - npc.Center) * 16; for (int i = 0; i < num; i++) { int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(vel, MathHelper.ToRadians(10 * (i - num / 2))), mod.ProjectileType("CrystilWarning"), CrystilDamage, 0f, Main.myPlayer, npc.whoAmI); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid); } } }
private void CrystilCircle(int num = 10, float startRotaion = 0f, int type = -1) { if (Main.netMode != NetmodeID.MultiplayerClient) { float speed = DRGNModWorld.MentalMode ? 12f : Main.expertMode ? 10f : 8f; float inc = MathHelper.ToRadians(360 / num); Vector2 vel = DavesUtils.Rotate(new Vector2(0, -speed), startRotaion); for (int i = 0; i < num; i++) { int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(vel, inc * i), type == -1 ? mod.ProjectileType("GiantCrystil") : type, CrystilDamage, 0f, Main.myPlayer); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid); } } }
private void Move() { int target = DavesUtils.FindNearestTargettableNPC(projectile); if (target != -1) { float speed = 15f; Vector2 MoveTo = Main.npc[target].Center - projectile.Center; float magnitude = MoveTo.Length(); if (magnitude > speed) { MoveTo *= speed / magnitude; } projectile.velocity = (projectile.velocity * 20f + MoveTo) / 21f; } }
private void Move() { int target = DavesUtils.FindNearestTargettableNPC(projectile); if (target > -1) { projectile.tileCollide = false; float speed = 15f; Vector2 moveTo = Main.npc[target].Center - projectile.Center; float magnitude = moveTo.Length(); if (magnitude > speed) { moveTo *= speed / magnitude; projectile.velocity = moveTo; } } }
public override void AI() { if (projectile.localAI[0] == 0 && projectile.owner == Main.myPlayer) { int target = DavesUtils.FindNearestTargettableNPC(projectile, 200); if (target != -1) { projectile.velocity = Vector2.Normalize(Main.npc[target].Center - projectile.Center) * 10f; } Vector2 desiredPos = projectile.Center + DavesUtils.Rotate(Vector2.Normalize(projectile.velocity) * 100f, Main.rand.NextFloat(-1f, 1f)); projectile.ai[0] = desiredPos.X; projectile.ai[1] = desiredPos.Y; projectile.netUpdate = true; projectile.localAI[0] = 1; } MoveTo(); int dustid = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("ShadeDust")); Main.dust[dustid].noGravity = true; }
public override void AI() { Player player = Main.player[projectile.owner]; Animate(); int target = DavesUtils.FindNearestTargettableNPC(projectile, 1000, true); projectile.ai[0] = DetectPhase(target); if (projectile.ai[0] == 0) { MoveTo(projectile.Center + new Vector2(0, 100)); } else if (projectile.ai[0] == 1) { MoveTo(Main.npc[target].Center); } else { projectile.timeLeft = 160; if (projectile.ai[0] == 4 && projectile.velocity.Y == 0) { projectile.velocity.Y -= 8; } else { projectile.velocity.Y += 0.5f; bool left = projectile.ai[0] == 2; float maxSpeed = 8f * player.GetModPlayer <DRGNPlayer>().antSpeedMult; float acceleration = 0.2f * player.GetModPlayer <DRGNPlayer>().antSpeedMult; projectile.velocity.X = projectile.velocity.X + (left ? acceleration * (projectile.velocity.Y < 0 ? 2 : 1) : -acceleration * (projectile.velocity.Y > 0 ? 2 : 1)); if (projectile.velocity.X > maxSpeed) { projectile.velocity.X = maxSpeed; } if (projectile.velocity.Y > maxSpeed) { projectile.velocity.Y = maxSpeed; } } } }
public override void AI() { Player player = Main.player[projectile.owner]; Animate(); HandleBuffs(player); int target = DavesUtils.FindNearestTargettableNPC(projectile, 1200, true); projectile.ai[0] = DetectPhase(target); if (projectile.ai[0] == 0) { MoveTo(player.Center); } else if (projectile.ai[0] == 1) { MoveTo(Main.npc[target].Center); } else { if (projectile.ai[0] == 4 && projectile.velocity.Y == 0) { projectile.velocity.Y -= 16; } else { projectile.velocity.Y += 0.5f; bool left = projectile.ai[0] == 2; float maxSpeed = 16f; projectile.velocity.X = projectile.velocity.X + (left ? 0.5f * (projectile.velocity.Y < 0 ? 2 : 1) : -0.5f * (projectile.velocity.Y > 0 ? 2 : 1)); if (projectile.velocity.X > maxSpeed) { projectile.velocity.X = maxSpeed; } if (projectile.velocity.Y > maxSpeed) { projectile.velocity.Y = maxSpeed; } } } }
public override void Kill(int timeleft) { DavesUtils.CrystilExplosion(projectile.velocity, projectile.damage, projectile.knockBack, projectile.owner, projectile.Center, mod.ProjectileType("CrystilShard"), Main.player[projectile.owner]); }
public override void NPCLoot(NPC npc) { int closestPlayer = Player.FindClosest(npc.position, npc.width, npc.height); if (Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().ashenArmorSet || Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().cyEquip) { bool Crystil = Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().cyEquip; if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly) { int numCrystals = Crystil ? Main.rand.Next(8, 16) : Main.rand.Next(5, 10); int inc = 360 / numCrystals; Vector2 startingVel = new Vector2(Crystil? -14 : -10, 0); for (int i = 0; i < numCrystals; i++) { int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(startingVel, inc * i), Crystil ? mod.ProjectileType("Crystil") : mod.ProjectileType("FlareCrystalShard"), Crystil ? 40 : 20, 1f, closestPlayer); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid); } } } if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && npc.position.Y > Main.rockLayer * 16.0 && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 30)) { if (Main.player[closestPlayer].ZoneJungle) { Item.NewItem(npc.getRect(), mod.ItemType("FrogClaw")); } } if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && npc.position.Y > Main.rockLayer * 16.0 && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 5)) { if (Main.player[closestPlayer].ZoneJungle && DRGNModWorld.downedToxicFrog) { Item.NewItem(npc.getRect(), mod.ItemType("ToxicFlesh"), DRGNModWorld.MentalMode ? 3 : 1); } } int rand = Main.rand.Next(1, 5); if (npc.type == NPCID.CultistBoss && DRGNModWorld.MentalMode) { Item.NewItem(npc.getRect(), ItemID.CultistBossBag, Main.ActivePlayersCount); } if ((npc.type == NPCID.Drippler || npc.type == NPCID.BloodZombie) && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 50)) { Item.NewItem(npc.getRect(), mod.ItemType("BloodCore")); } if ((npc.type == NPCID.CaveBat || npc.type == NPCID.UndeadMiner || npc.type == NPCID.MotherSlime || npc.type == NPCID.UndeadViking || npc.type == NPCID.IceBat || npc.type == NPCID.GraniteFlyer || npc.type == NPCID.GraniteGolem) && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 50)) { Item.NewItem(npc.getRect(), mod.ItemType("SoulContainer")); } if (!Main.expertMode) { if (npc.type == NPCID.WallofFlesh && Main.rand.NextBool(1, 5)) { Item.NewItem(npc.getRect(), ModContent.ItemType <Items.Equipables.ReaperEmblem>()); } if (npc.type == NPCID.Golem) { if (rand == 1) { Item.NewItem(npc.getRect(), ModContent.ItemType <RockSpear>()); } else if (rand == 2) { Item.NewItem(npc.getRect(), ModContent.ItemType <RockWhip>()); } if (rand == 3) { Item.NewItem(npc.getRect(), ModContent.ItemType <RockSprayer>()); } if (rand == 4) { Item.NewItem(npc.getRect(), ModContent.ItemType <CelestialSundial>()); } else if (rand == 5) { Item.NewItem(npc.getRect(), ModContent.ItemType <RockYoyo>()); } } } if (DRGNModWorld.SwarmUp) { if (npc.type == mod.NPCType("Ant") || npc.type == mod.NPCType("FireAnt") || npc.type == mod.NPCType("ElectricAnt")) { Main.invasionSize -= 1; } else if (npc.type == mod.NPCType("FlyingAnt")) { Main.invasionSize -= 2; } else if (npc.type == mod.NPCType("AntCrawlerHead")) { Main.invasionSize -= 4; } else if (npc.type == mod.NPCType("DragonFly")) { Main.invasionSize = 0; } } if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && NPC.downedMoonlord && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode? 4 : Main.expertMode ? 2 : 1, 15)) { if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneUnderworldHeight) { Item.NewItem(npc.getRect(), mod.ItemType("MagmaticEssence")); } if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneJungle) { Item.NewItem(npc.getRect(), mod.ItemType("EarthenEssence")); } if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneSnow) { Item.NewItem(npc.getRect(), mod.ItemType("GlacialEssence")); } if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneSkyHeight) { Item.NewItem(npc.getRect(), mod.ItemType("LunarEssence")); } } if (npc.type == NPCID.Golem && DRGNModWorld.LihzahrdOre == false) { Main.NewText("The Jungle has condensed", 85, 85, 5); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 300); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.LihzahrdOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("LihzahrdOre")); } } if (npc.type == NPCID.MoonLordCore && DRGNModWorld.LuminiteOre == false) { Main.NewText("The Lunar Being has fallen and your world has been blessed", 180, 180, 180); Item.NewItem(npc.getRect(), mod.ItemType("LunarBlessing"), Main.ActivePlayersCount); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 300); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.LuminiteOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), TileID.LunarOre); } } if (npc.type == mod.NPCType("ToxicFrog") && DRGNModWorld.EarthenOre == false) { Main.NewText("The earth has released its energy", 0, 255, 100); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 200, Main.maxTilesY - 600); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.EarthenOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("EarthenOre")); } } if (npc.type == mod.NPCType("TheVirus") && DRGNModWorld.TechnoOre == false) { Main.NewText("Technology is infecting your world", 0, 40, 0); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 400, Main.maxTilesY - 200); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.TechnoOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("TechnoOre")); } } if (npc.type == mod.NPCType("Cloud") && DRGNModWorld.CosmoOre == false) { Main.NewText("The sun and moon have condensed", 180, 180, 255); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 600); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.CosmoOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("CosmoOre")); } } if (npc.type == mod.NPCType("VoidSnakeHead") && DRGNModWorld.VoidOre == false) { Main.NewText("The void has collapsed", 0, 255, 100); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 700, Main.maxTilesY); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.VoidOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("VoidOre")); } } if (npc.type == mod.NPCType("GalacticGuardian") && DRGNModWorld.GalactiteOre == false) { Main.NewText("A galaxy has formed in your world", 200, 200, 200); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 700, Main.maxTilesY); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.GalactiteOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(10, 15), WorldGen.genRand.Next(10, 15), (ushort)mod.TileType("GalacticaOre")); } } if (npc.type == mod.NPCType("IceFish") && DRGNModWorld.GlacialOre == false) { Main.NewText("The ancient being has fallen granting your world its power", 0, 100, 255); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next((int)WorldGen.worldSurface + 400, Main.maxTilesY - 300); int X = Main.rand.Next(100, Main.maxTilesX - 100); DRGNModWorld.GlacialOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("GlacialOre")); } } if (npc.type == mod.NPCType("FireDragon") && DRGNModWorld.SolariumOre == false) { Main.NewText("Hell has risen releasing power into the depths of your world", 255, 50, 50); for (int k = 0; k < 750; k++) //750 is the ore spawn rate. the bigger is the number = more ore spawns { int Y = Main.rand.Next(Main.maxTilesY - 400, Main.maxTilesY); int X = Main.rand.Next(10, Main.maxTilesX - 10); DRGNModWorld.SolariumOre = true; WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("SolariumOre")); } } }
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { DavesUtils.CrystilExplosion(projectile.velocity, projectile.damage, projectile.knockBack, projectile.owner, projectile.Center, mod.ProjectileType("CrystilShard"), Main.player[projectile.owner]); }