Exemplo n.º 1
0
 public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
 {
     if (ArchaeaItem.Elapsed(30) && player.controlUseItem)
     {
         player.CheckMana(manaCost, true);
         player.manaRegenDelay = 120;
     }
     if (time++ % elapsed == 0 && time != 0)
     {
         update = true;
         index++;
     }
     for (int i = 0; i < index; i++)
     {
         if (i < 5)
         {
             dust[i]           = Dust.NewDustDirect(player.Center - new Vector2(25f, 32f) + new Vector2(i * 12f, 0f), 1, 1, DustID.Fire, 0f, 0f, 0, default(Color), 2f);
             dust[i].noGravity = true;
         }
     }
     if (targets == null)
     {
         return;
     }
     if (index == 5)
     {
         foreach (Target target in targets.Where(t => t != null))
         {
             target.AttackEffect(Target.ShockWave);
         }
         BlastWave(player);
         index = 0;
     }
 }
Exemplo n.º 2
0
 public override void AI()
 {
     if (ArchaeaItem.Elapsed(5))
     {
         Dust.NewDustDirect(projectile.Center, 1, 1, DustID.Fire);
     }
 }
Exemplo n.º 3
0
        public override void AI()
        {
            if (!owner.active || owner.dead)
            {
                projectile.active = false;
            }
            if (target == null)
            {
                if (ArchaeaItem.Elapsed(180))
                {
                    target = Target.GetClosest(owner, Target.GetTargets(projectile, 300f).Where(t => t != null).ToArray());
                    rand   = Main.rand.Next(3);
                    old    = projectile.Center;
                    Vector2 speed;
                    switch (rand)
                    {
                    case 0:
                        speed = NPCs.ArchaeaNPC.AngleToSpeed(NPCs.ArchaeaNPC.RandAngle(), idleSpeed);
                        projectile.velocity += speed;
                        break;

                    case 1:
                        speed  = NPCs.ArchaeaNPC.AngleToSpeed((float)-Math.PI / 2f, idleSpeed);
                        moveTo = projectile.Center + speed;
                        Tile ground = Main.tile[(int)moveTo.X / 16, (int)moveTo.Y / 16];
                        if (ground.active())
                        {
                            projectile.velocity += speed;
                            break;
                        }
                        else
                        {
                            goto case 0;
                        }

                    case 2:
                        if (Main.rand.NextFloat() < 0.15f)
                        {
                            ai = 1;
                        }
                        break;
                    }
                }
                if (projectile.Distance(old) > roam * 1.5f)
                {
                    projectile.velocity = Vector2.Zero;
                }
            }
            else if (!FindOwner())
            {
                ai = 0;
                float angle = NPCs.ArchaeaNPC.AngleTo(projectile.Center, target.npc.Center);
                if (ArchaeaItem.Elapsed(120))
                {
                    projectile.velocity = NPCs.ArchaeaNPC.AngleToSpeed(angle, 10f);
                }
                SlowDown(0.5f, ref projectile.velocity, out projectile.velocity);
            }
            FindGround(ai == 0);
        }
Exemplo n.º 4
0
 public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
 {
     if (item.mana > 0)
     {
         target = Target.GetClosest(player, Target.GetTargets(player, 240f).Where(t => t != null).ToArray());
         if (target != null && ArchaeaItem.Elapsed(90))
         {
             Shield.ShockTarget(hitbox.Center(), target.npc, item.damage);
         }
     }
 }
Exemplo n.º 5
0
        public override void AI()
        {
            if (owner.inventory[owner.selectedItem].type != mod.ItemType <n_Staff>())
            {
                projectile.Kill();
            }
            if (ArchaeaItem.Elapsed(30))
            {
                target = Target.GetClosest(owner, Target.GetTargets(projectile, 300f).Where(t => t != null).ToArray());
                projectile.netUpdate = true;
            }
            switch (type)
            {
            case 0:
                if (target == null)
                {
                    center            = Main.MouseWorld;
                    angle            += Draw.radian * 4f;
                    projectile.Center = NPCs.ArchaeaNPC.AngleBased(center, angle, 45f);
                    return;
                }
                else
                {
                    type = 1;
                }
                break;

            case 1:
                if (target == null || !target.npc.active || target.npc.life <= 0)
                {
                    goto case 2;
                }
                float a = NPCs.ArchaeaNPC.AngleTo(projectile.Center, target.npc.Center);
                projectile.velocity += Speed(a, target.npc.Center);
                NPCs.ArchaeaNPC.VelocityClamp(projectile, -8f, 8f);
                break;

            case 2:
                float a2 = NPCs.ArchaeaNPC.AngleTo(projectile.Center, center);
                center = Main.MouseWorld;
                projectile.velocity += Speed(a2, center);
                NPCs.ArchaeaNPC.VelocityClamp(projectile, -5f, 5f);
                if (projectile.Distance(Main.MouseWorld) < 90f)
                {
                    type = 0;
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
        public override bool PreAI()
        {
            switch (ai)
            {
            case -1:
                goto case 0;

            case 0:
                ai = 0;
                if (ArchaeaItem.Elapsed(5))
                {
                    Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.Fire);
                }
                break;
            }
            return(true);
        }
Exemplo n.º 7
0
        public override bool PreAI()
        {
            switch (ai)
            {
            case -1:
                projectile.position = owner.Center + new Vector2(32 * owner.direction, 0f);
                goto case 0;

            case 0:
                ai = 0;
                break;

            case 1:
                if (ArchaeaItem.Elapsed(60))
                {
                    elapsed++;
                }
                if (elapsed == 5)
                {
                    goto case 0;
                }
                float angle = NPCs.ArchaeaNPC.AngleTo(projectile.Center, new Vector2(owner.Center.X, owner.position.Y + owner.height));
                projectile.velocity = NPCs.ArchaeaNPC.AngleToSpeed(angle, followSpeed);
                if (projectile.Hitbox.Intersects(owner.Hitbox))
                {
                    goto case 2;
                }
                return(false);

            case 2:
                ai = 2;
                projectile.Center = owner.Center - new Vector2(owner.width / 2 * owner.direction, 16f);
                if (target != null)
                {
                    goto case 0;
                }
                break;
            }
            return(true);
        }
Exemplo n.º 8
0
 public override void AI()
 {
     if (ArchaeaItem.Elapsed(60))
     {
         targets = Target.GetTargets(projectile, range).Where(t => t != null).ToArray();
         target  = Target.GetClosest(owner, targets);
     }
     if (targets == null)
     {
         return;
     }
     if (RightClick())
     {
         foreach (Target tg in targets.Where(t => t != null))
         {
             if (tg.npc.Hitbox.Contains(Main.MouseWorld.ToPoint()))
             {
                 follow = tg;
             }
         }
     }
     if (follow == null)
     {
         return;
     }
     if (!follow.npc.active || follow.npc.Distance(owner.Center) > Main.screenWidth / 2f)
     {
         follow = null;
     }
     if (follow != null && ai != Attack)
     {
         moveTo = follow.npc.Center;
         if (!projectile.Hitbox.Contains(moveTo.ToPoint()))
         {
             projectile.velocity += NPCs.ArchaeaNPC.AngleToSpeed(NPCs.ArchaeaNPC.AngleTo(projectile.Center, moveTo), moveSpeed);
         }
     }
     NPCs.ArchaeaNPC.VelocityClamp(projectile, -5f, 5f);
 }
Exemplo n.º 9
0
 public override void AI()
 {
     if (ArchaeaItem.Elapsed(5))
         Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire);
 }