public override void AI(NPC npc) { base.AI(npc); AttackTimer++; if (AttackTimer == 360) //warning dust { FargoSoulsUtil.DustRing(npc.Center, 32, DustID.Fire, 5f, scale: 1.5f); npc.netUpdate = true; NetSync(npc); } else if (AttackTimer >= 420) { npc.TargetClosest(); Vector2 velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 10; npc.velocity = velocity; AttackTimer = Main.rand.Next(-300, 0); npc.netUpdate = true; NetSync(npc); } if (Math.Abs(npc.velocity.Y) > 5 || Math.Abs(npc.velocity.X) > 5) { int dustId = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height + 5, DustID.Stone, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height + 5, DustID.Stone, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 1f); Main.dust[dustId3].noGravity = true; } }
public override void AI(NPC npc) { base.AI(npc); if (!Phase2 && npc.life < npc.lifeMax / 2) { Phase2 = true; FargoSoulsUtil.DustRing(npc.Center, 32, DustID.Torch, 10f, default, 3f);
public override void AI(NPC npc) { base.AI(npc); const int timeToBeginAttack = 360; if (++Counter == timeToBeginAttack) { FargoSoulsUtil.DustRing(npc.Center, 48, DustID.YellowTorch, 9f, default, 3f);
public override void AI(NPC npc) { base.AI(npc); if (Counter == 180) { if (npc.DeathSound != null) { SoundEngine.PlaySound(npc.DeathSound.Value, npc.Center); } FargoSoulsUtil.DustRing(npc.Center, 32, DustID.Teleporter, 5f, default, 2f);
public override void AI(NPC npc) { base.AI(npc); if (npc.type == NPCID.WallCreeperWall || npc.type == NPCID.BloodCrawlerWall || npc.type == NPCID.JungleCreeperWall) { if (Counter == 300) { FargoSoulsUtil.DustRing(npc.Center, 32, DustID.Web, 9f, scale: 1.5f); } if (Counter > 300) { npc.position -= npc.velocity; } if (++Counter > 360) { Counter = 0; if (npc.HasValidTarget && npc.Distance(Main.player[npc.target].Center) < 450 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) && Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, 14f * npc.DirectionTo(Main.player[npc.target].Center), ProjectileID.WebSpit, 9, 0f, Main.myPlayer); } } } if (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) { if (++Counter > 10) { Counter = 0; TargetIsWebbed = false; int t = npc.HasPlayerTarget ? npc.target : npc.FindClosestPlayer(); if (t != -1) { Player player = Main.player[t]; int b = player.FindBuffIndex(BuffID.Webbed); TargetIsWebbed = b != -1; //remember if target is webbed until counter activates again if (TargetIsWebbed) { player.AddBuff(ModContent.BuffType <Defenseless>(), player.buffTime[b]); } } } if (TargetIsWebbed) { npc.position += npc.velocity; } } }
public override void AI() { if (Projectile.localAI[0] == 0) { Projectile.localAI[0] = 1; Projectile.ai[0] = -1; //for homing foreach (Projectile p in Main.projectile.Where(p => p.active && p.type == Projectile.type && p.owner == Projectile.owner && p.ai[1] == 0 && p.whoAmI != Projectile.whoAmI)) { headsStacked++; } if (headsStacked == maxHeadsStacked - 1) { SoundEngine.PlaySound(SoundID.NPCHit41, Projectile.Center); FargoSoulsUtil.DustRing(Projectile.Center, 96, 87, 12f, default, 2f);
public override void AI(NPC npc) { base.AI(npc); AttackTimer++; if (AttackTimer == AttackThreshold - Telegraph) { if (!npc.HasPlayerTarget || npc.Distance(Main.player[npc.target].Center) > Distance || (NeedLineOfSight && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))) { AttackTimer = 0; } else if (DustType != -1) { FargoSoulsUtil.DustRing(npc.Center, 32, DustType, 5f, default, 2f);
public override void AI(NPC npc) { base.AI(npc); if (npc.velocity.Y < 0) //higher jump { npc.position.Y += npc.velocity.Y; } if (++Counter % 120 == 0) { if (npc.HasPlayerTarget && Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, new Vector2(6f, 0f).RotatedByRandom(2 * Math.PI), ModContent.ProjectileType <FrostfireballHostile>(), FargoSoulsUtil.ScaledProjectileDamage(npc.damage, 0.8f), 0f, Main.myPlayer, npc.target, 30f); } } if (Counter == 600 - 60) { FargoSoulsUtil.DustRing(npc.Center, 64, DustID.IceTorch, 16f, scale: 3f); } if (Counter > 600) { Counter = 0; if (npc.HasPlayerTarget && Main.netMode != NetmodeID.MultiplayerClient) { const int max = 16; for (int i = 0; i < max; i++) { Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, 6f * npc.DirectionTo(Main.player[npc.target].Center).RotatedBy(MathHelper.TwoPi / max * i), ModContent.ProjectileType <FrostfireballHostile>(), FargoSoulsUtil.ScaledProjectileDamage(npc.damage), 0f, Main.myPlayer, npc.target, 180f); } } NetSync(npc); } }
public override bool PreAI(NPC npc) { bool result = base.PreAI(npc); const float gravity = 0.4f; if (++JumpTimer > 600) //initiate jump { JumpTimer = 0; int t = npc.HasPlayerTarget ? npc.target : npc.FindClosestPlayer(); if (t != -1 && Main.netMode != NetmodeID.MultiplayerClient && npc.Distance(Main.player[t].Center) < 900) { const float time = 90; Vector2 distance; if (Main.player[t].active && !Main.player[t].dead && !Main.player[t].ghost) { distance = Main.player[t].Center - npc.Bottom; } else { distance = new Vector2(npc.Center.X < Main.player[t].Center.X ? -300 : 300, -100); } distance.X = distance.X / time; distance.Y = distance.Y / time - 0.5f * gravity * time; npc.ai[1] = time; npc.ai[2] = distance.X; npc.ai[3] = distance.Y; npc.netUpdate = true; } return(false); } if (JumpTimer == 540) { FargoSoulsUtil.DustRing(npc.Center, 64, DustID.RedTorch, 12f, default, 4f);