Exemple #1
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Summons a Magno minion"
                              + "\nto your aid when"
                              + "\nin dire need";

            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            if (!flag && player.statLife <= player.statLifeMax / 2)
            {
                if (player.ownedProjectileCounts[mod.ProjectileType("magno_minion")] < player.maxMinions && player.numMinions < player.maxMinions)
                {
                    player.AddBuff(mod.BuffType("magno_summon"), 18000, false);
                    Main.PlaySound(2, player.Center, 20);
                    projMinion         = Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("magno_minion"), 5, 3f, player.whoAmI, 0f, 0f);
                    player.maxMinions += 1;
                }
                flag = true;
            }
            if (flag && player.statLife > player.statLifeMax / 2)
            {
                if (Main.projectile[projMinion].type == mod.ProjectileType("magno_minion"))
                {
                    Main.projectile[projMinion].active = false;
                }
                flag = false;
            }
        }
Exemple #2
0
        public override void AI()
        {
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            center = player.Center;

            if (!init)
            {
                Initialize();
                init = true;
            }
            if (ticks < 900)
            {
                ticks++;
            }
            else
            {
                ticks = 0;
            }
            if (ticks % 180 == 0)
            {
                projectile.netUpdate = true;
            }

            if (modPlayer.magnoShield && !player.dead)
            {
                projectile.timeLeft = 2;
            }

            degrees += radians * 4.5f;
            projectile.position.X = (center.X - projectile.width / 2) + (float)(radius * Math.Cos(degrees));
            projectile.position.Y = (center.Y - projectile.height / 2) + (float)(radius * Math.Sin(degrees));

            float Angle = (float)Math.Atan2(player.position.Y - projectile.position.Y, player.position.X - projectile.position.X);

            projectile.rotation = Angle + MathHelper.ToRadians(180);

            foreach (Projectile p in Main.projectile)
            {
                if (p.active && !p.friendly && p.owner != player.whoAmI && p.type != mod.ProjectileType <m_shield>())
                {
                    if (p.Hitbox.Intersects(projectile.Hitbox))
                    {
                        p.Kill();
                        damage++;
                        // play sound, metal tink
                        Main.PlaySound(21, projectile.position, 0);
                    }
                }
            }
            if (damage == maxDamage)
            {
                projectile.Kill();
                damage = 0;

                // play sound, metal clang
            }
        }
        public override void PickAmmo(Item item, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
        {
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            if (modPlayer.magnoRanged)
            {
                if (item.type == ItemID.WoodenArrow || item.type == ItemID.EndlessQuiver)
                {
                    type = mod.ProjectileType("cinnabar_arrow");
                }
            }
        }
Exemple #4
0
 public override bool CanUseItem(Player player)
 {
     for (int i = 0; i < Main.npc.Length; i++)
     {
         NPC npc = Main.npc[i];
         if (npc.type == bossType && (npc.active || npc.life > 0))
             return false;
     }
     ArchaeaPlayer modPlayer = player.GetModPlayer<ArchaeaPlayer>();
     if (!modPlayer.SkyFort && !modPlayer.SkyPortal)
         return false;
     return true;
 }
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            if (Main.netMode != 0)
            {
                MultiPlayerEffects(player, MathHelper.ToRadians(90f));
            }
            else
            {
                SinglePlayerEffects(player, MathHelper.ToRadians(90f));
            }
        }
Exemple #6
0
        public override void Update(Player player, ref int buffIndex)
        {
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            if (player.ownedProjectileCounts[mod.ProjectileType("magno_minion")] == 0)
            {
                player.DelBuff(buffIndex);
                buffIndex--;
            }
            else
            {
                player.buffTime[buffIndex] = 18000;
            }
        }
        public override bool CanUseItem(Player player)
        {
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            foreach (NPC n in Main.npc)
            {
                if (n.active && n.type == mod.NPCType("boss_magnohead"))
                {
                    isActive = true;
                    break;
                }
                else
                {
                    isActive = false;
                }
            }

            return(modPlayer.MagnoZone && !isActive);
        }
        public override void Kill(Projectile projectile, int timeLeft)
        {
            Player        player    = Main.LocalPlayer;
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            if (modPlayer.magnoRanged && Main.rand.NextFloat() > 0.85f && projectile.friendly && projectile.arrow)
            {
                for (float k = 0; k < MathHelper.ToRadians(360); k += 0.017f * 9)
                {
                    int Proj1 = Projectile.NewProjectile(projectile.position + new Vector2(projectile.width / 2, projectile.height / 2), Distance(null, k, 16f), mod.ProjectileType("dust_diffusion"), projectile.damage / 2, projectile.knockBack, projectile.owner, Distance(null, k, 16f).X, Distance(null, k, 16f).Y);
                    if (Main.netMode == 1)
                    {
                        NetMessage.SendData(27, -1, -1, null, Proj1);
                    }
                }
                //custom sound
                //Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IceBeamChargeShot"), projectile.position);
                //vanilla sound
                Main.PlaySound(2, projectile.position, 14);
            }
        }
Exemple #9
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            ShieldStyle();
            switch (ai)
            {
            case Start:
                if (player.CheckMana(10, true))
                {
                    for (float r = 0; r < Math.PI * 2f; r += (float)Math.PI / (max / 2f))
                    {
                        if (index < max)
                        {
                            shield[index] = new Shield(player, r);
                            index++;
                        }
                    }
                    index = 0;
                    goto case Orbit;
                }
                break;

            case Reset:
                break;

            case Orbit:
                ai   = Orbit;
                type = Orbit;
                if (ArchaeaPlayer.KeyPress(Keys.E))
                {
                    move = Main.MouseWorld;
                    goto case Throw;
                }
                break;

            case Throw:
                ai   = Throw;
                type = Throw;
                break;
            }
        }
Exemple #10
0
        public override void AI()
        {
            Player        player    = Main.player[npc.target];
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            npcCenter = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.height / 2);

            if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
            {
                npc.TargetClosest(true);
            }

            if (ticks < 2000)
            {
                ticks++;
            }
            else
            {
                ticks = 0;
            }

            #region spawn parts
            Previous = npc.whoAmI;
            if (!spawned)
            {
                for (int i = 0; i < 11; i++)
                {
                    if (i != 10)
                    {
                        digger = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType <boss_magnobody>(), npc.whoAmI, 0f, 0f, 0f, npc.whoAmI);
                    }
                    else
                    {
                        digger = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType <boss_magnotail>(), npc.whoAmI, 0f, 0f, 0f, npc.whoAmI);
                        //  if (Main.expertMode) core = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType<m_core>(), npc.whoAmI, npc.whoAmI);
                    }
                    NPC nme = Main.npc[digger];
                    nme.target               = npc.target;
                    nme.scale                = npc.scale;
                    nme.defense              = npc.defense;
                    nme.lifeMax              = npc.lifeMax;
                    nme.realLife             = npc.whoAmI;
                    nme.ai[2]                = npc.whoAmI;
                    nme.ai[1]                = Previous;
                    Main.npc[Previous].ai[0] = digger;
                    Previous = digger;

                    spawned = true;
                }
            }

            /*  if (Main.expertMode && !Flag7)
             *  {
             *      NPC HeadCore = Main.npc[core];
             *      HeadCore.Center = npc.Center;
             *      HeadCore.rotation = npc.rotation;
             *      if (HeadCore.life > 0 || HeadCore.active)
             *          npc.dontTakeDamage = true;
             *      else
             *      {
             *          npc.dontTakeDamage = false;
             *          Flag7 = true;
             *      }
             *  }   */
            #endregion

            #region movement variation
            if (ticks % 900 == 0)
            {
                extraTimer = 150;
                towerAbove = true;
            }
            if (towerAbove)
            {
                extraTimer--;
                npc.velocity = Vector2.Zero;
                if (npc.position.Y < player.position.Y - 256f)
                {
                    if (!set2)
                    {
                        if (player.position.X <= npc.position.X)
                        {
                            goLeft = true;
                        }
                        if (player.position.X >= npc.position.X)
                        {
                            goRight = true;
                        }
                        set2 = true;
                    }
                    if (goLeft)
                    {
                        npc.position.X -= 8f;
                        npc.rotation    = MathHelper.ToRadians(270);
                    }
                    if (goRight)
                    {
                        npc.position.X += 8f;
                        npc.rotation    = MathHelper.ToRadians(90);
                    }
                    set1          = true;
                    npc.netUpdate = true;
                }
                if (!set1)
                {
                    npc.position.Y -= 8f;
                    npc.rotation    = 0;
                }
                // play sound, rush
                if (extraTimer == 0)
                {
                    set1       = false;
                    set2       = false;
                    goLeft     = false;
                    goRight    = false;
                    towerAbove = false;
                }
            }
            #endregion

            #region mouth flames
            if (Vector2.Distance(player.position - npc.position, Vector2.Zero) < 384f)
            {
                if (ticks % 10 == 0)
                {
                    Vector2 burst = Distance(null, npc.rotation + radians * 270f, 16f);
                    attack = Projectile.NewProjectile(npc.Center, burst, mod.ProjectileType("magno_flame"), 8 + Main.rand.Next(-2, 5), 0.5f, Main.myPlayer, 20f, 1f);
                    Projectile proj = Main.projectile[attack];
                    proj.timeLeft    = 30;
                    proj.penetrate   = 1;
                    proj.tileCollide = false;
                    proj.scale       = 1.6f;
                    proj.alpha       = 50;
                    proj.friendly    = false;
                    proj.hostile     = true;
                }
            }
            #endregion

            // unused
            #region npc damage modifier

            /*  if (npcNoDamage)
             *  {
             *      npc.damage = 0;
             *      for (int i = 0; i < MagnoParts.Length; i++)
             *      {
             *          NPC nme = Main.npc[MagnoParts[i]];
             *          nme.damage = 0;
             *      }
             *  }
             *  else
             *  {
             *      npc.damage = Main.expertMode ? 60 : 35;
             *      for (int i = 0; i < MagnoParts.Length; i++)
             *      {
             *          NPC nme = Main.npc[MagnoParts[i]];
             *          nme.damage = Main.expertMode ? 36 : 18;
             *      }
             *  }   */
            #endregion
            #region tower and grab

            /*  if (timer2 <= 4)
             *  {
             *      if (!flag2)
             *      {
             *          Rectangle npcPoint = new Rectangle((int)npc.position.X + npc.width / 2, (int)npc.position.Y + npc.height / 2, 32, 32);
             *          if (!switchSides)
             *          {
             *              Rectangle rightPoint = new Rectangle((int)player.position.X + bufferX, (int)player.position.Y + bufferY, 32, 32);
             *              Vector2 rightPosition = new Vector2(player.position.X + bufferX, player.position.Y + bufferY);
             *              float angle3 = (float)Math.Atan2(rightPosition.Y - npc.position.Y, rightPosition.X - npc.position.X);
             *              npc.velocity = Distance(player, angle3, 8f);
             *              if (npcPoint.Intersects(rightPoint))
             *              {
             *                  pattern = true;
             *                  flag2 = true;
             *                  timer2++;
             *              }
             *          }
             *          else
             *          {
             *              Rectangle leftPoint = new Rectangle((int)player.position.X - bufferX, (int)player.position.Y + bufferY, 32, 32);
             *              Vector2 leftPosition = new Vector2(player.position.X - bufferX, player.position.Y + bufferY);
             *              float angle4 = (float)Math.Atan2(leftPosition.Y - npc.position.Y, leftPosition.X - npc.position.X);
             *              npc.velocity = Distance(player, angle4, 8f);
             *              if (npcPoint.Intersects(leftPoint))
             *              {
             *                  pattern = true;
             *                  flag2 = true;
             *                  timer2++;
             *              }
             *          }
             *      }
             *      if (pattern)
             *      {
             *          degrees += radians;
             *          float radius = 2f;
             *          float Point = (float)(radius * Math.Cos(degrees));
             *          float intensity = (radius - Point) / radius;
             *
             *          zoneRight = Vector2.Lerp(new Vector2(player.position.X + bufferX, player.position.Y + bufferY), new Vector2(player.Center.X + bufferX, player.position.Y - bufferY / 4), intensity);
             *          zoneLeft = Vector2.Lerp(new Vector2(player.position.X - bufferX, player.position.Y + bufferY), new Vector2(player.Center.X - bufferX, player.position.Y - bufferY / 4), intensity);
             *          if (Math.Round(intensity, 0) == 1f)
             *          {
             *              timer++;
             *          }
             *          if (timer < 128)
             *          {
             *              if (!switchSides)
             *                  npc.position = zoneRight;
             *              else npc.position = zoneLeft;
             *          }
             *          if (timer >= 128)
             *          {
             *              switchSides = !switchSides;
             *              flag2 = false;
             *              pattern = false;
             *              timer = 0;
             *          }
             *      }
             *      if (ticks % 120 == 0)
             *      {
             *          bool chance = Main.rand.Next(5) == 0;
             *          if (chance)
             *          {
             *              int mob = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType<m_diggerhead>());
             *              if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, numPets[0], 0f, 0f, 0f, 0, 0, 0);
             *          }
             *      }
             *      degrees2 += radians;
             *      float radius2 = 8f;
             *      float Point2 = (float)(radius2 * Math.Cos(degrees2));
             *      float intensity2 = (radius2 - Point2) / radius2;
             *      float Angle2 = (float)Math.Atan2(npc.Center.Y - player.Center.Y, npc.Center.X - player.Center.X);
             *      if (!flag4 && Vector2.Distance(npc.position - player.position, Vector2.Zero) < 256f)
             *      {
             *          player.velocity.X = Distance(player, Angle2, radius2).X;
             *          player.velocity.Y = Distance(player, Angle2, radius2).Y;
             *      }
             *      if (!flag4 && player.Hitbox.Intersects(npc.Hitbox))
             *      {
             *          npcNoDamage = true;
             *          player.Center = npc.Center;
             *          bool chance = Main.rand.Next(60) == 0;
             *          if (chance)
             *          {
             *              player.velocity.X = Distance(player, npc.rotation - MathHelper.ToRadians(90), 32f).X;
             *              player.velocity.Y = Distance(player, npc.rotation - MathHelper.ToRadians(90), 32f).Y;
             *              flag4 = true;
             *              npcNoDamage = false;
             *          }
             *      }
             *  }*/
            #endregion
            //

            if (!Flag3 && npc.life < npc.lifeMax - npc.lifeMax / 4)
            {
                timer2 = 0;
                Flag3  = true;
            }

            // bugged
            #region spirit flames

            /*  //  needs cleanup
             * if (!flames && Main.rand.Next(0, 6000) == 0)
             * {
             *  for (int k = 1; k < 4; k++)
             *  {
             *      degrees = 67.5f;
             *      radius = 128f;
             *      center = player.position;
             *      float nX = center.X + (float)(radius * Math.Cos(degrees * k));
             *      float nY = center.Y + (float)(radius * Math.Sin(degrees * k));
             *
             *      if (npc.life > npc.lifeMax / 2 || Main.npc[digger].life > Main.npc[digger].lifeMax / 2)
             *      {
             *          flamesID = NPC.NewNPC((int)nX, (int)nY, mod.NPCType("m_flame"));
             *          Main.npc[flamesID].damage = 10;
             *      }
             *      else
             *      {
             *          flamesID = NPC.NewNPC((int)nX, (int)nY, mod.NPCType("c_flame"));
             *          Main.npc[flamesID].damage = 16;
             *      }
             *      Main.npc[flamesID].ai[1] = degrees * k;
             *      Main.npc[flamesID].scale = 1.2f;
             *      if (Main.netMode == 2)
             *      {
             *          NetMessage.SendData(23, -1, -1, null, flamesID, 0f, 0f, 0f, 0, 0, 0);
             *      }
             *      flames = true;
             *  }
             *  Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/curse"), npc.Center);
             * }
             * if (flames)
             * {
             *  radius -= 0.5f;
             *  NPC n = Main.npc[flamesID];
             *  if (n.active = false || radius <= 1f)
             *      flames = false;
             * }
             */
            #endregion
            #region magno clone sequence
            // needs to sprite/code separate NPC for magno clone

            /*
             * npcCenter = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.height / 2);
             * if (!magnoClone)
             * {
             *  if (!pupsSpawned && ticks == 900)
             *  {
             *      ticks++;
             *      numPets[0] = NPC.NewNPC((int)npcCenter.X + Main.rand.Next(-64, 64), (int)npcCenter.Y, mod.NPCType<m_puphead>(), 0, 0f);
             *      if (Main.netMode == 2)
             *      {
             *          NetMessage.SendData(23, -1, -1, null, numPets[0], 0f, 0f, 0f, 0, 0, 0);
             *      }
             *      Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/conjure"), npc.Center);
             *      pupsSpawned = true;
             *  }
             *  if (pupsSpawned)
             *  {
             *      if (!Main.npc[numPets[0]].active)
             *      {
             *          pupsSpawned = false;
             *          magnoClone = true;
             *          flag = true;
             *      }
             *  }
             * }
             * if (magnoClone)
             * {
             *  if (flag)
             *  {
             *      Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/conjure"), npc.Center);
             *      clone = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType<clone_magnohead>(), npc.whoAmI, npc.whoAmI);
             *      if (Main.netMode == 2)
             *      {
             *          NetMessage.SendData(23, -1, -1, null, clone, 0f, 0f, 0f, 0, 0, 0);
             *      }
             *      Main.npc[clone].color = Color.Gold;
             *      flag = false;
             *  }
             *  else
             *  {
             *      magnoClone = false;
             *  }
             * }
             * if (Main.expertMode && Main.npc[clone].active)
             * {
             *  npc.immortal = true;
             *  npc.dontTakeDamage = true;
             * }
             * if (!Main.npc[clone].active)
             * {
             *  npc.immortal = false;
             *  npc.dontTakeDamage = false;
             *  flag = true;
             *  magnoClone = false;
             * }   */
            #endregion
            //

            #region patterns
            float angleToPlayer = (float)Math.Atan2(player.position.Y - npc.position.Y, player.position.X - npc.position.X);

            if (ticks % 600 == 0)
            {
                rush = true;
                enrage++;
            }
            if (rush && !towerAbove && !IsDigging((int)npcCenter.X, (int)npcCenter.Y))
            {
                if (rushTimer > 0)
                {
                    if (rushTimer % 90 == 0)
                    {
                        if (enrage < 16)
                        {
                            npc.velocity = Distance(null, angleToPlayer, 8f);
                        }
                        else
                        {
                            npc.velocity = Distance(null, angleToPlayer, 8f) * 1.25f;
                            Main.PlaySound(2, npc.Center, 10);
                        }
                        npc.netUpdate = true;
                    }
                    rushTimer--;
                }
                else
                {
                    rushTimer = 270;
                    rush      = false;
                }
            }

            if (part2)
            {
                if (ticks % 900 == 0 && !Flag5)
                {
                    Flag5 = true;
                }
                if (Flag5)
                {
                    copyTimer--;
                }
                if (copyTimer < 0 || Flag6)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType <clone_magnohead>());
                    }
                    copyTimer = 900;
                    Flag6     = false;
                }
                foreach (NPC n in Main.npc)
                {
                    if (n.type == mod.NPCType <clone_magnohead>())
                    {
                        if (n.active && n.life > 0)
                        {
                            npc.dontTakeDamage = true;
                            copyTimer          = 900;
                        }
                        else
                        {
                            npc.dontTakeDamage = false;
                            Flag5 = true;
                        }
                    }
                }
            }
            #endregion

            // play NPC sound at half life
            if (npc.life < npc.lifeMax / 2 && !part2)
            {
                if (!soundOnce)
                {
                    Main.PlaySound(2, npc.Center, 10);
                    soundOnce = true;
                }
                timer2 = 0;
                Flag6  = true;
                part2  = true;
            }

            foreach (Projectile proj in Main.projectile)
            {
                if (proj.Hitbox.Intersects(npc.Hitbox) && proj.friendly && proj.active && proj.type != 96)
                {
                    lootPos = proj.position;
                }
            }
        }
        public override void AI()
        {
            if (!init)
            {
                Initialize();
                init = true;
            }

            Player        player    = Main.player[projectile.owner];
            ArchaeaPlayer modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);

            ticks++;
            projectile.damage = 0;

            if (player.dead || !player.HasBuff(mod.BuffType("magno_summon")))
            {
                projectile.active = false;
            }
            if (player.HasBuff(mod.BuffType("magno_summon")))
            {
                projectile.timeLeft = 2;
            }
            if (player.ownedProjectileCounts[projectile.type] > player.maxMinions)
            {
                foreach (Projectile p in Main.projectile)
                {
                    if (p.type == projectile.type && p.active)
                    {
                        p.Kill();
                        break;
                    }
                }
            }

            if (!flag3)
            {
                Random = Main.rand.Next(-24, 24);
                projectile.netUpdate = true;
                flag3 = true;
            }
            orbitPosition = player.position + new Vector2(Random * 2f, -64f);
            Angle         = (float)Math.Atan2(orbitPosition.Y - projectile.position.Y, orbitPosition.X - projectile.position.X);
            if (!target)
            {
                if (Vector2.Distance(orbitPosition - projectile.position, Vector2.Zero) > 32f && Vector2.Distance(orbitPosition - projectile.position, Vector2.Zero) <= 128f)
                {
                    projectile.position += Distance(null, Angle, 4f);
                    projectile.velocity  = Vector2.Zero;
                }
                else if (Vector2.Distance(orbitPosition - projectile.position, Vector2.Zero) > 128f)
                {
                    projectile.velocity = Distance(null, Angle, 8f);
                }
                if (Vector2.Distance(orbitPosition - projectile.position, Vector2.Zero) > 1024)
                {
                    projectile.position = player.Center - new Vector2(0, player.height);
                }
                #region float
                float Revolution     = 6.28308f;
                float WavesPerSecond = 1.0f;
                float Time           = 1.0f / Main.frameRate;
                WaveTimer += Time * Revolution * WavesPerSecond;
                float Cos        = (float)Math.Cos(180);
                float WaveOffset = (float)Math.Sin(WaveTimer) * 5f;

                projectile.position.Y += Cos * WaveOffset;
                #endregion
            }

            foreach (NPC n in Main.npc)
            {
                if (n.active && !n.friendly && !n.dontTakeDamage && !n.immortal && n.target == player.whoAmI && ((n.lifeMax >= 50 && (Main.expertMode || Main.hardMode)) || (n.lifeMax >= 15 && !Main.expertMode && !Main.hardMode)))
                {
                    npcCenter = new Vector2(n.position.X + n.width / 2, n.position.Y + n.height / 2);
                    if ((n.life <= 0 || !targeted || npcTarget != n.whoAmI) &&
                        Vector2.Distance(npcCenter - projectile.position, Vector2.Zero) < 384f)
                    {
                        oldNpcTarget         = npcTarget;
                        npcTarget            = n.whoAmI;
                        projectile.netUpdate = true;
                        targeted             = true;
                    }
                }
                else
                {
                    projectile.spriteDirection = player.direction * -1;
                    projectile.rotation        = 0;
                }
            }
            if (targeted)
            {
                NPC n = Main.npc[npcTarget];
                npcCenter = new Vector2(n.position.X + n.width / 2, n.position.Y + n.height / 2);
                npcAngle  = (float)Math.Atan2(npcCenter.Y - projectile.position.Y, npcCenter.X - projectile.position.X);
                //  projectile.rotation = npcAngle;
                if (projectile.Hitbox.Intersects(n.Hitbox))
                {
                    projectile.spriteDirection = n.spriteDirection;
                }
                if (Vector2.Distance(npcCenter - projectile.position, Vector2.Zero) < 384f)
                {
                    if (!projectile.Hitbox.Intersects(n.Hitbox))
                    {
                        if (!flag2)
                        {
                            projectile.position += Distance(null, npcAngle, 16f);
                            projectile.netUpdate = true;
                        }
                    }
                    else
                    {
                        /*  float radius = 32f;
                         *  degrees += radians * 9f;
                         *  projectile.position.X = n.Center.X + (float)(radius * Math.Cos(degrees));
                         *  projectile.position.Y = n.Center.Y + (float)(radius * Math.Sin(degrees));
                         */
                        flag2 = true;
                        projectile.position = n.position;
                        if (ticks % 120 == 0)
                        {
                            for (float k = 0; k < MathHelper.ToRadians(360); k += 0.017f * 9)
                            {
                                int Proj1 = Projectile.NewProjectile(projectile.position + new Vector2(projectile.width / 2, projectile.height / 2), Distance(null, k, 16f), mod.ProjectileType("dust_diffusion"), (int)(12 * player.minionDamage), 4f, projectile.owner, Distance(null, k, 16f).X, Distance(null, k, 16f).Y);
                                if (Main.netMode == 1)
                                {
                                    NetMessage.SendData(27, -1, -1, null, Proj1);
                                }
                            }
                            int Proj2 = Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType <magno_minionexplosion>(), 0, 0f, projectile.owner, 0f, 0f);
                            Main.projectile[Proj2].position = projectile.position - new Vector2(15, 15);
                            //custom sound
                            //Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IceBeamChargeShot"), projectile.position);
                            //vanilla sound
                            Main.PlaySound(2, projectile.position, 14);
                            projectile.netUpdate = true;
                        }
                    }
                    target = true;
                }
                else
                {
                    target = false;
                }
                if (!n.active || oldNpcTarget != n.whoAmI)
                {
                    flag2    = false;
                    target   = false;
                    targeted = false;
                }
            }
        }
Exemple #12
0
        public static void MainOptions(Player player)
        {
            if (reset)
            {
                Initialize();
                apply.color = Color.Gray;
                reset       = false;
            }
            if (classOptions != null && (oldWidth != Main.screenWidth || oldHeight != Main.screenHeight))
            {
                oldWidth  = Main.screenWidth;
                oldHeight = Main.screenHeight;
                UpdateLocation();
            }
            mod       = ModLoader.GetMod("ArchaeaMod");
            modPlayer = player.GetModPlayer <ArchaeaPlayer>(mod);
            var modWorld = mod.GetModWorld <ArchaeaWorld>();

            if (classSelect)
            {
                ClassSelect(player);
            }
            else
            {
                for (int i = 0; i < categories.Length; i++)
                {
                    sb.Draw(mod.GetTexture("Gores/config_icons"), mainOptions[i].bounds, new Rectangle(44 * i, 0, 44, 44), mainOptions[i].color);
                    if (mainOptions[i].HoverOver())
                    {
                        if (i == 0 && mainOptions[i].LeftClick())
                        {
                            classSelect = true;
                        }
                        sb.DrawString(Main.fontMouseText, categories[i], new Vector2(mainOptions[i].bounds.X, mainOptions[i].bounds.Bottom), Color.White);
                    }
                }
                //currently without designation
                foreach (Element opt in mainOptions)
                {
                    if (opt.LeftClick())
                    {
                        opt.active = !opt.active;
                        opt.color  = opt.active ? Color.Blue : Color.White;
                    }
                }
                //first player joined code

                /*
                 * {
                 *  mainOptions[1].active = ModeToggle.archaeaMode;
                 *  mainOptions[2].active = modWorld.cordonBounds;
                 *  mainOptions[1].color = mainOptions[1].active ? Color.Blue : Color.White;
                 *  mainOptions[2].color = mainOptions[2].active ? Color.Blue : Color.White;
                 * }
                 */
                sb.Draw(mod.GetTexture("Gores/config_icons"), apply.bounds, new Rectangle(44 * 4, 0, 44, 44), apply.color = selected != null ? Color.White : Color.Gray);
                if (apply.HoverOver())
                {
                    sb.DrawString(Main.fontMouseText, "Apply", new Vector2(apply.bounds.X, apply.bounds.Bottom), Color.White);
                }
                if (apply.LeftClick() && apply.color != Color.Gray)
                {
                    modPlayer.classChoice = choice + 1;
                    if (Main.netMode != 0)
                    {
                        NetHandler.Send(Packet.SyncClass, 256, -1, player.whoAmI, choice + 1, player.GetModPlayer <ArchaeaPlayer>().playerUID);
                    }
                    if (player == ArchaeaWorld.firstPlayer)
                    {
                        modWorld.cordonBounds  = mainOptions[1].active;
                        ModeToggle.archaeaMode = mainOptions[2].active;
                    }
                }
            }
        }
Exemple #13
0
 public bool LeftClick()
 {
     return(box.Contains(Main.MouseScreen.ToPoint()) && ArchaeaPlayer.LeftClick());
 }
Exemple #14
0
 public bool LeftClick()
 {
     return(HoverOver() && ArchaeaPlayer.LeftClick());
 }