protected bool DefaultAI() { reData = true; switch (ai) { case 0: ai = 0; move = Vector2.Zero; if (target() != null && target().Distance(npc.position) < range * 3f) { move = ArchaeaNPC.FastMove(target()); } if (move != Vector2.Zero) { goto case 1; } return(false); case 1: ai = 1; if (npc.alpha < 250) { npc.alpha += 25; } else { 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 bool PreAI() { if (timer++ > elapse) { timer = 0; } switch (pattern) { case Pattern.JustSpawned: if (JustSpawned()) { goto case Pattern.FadeIn; } break; case Pattern.FadeIn: pattern = Pattern.FadeIn; if (npc.alpha > 0) { npc.alpha -= 5; break; } else { goto case Pattern.Idle; } case Pattern.FadeOut: pattern = Pattern.FadeOut; if (npc.alpha < 255) { npc.alpha += 5; break; } goto case Pattern.Teleport; case Pattern.Teleport: pattern = Pattern.Teleport; move = ArchaeaNPC.FastMove(npc); if (move != Vector2.Zero) { npc.position = move; Teleport(); hasAttacked = false; goto case Pattern.FadeIn; } break; case Pattern.Idle: pattern = Pattern.Idle; if (timer % elapse == 0 && Main.rand.Next(3) == 0) { if (!hasAttacked) { hasAttacked = true; goto case Pattern.Attack; } else { goto case Pattern.FadeOut; } } return(false); case Pattern.Attack: pattern = Pattern.Attack; if (PreAttack()) { Attack(); attacks++; } if (attacks > maxAttacks) { pattern = Pattern.Idle; attacks = 0; } return(true); } return(false); }
protected void AttackPattern() { if (preAttack) { move = Vector2.Zero; attacks = 0; attack = -1; preAttack = false; reData = true; } if (attack != FadeOut) { npc.velocity = Vector2.Zero; } AttackMovement(); switch (attack) { case -1: goto case Teleport; case Attack_: if (index++ % attackRate == 0 && index != 0) { Attack(); attacks++; if (attacks > totalAttacks) { pattern = Pattern.Active; preAttack = true; break; } goto case Teleport; } break; case Teleport: attack = Teleport; if (BeginTeleport()) { Vector2 v = ArchaeaNPC.FastMove(target()); if (v != Vector2.Zero) { move = v; goto case FadeOut; } } break; case FadeOut: attack = FadeOut; if (npc.alpha < 200) { npc.alpha += 5; } else { if (npc.Distance(target().position) < 800f) { npc.position = move; } goto case FadeIn; } break; case FadeIn: attack = FadeIn; if (npc.alpha > 0) { npc.alpha -= 5; } else { goto case Attack_; } break; } }