public override void Kill(int timeLeft) { Player player = Main.player[projectile.owner]; Vector2 velocity = AntiarisHelper.VelocityToPoint(Main.MouseWorld, projectile.Center, 14); Projectile.NewProjectile(projectile.Center.X + Main.rand.Next(-150, 150), projectile.Center.Y + Main.rand.Next(-150, 150), velocity.X, velocity.Y, ModContent.ProjectileType <TheRedShard>(), (int)(36 * player.meleeDamage), 6.0f, projectile.owner, 0.0f, 0.0f); }
public override void AI() { Player player = Main.player[projectile.owner]; if (Main.myPlayer != projectile.owner) { return; } projectile.scale = projectile.Opacity; if (player.inventory[player.selectedItem].type == ModContent.ItemType <RoyalStave>() && !pos) { if (!(player.itemAnimation < player.inventory[player.selectedItem].useAnimation - 1)) { Vector2 velocity = AntiarisHelper.VelocityToPoint(projectile.Center, Main.MouseWorld, 6); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType <RoyalCrystalSpike>(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner); } } if (pos) { pos = false; Vector2 vector; vector.X = Main.MouseWorld.X - 30f; vector.Y = Main.MouseWorld.Y - 30f; projectile.netUpdate = true; projectile.position = vector; } }
public override void Kill(int timeLeft) { Vector2 velocity = AntiarisHelper.VelocityToPoint(projectile.Center, Main.MouseWorld, 8); SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Projectiles/Explosion"), projectile.position); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType <TerriBlade>(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner, 0.0f, 0.0f); for (int i = 0; i < 6; ++i) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height, 59, projectile.velocity.X * 0.24f, projectile.velocity.Y * 0.24f, 59, new Color(), 1.4f); } for (int i = 0; i < 6; ++i) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height, 62, projectile.velocity.X * 0.24f, projectile.velocity.Y * 0.24f, 62, new Color(), 1.4f); } for (int i = 0; i < 6; ++i) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width, projectile.height, 65, projectile.velocity.X * 0.24f, projectile.velocity.Y * 0.24f, 65, new Color(), 1.4f); } }
public override void AI() { Lighting.AddLight(npc.Center, 1f, 0.6f, 0.3f); Player player = Main.player[npc.target]; timer++; if (timer % 10 == 0) { frame++; } if (timer % 80 == 0) { attacking = true; } if (frame > 3 && !attacking) { frame = 0; } if ((frame < 4 || frame > 7) && attacking) { frame = 4; } if (attacking) { if (timer == 110) { var velocity = AntiarisHelper.VelocityToPoint(npc.Center, AntiarisHelper.RandomPointInArea(new Vector2(player.Center.X, player.Center.Y), new Vector2(player.Center.X + 20, player.Center.Y + 20)), 12); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("WrathSkull"), Main.rand.Next(20, 30), 1f); Main.PlaySound(SoundID.Item8); npc.position.X = (Main.player[npc.target].position.X - 500) + Main.rand.Next(1000); npc.position.Y = (Main.player[npc.target].position.Y - 500) + Main.rand.Next(1000); attacking = false; frame = 0; timer = 0; } } }
// notes for aiStyle 99: // localAI[0] is used for timing up to YoyosLifeTimeMultiplier // localAI[1] can be used freely by specific types // ai[0] and ai[1] usually point towards the x and y world coordinate hover point // ai[0] is -1f once YoyosLifeTimeMultiplier is reached, when the player is stoned/frozen, when the yoyo is too far away, or the player is no longer clicking the shoot button. // ai[0] being negative makes the yoyo move back towards the player // Any AI method can be used for dust, spawning projectiles, etc specific to your yoyo. void Shoot() { if (--TimeToShoot <= 0) { TimeToShoot = ShootRate; if (ShootType == -1) { ShootType = mod.ProjectileType(ShootTypeMod); } float NearestNPCDist = ShootDistance; int NearestNPC = -1; foreach (NPC npc in Main.npc) { if (!npc.active) { continue; } if (npc.friendly || npc.lifeMax <= 5 || npc.immortal) { continue; } if (NearestNPCDist == -1 || npc.Distance(projectile.Center) < NearestNPCDist && Collision.CanHitLine(projectile.Center, 16, 16, npc.Center, 16, 16)) { NearestNPCDist = npc.Distance(projectile.Center); NearestNPC = npc.whoAmI; } } if (NearestNPC == -1) { return; } Vector2 Velocity = AntiarisHelper.VelocityToPoint(projectile.Center, Main.npc[NearestNPC].Center, ShootSpeed); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Velocity.X, Velocity.Y, ShootType, ShootDamage, ShootKnockback, projectile.owner); } }
/*public override void AI() * { * var player = Main.player[npc.target]; * var anyPlayer = Main.player[Main.myPlayer]; * //anyPlayer. * anyPlayer.AddBuff(BuffID.WaterWalking, 60); * frameTimer++; * aiTimer++; * npc.rotation = 0f; * npc.direction = npc.spriteDirection; * if ((double)player.position.X > (double)npc.position.X) * npc.spriteDirection = 1; * else if ((double)player.position.X < (double)npc.position.X) * npc.spriteDirection = -1; * * if (frameTimer % 10 == 0) * { * frame++; * frameTimer = 0; * } * if (frame > 4 && !attackAnim) * { * frame = 0; * } * if (!player.active || player.dead) * { * npc.TargetClosest(false); * player = Main.player[npc.target]; * if (!player.active || player.dead) * { * npc.velocity = new Vector2(0f, 10f); * if (npc.timeLeft > 10) * { * npc.timeLeft = 10; * } * return; * } * } * * if (aiTimer > 240 && !attack) * { * attack = true; * if (aiTimer < 265) * { * attackAnim = true; * npc.velocity.X = 0; * npc.velocity.Y = 0; * } * if (attackAnim && frame > 9) * { * frame = 0; * attackAnim = false; * aiTimer = 0; * } * } * * if (attack) * { * switch (Main.rand.Next(1)) * { * case 0: * { * teleportingTimer++; * if (teleportingTimer == 120) * { * positionX = npc.position.X; * positionY = npc.position.Y; * } * if (teleportingTimer % 160 == 0) * { * teleportCount++; * Main.NewText("Teleport number" + teleportCount); * bossOldPosX = npc.position.X; * bossOldPosY = npc.position.Y; * * playerOldPosX = player.position.X; * playerOldPosY = player.position.Y; * Main.PlaySound(SoundID.Item8, npc.position); * for (int i = 0; i < 10; i++) * { * int dust = Dust.NewDust(new Vector2((float)npc.position.X, (float)npc.position.Y), npc.width, npc.height, 56, npc.velocity.X + Main.rand.Next(-10, 10), npc.velocity.Y + Main.rand.Next(-10, 10), 5, npc.color, 2.6f); * Main.dust[dust].noGravity = true; * } * Main.PlaySound(SoundID.Item8, player.position); * for (int i = 0; i < 10; i++) * { * int dust = Dust.NewDust(new Vector2((float)player.position.X, (float)player.position.Y), player.width, player.height, 56, player.velocity.X + Main.rand.Next(-10, 10), player.velocity.Y + Main.rand.Next(-10, 10), 5, Color.LightBlue, 2.6f); * Main.dust[dust].noGravity = true; * } * player.position.X = bossOldPosX; * player.position.Y = bossOldPosY; * npc.position.X = playerOldPosX; * npc.position.Y = playerOldPosY; * * var velocity = AntiarisHelper.VelocityToPoint(npc.Center, AntiarisHelper.RandomPointInArea(new Vector2(player.Center.X - 10, player.Center.Y - 10), new Vector2(player.Center.X + 20, player.Center.Y + 20)), Main.expertMode ? 16 : 20); * var shark = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, velocity.X, velocity.Y, 408, Main.rand.Next(20, 30), 1f); * Main.projectile[shark].friendly = false; * Main.projectile[shark].hostile = true; * Main.projectile[shark].tileCollide = false; * Main.projectile[shark].timeLeft = 300; * } * if (teleportCount == (Main.expertMode ? 7 : 6)) * { * attack = false; * teleportCount = 0; * } * } * break; * } * } * }*/ public override void AI() { aiTimer++; frameTimer++; Player player = Main.player[npc.target]; player.AddBuff(BuffID.WaterWalking, 60); if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; if (!player.active || player.dead) { npc.velocity = new Vector2(0f, 10f); if (npc.timeLeft > 10) { npc.timeLeft = 10; } return; } } npc.rotation = 0f; npc.direction = npc.spriteDirection; if ((double)player.position.X > (double)npc.position.X) { npc.spriteDirection = 1; } else if ((double)player.position.X < (double)npc.position.X) { npc.spriteDirection = -1; } if (frameTimer % 10 == 0) { frame++; frameTimer = 0; } if (frame > 4 && !attackAnim) { frame = 0; } if (aiTimer > 160 && aiTimer < 1200) { if (aiTimer == 161) { attackAnim = true; frame = 5; } if (aiTimer == 167) { frame = 6; } if (aiTimer == 173) { frame = 7; } if (aiTimer == 179) { frame = 8; } if (aiTimer == 185) { frame = 9; attackAnim = false; } waterTimer++; teleportingTimer++; switch (Main.rand.Next(4)) { case 0: { if (attackID == -1) { Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); attackID = 0; } } break; case 1: { if (attackID == -1) { Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); attackID = 1; } } break; case 2: { if (attackID == -1) { Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); attackID = 2; } } break; case 3: { if (attackID == -1) { Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); attackID = 3; } } break; } //summons tornados that chase the player & suck him in if (attackID == 0) { tornadoTimer++; if (tornadoTimer % (Main.expertMode ? 40 : 60) == 0) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 8); NPC.NewNPC((int)((Main.player[npc.target].position.X - 500) + Main.rand.Next(1000)), (int)((Main.player[npc.target].position.Y - 500) + Main.rand.Next(1000)), mod.NPCType("SeaTornado")); } } //curses the air, starts a countdown, in the end deals 1/3 (1/2 in expert) health damage to the player if he's not in the water else if (attackID == 1) { string CursedAir = Language.GetTextValue("Mods.Antiaris.CursedAir"); waterTimer++; if (waterTimer == 50) { Main.NewText(CursedAir, 76, 255, 246); } if (waterTimer < 760 && waterTimer % 120 == 0) { CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Cyan, 7 - waterTimer / 120, false, false); } if (waterTimer == 880 && !player.wet) { CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Red, player.statLife / 3, false, false); player.statLife -= player.statLife / (Main.expertMode ? 2 : 3); } } //swaps himself & the player, shoots sharks at the player, in the end returns to the beginning position if (attackID == 2) { teleportingTimer++; if (teleportingTimer == 120) { positionX = npc.position.X; positionY = npc.position.Y; } if (teleportingTimer % 160 == 0) { bossOldPosX = npc.position.X; bossOldPosY = npc.position.Y; playerOldPosX = player.position.X; playerOldPosY = player.position.Y; Main.PlaySound(SoundID.Item8, npc.position); for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(new Vector2((float)npc.position.X, (float)npc.position.Y), npc.width, npc.height, 56, npc.velocity.X + Main.rand.Next(-10, 10), npc.velocity.Y + Main.rand.Next(-10, 10), 5, npc.color, 2.6f); Main.dust[dust].noGravity = true; } Main.PlaySound(SoundID.Item8, player.position); for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(new Vector2((float)player.position.X, (float)player.position.Y), player.width, player.height, 56, player.velocity.X + Main.rand.Next(-10, 10), player.velocity.Y + Main.rand.Next(-10, 10), 5, Color.LightBlue, 2.6f); Main.dust[dust].noGravity = true; } player.position.X = bossOldPosX; player.position.Y = bossOldPosY; npc.position.X = playerOldPosX; npc.position.Y = playerOldPosY; var velocity = AntiarisHelper.VelocityToPoint(npc.Center, AntiarisHelper.RandomPointInArea(new Vector2(player.Center.X - 10, player.Center.Y - 10), new Vector2(player.Center.X + 20, player.Center.Y + 20)), Main.expertMode ? 16 : 20); var shark = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, velocity.X, velocity.Y, 408, Main.rand.Next(20, 30), 1f); Main.projectile[shark].friendly = false; Main.projectile[shark].hostile = true; Main.projectile[shark].tileCollide = false; Main.projectile[shark].timeLeft = 300; } } //steals player's soul, if the soul gets to Deadly Jones, he damages the player for 1/2 of health & restores his health for same amount //stay near soul to return it if (attackID == 3) { string SoulStolen = Language.GetTextValue("Mods.Antiaris.SoulStolen"); soulTimer++; if (soulTimer == 60) { Main.PlaySound(SoundID.Item8, npc.position); CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Cyan, SoulStolen, false, false); var velocity = AntiarisHelper.VelocityToPoint(player.Center, AntiarisHelper.RandomPointInArea(new Vector2(npc.Center.X - 10, npc.Center.Y - 10), new Vector2(npc.Center.X + 20, npc.Center.Y + 20)), Main.expertMode ? 1 : 2); var soul = Projectile.NewProjectile(player.Center.X, player.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("StolenSoul"), 0, 0f, Main.myPlayer); } } } if (aiTimer == 600) { aiTimer = 0; tornadoTimer = 0; waterTimer = 0; teleportingTimer = 0; soulTimer = 0; attackID = -1; } if (!player.ZoneBeach) { string LeavingBeach = Language.GetTextValue("Mods.Antiaris.LeavingBeach"); Main.NewText(LeavingBeach); Main.PlaySound(SoundID.Item8, player.position); for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(new Vector2((float)player.position.X, (float)player.position.Y), player.width, player.height, 56, player.velocity.X + Main.rand.Next(-10, 10), player.velocity.Y + Main.rand.Next(-10, 10), 5, Color.LightBlue, 2.6f); Main.dust[dust].noGravity = true; } player.position.X = npc.position.X; player.position.Y = npc.position.Y; } }
public override void Kill(int timeLeft) { Microsoft.Xna.Framework.Vector2 velocity = AntiarisHelper.VelocityToPoint(projectile.Center, Main.MouseWorld, 4); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType <CelestialMagic>(), projectile.damage, projectile.knockBack * 0.5f, projectile.owner); }
public override void AI() { npc.TargetClosest(true); var player = Main.player[npc.target]; npc.netUpdate = true; npc.spriteDirection = npc.direction; npc.rotation = npc.velocity.X * 0.1f; if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) { npc.TargetClosest(false); if (npc.velocity.X > 0.0f) { npc.velocity.X = npc.velocity.X + 0.75f; } else { npc.velocity.X = npc.velocity.X - 0.75f; } npc.velocity.Y = npc.velocity.Y - 0.1f; if (npc.timeLeft > 10) { npc.timeLeft = 10; return; } } if (Main.rand.Next(700) == 0) { Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, Main.rand.Next(81, 84)); } var velocity = AntiarisHelper.VelocityToPoint(npc.Center, AntiarisHelper.RandomPointInArea(new Vector2(player.Center.X - 10, player.Center.Y - 10), new Vector2(player.Center.X + 20, player.Center.Y + 20)), 6); if (!player.active || player.dead) { npc.TargetClosest(false); npc.velocity.Y = -10; timer = 0; } ++timer; if (timer < 350) { timer2++; if (timer2 >= 10) { frame++; timer2 = 0; } if (frame >= 5) { frame = 1; } } if (timer >= 150 && timer < 350) { Vector2 vector2_1 = player.Center + new Vector2(0.0f, -200.0f); float speed = 3f; Vector2 vector2_2 = vector2_1 - npc.Center; float distance = (float)Math.Sqrt((double)vector2_2.X * (double)vector2_2.X + (double)vector2_2.Y * (double)vector2_2.Y); vector2_2 *= speed / distance; npc.velocity = vector2_2; if (timer > 250) { npc.velocity.X = 0.0f; npc.velocity.Y = 13f; if ((double)npc.position.Y < (double)player.position.Y + 150.0) { timer = 350; frame = 5; } } } else if (timer >= 350) { npc.velocity.X = 0f; npc.velocity.Y = 0f; timer3++; if (timer3 >= 22) { frame++; timer3 = 0; } if (frame >= 11) { frame = 5; } if (timer % 100 == 0 && Main.netMode != 1) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("LeafMagic"), npc.damage, 1f); } } if (timer >= 550) { timer = 0; } }
public override void Kill(int timeLeft) { var velocity = AntiarisHelper.VelocityToPoint(projectile.Center, Main.MouseWorld, 4); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, mod.ProjectileType("CelestialMagic"), projectile.damage, projectile.knockBack * 0.5f, projectile.owner); }