public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { if (rangeOut) { if (npc.alpha < 250) { npc.alpha += 25; } else { move = ArchaeaNPC.FindAny(npc, target(), false); if (move != Vector2.Zero) { type = 0; index = 0; if (pattern != Pattern.Attack) { count++; } npc.position = move; rangeOut = false; } } } return(npc.alpha < 250); }
protected bool DefaultAI() { reData = true; switch (ai) { case 0: ai = 0; if (PreDefaultMove()) { type = 0; index = 0; goto case 1; } return(false); case 1: ai = 1; move = ArchaeaNPC.FindAny(npc, target(), false); if (npc.alpha < 225) { npc.alpha += 25; } else { if (move != Vector2.Zero) { npc.position = move; } goto case 2; } return(true); case 2: ai = 2; if (npc.alpha > 0) { npc.alpha -= 25; } else { goto case 0; } return(true); } return(false); }
public override void AI() { npc.spriteDirection = 1; if (timer++ > 900) { npcCounter++; timer = 0; } if (timer % 600 == 0 && timer != 0) { move = Vector2.Zero; do { move = ArchaeaNPC.FindEmptyRegion(target(), ArchaeaNPC.defaultBounds(target())); } while (move == Vector2.Zero); SyncNPC(move.X, move.Y); fade = true; } if (timer % 300 == 0 && timer != 0) { if (timer != 600) { move = target().Center; SyncNPC(true, true); } } if (npcCounter > 1) { Vector2 newPosition = ArchaeaNPC.FindAny(npc, target(), false, 300); int n = NPC.NewNPC((int)newPosition.X, (int)newPosition.Y, mod.NPCType <Sky_1>(), 0, 0f, 0f, 0f, 0f, npc.target); if (Main.netMode == 2) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n); } npcCounter = 0; SyncNPC(); } if (fade) { npc.velocity = Vector2.Zero; if (npc.alpha < 255) { npc.scale -= 1f / 90f; npc.alpha += 255 / 15; } else { npc.position = move; if (FlameBurst()) { npc.scale = 1f; fade = false; } } } else { if (npc.alpha > 0) { npc.alpha -= 255 / 60; } if (timer < 600) { if (timer % 150 == 0) { move = ArchaeaNPC.FindAny(npc, target(), false); } float angle = npc.AngleTo(move); float cos = (float)(0.2f * Math.Cos(angle)); float sine = (float)(0.2f * Math.Sin(angle)); npc.velocity += new Vector2(cos, sine); ArchaeaNPC.VelocityClamp(ref npc.velocity, -4f, 4f); } } if (attack) { if (counter++ % 90 == 0) { angle += (float)Math.PI / 3f; float cos = (float)(npc.Center.X + npc.width * 3f * Math.Cos(angle)); float sine = (float)(npc.Center.Y + npc.height * 3f * Math.Sin(angle)); int t = Projectile.NewProjectile(new Vector2(cos, sine), Vector2.Zero, mod.ProjectileType <Orb>(), 12, 2f, 255, 0f, target().whoAmI); Main.projectile[t].whoAmI = t; if (Main.netMode == 2) { NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, t); } index++; } if (index == 6) { attack = false; } } else { index = 0; angle = ArchaeaNPC.RandAngle(); SyncNPC(false, false); } if (fade && npc.position != npc.oldPosition || npc.velocity.X < 0f && npc.oldVelocity.X >= 0f || npc.velocity.X > 0f && npc.oldVelocity.X <= 0f || npc.velocity.Y < 0f && npc.oldVelocity.Y >= 0f || npc.velocity.Y > 0f && npc.oldVelocity.Y <= 0f) { SyncNPC(); } }
protected void AttackPattern() { if (preAttack) { move = Vector2.Zero; attacks = 0; attack = -1; time = 0; preAttack = false; reData = true; } if (attack != FadeOut) { npc.velocity = Vector2.Zero; } switch (attack) { case -1: goto case Teleport; case Attack: if (BeginAttack() && time++ % attackRate == 0 && time != 0) { attacks++; if (attacks > totalAttacks) { pattern = Pattern.Active; reData = true; preAttack = true; break; } goto case Teleport; } break; case Teleport: attack = Teleport; if (PreFadeOut()) { goto case FadeOut; } break; case FadeOut: attack = FadeOut; move = ArchaeaNPC.FindAny(npc, target(), false); if (npc.alpha < 200) { npc.alpha += 5; } else if (BeginTeleport()) { if (npc.Distance(target().position) < 800f) { if (move != Vector2.Zero) { npc.position = move; } } goto case FadeIn; } break; case FadeIn: attack = FadeIn; if (npc.alpha > 0) { npc.alpha -= 5; } else { goto case Attack; } break; } }