void Start()
    {

            instance = this;        
            SoundEngine.instance.music.enabled = isSoundMusic;
            SoundEngine.instance.audioSource.enabled = isSoundSFX;
    }
 public static SoundEngine getInstance()
 {
     if(instance == null)
     {
         instance = new SoundEngine();
     }
     return instance;
 }
 void Start()
 {
     if (instance != null)
     {
         Debug.Log("Destroy This");
         Destroy(this);
     }
     else
     {
         DontDestroyOnLoad(this);
         instance = this;
     }
     //this.gameObject.
     //SoundEngine.instance.PlayLoop(SoundEngine.instance._soundBG1);
 }
 void Start()
 {
     /*
     if (instance != null)
     {
         Debug.Log("Destroy This");
         Destroy(this);
     }
     else
     {
         DontDestroyOnLoad(this);
         instance = this;
     }
     //this.gameObject.
     SoundEngine.getInstance().PlayLoop(SoundEngine.getInstance()._soundBG1);
      * */
     instance = this;
 }
Пример #5
0
    void Start()
    {

        instance = this;
    }
Пример #6
0
 public void HelpButtonPress()
 {
     SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundclick);
     //Application.LoadLevel("GamePlayScence");
     Application.LoadLevel("Help");
 }
Пример #7
0
 public void ReplayButtonPress()
 {
     SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundclick);
     GamePlay.instance.restart();
 }
Пример #8
0
		private static void OpenModsFolder(UIMouseEvent evt, UIElement listeningElement) {
			SoundEngine.PlaySound(10, -1, -1, 1);
			Directory.CreateDirectory(ModLoader.ModPath);
			Utils.OpenFolder(ModLoader.ModPath);
		}
Пример #9
0
        public override bool CanUseItem(Player player)
        {
            SoraPlayer sp = player.GetModPlayer <SoraPlayer>();

            maxShell = (player.HasItem(ModContent.ItemType <Items.lostDog>()) || sp.hasZafi) ? 6 : 5;
            if (player.altFunctionUse == 2)
            {
                if (lastUsedTime > 5)
                {
                    SoundEngine.PlaySound(SoundID.Grab, player.Center);
                    shellType = (shellType >= maxShell) ? 0 : shellType + 1;
                }
                lastUsedTime = 0;
                return(false);
            }
            else
            {
                switch (shellType)
                {
                case 0:
                    Item.shoot        = ProjectileID.Leaf;
                    Item.damage       = 255;
                    Item.shootSpeed   = 15;
                    Item.mana         = 1;
                    Item.useAnimation = Item.useTime = 3;
                    Item.autoReuse    = true;
                    break;

                case 1:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.Persona_projectile>();
                    Item.shootSpeed   = 7;
                    Item.damage       = 1000;
                    Item.autoReuse    = false;
                    Item.mana         = 15;
                    Item.useAnimation = Item.useTime = 7;
                    Item.autoReuse    = true;
                    break;

                case 2:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.Vergil_projectile>();
                    Item.shootSpeed   = 10;
                    Item.damage       = 266;
                    Item.autoReuse    = false;
                    Item.mana         = 10;
                    Item.useAnimation = Item.useTime = 25;
                    Item.autoReuse    = true;
                    break;

                case 3:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.Wunderwaffe_projectile>();
                    Item.shootSpeed   = 10;
                    Item.damage       = 400;
                    Item.autoReuse    = false;
                    Item.mana         = 30;
                    Item.useAnimation = Item.useTime = 75;
                    Item.autoReuse    = false;
                    if (isProjectile(Item.shoot))
                    {
                        return(false);
                    }
                    break;

                case 4:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.Escuregot_projectile>();
                    Item.damage       = 0;
                    Item.shootSpeed   = 10;
                    Item.mana         = 25;
                    Item.useAnimation = Item.useTime = 15;
                    Item.autoReuse    = false;
                    if (isProjectile(Item.shoot))
                    {
                        return(false);
                    }
                    break;

                case 5:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.halo_projectile>();
                    Item.damage       = 500;
                    Item.shootSpeed   = 10;
                    Item.mana         = 25;
                    Item.useAnimation = Item.useTime = 15;
                    Item.autoReuse    = false;
                    if (isProjectile(Item.shoot))
                    {
                        return(false);
                    }
                    break;

                case 6:
                    Item.shoot        = ModContent.ProjectileType <Projectiles.ScepTend.zafiProtector>();
                    Item.damage       = 500;
                    Item.shootSpeed   = 10;
                    Item.mana         = 0;
                    Item.useAnimation = Item.useTime = 15;
                    Item.autoReuse    = false;
                    if (isProjectile(Item.shoot))
                    {
                        return(false);
                    }
                    break;
                }
            }
            lastUsedTime = 0;
            return(true);
        }
Пример #10
0
        private static void FadedMouseOver(UIMouseEvent evt, UIElement listeningElement)
        {
            SoundEngine.PlaySound(12, -1, -1, 1);

            ((UIPanel)evt.Target).BackgroundColor = new Color(73, 94, 171);
        }
Пример #11
0
        private static void BackClick(UIMouseEvent evt, UIElement listeningElement)
        {
            SoundEngine.PlaySound(11, -1, -1, 1);

            Main.menuMode = 0;
        }
Пример #12
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);

            float swapFloat = 0.85f;

            Utils.Swap <float>(ref swapFloat, ref Main.inventoryScale);

            Vector2 newPos = GetDimensions().Position();

            Color newColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor);

            //DrawSlot(texture, spriteBatch, newPos, Main.inventoryBack, Main.inventoryScale);

            Utils.Swap <float>(ref swapFloat, ref Main.inventoryScale);

            Item   item   = (type > 0 ? NixieTubeUI.entity.Chip : NixieTubeUI.entity.Lightbulb);
            Player player = Main.LocalPlayer;

            if (ItemSlot.ShiftInUse && Main.mouseItem.type <= ItemID.None)
            {
                for (int x = 0; x < 10; x++)
                {
                    for (int y2 = 0; y2 < 5; y2++)
                    {
                        Main.inventoryScale = 0.85f;
                        int x2   = (int)(20.0 + x * 56 * (double)Main.inventoryScale);
                        int y    = (int)(20.0 + y2 * 56 * (double)Main.inventoryScale);
                        int slot = x + y2 * 10;
                        if (Main.mouseX >= x2 && Main.mouseX <= x2 + (double)Main.inventoryBackTexture.Width * Main.inventoryScale && (Main.mouseY >= y && Main.mouseY <= y + (double)Main.inventoryBackTexture.Height * Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface)
                        {
                            if (Main.mouseLeftRelease && Main.mouseLeft)
                            {
                                Main.LocalPlayer.mouseInterface = true;
                                Item slotItem = player.inventory[slot];
                                if (slotItem.stack > 0 && item.stack == 0 && (type > 0 ? slotItem.modItem is LightingChip : slotItem.modItem is Lightbulb2))
                                {
                                    SoundEngine.PlaySound(7, -1, -1, 1, 1.0f, 0.0f);
                                    if (item.type == ItemID.None)
                                    {
                                        item.SetDefaults(slotItem.type);
                                        item.stack = 0;
                                    }
                                    item.stack++;
                                    if (--slotItem.stack <= 0)
                                    {
                                        slotItem.SetDefaults(0, false);
                                        break;
                                    }
                                    if (type > 0)
                                    {
                                        NixieTubeUI.entity.Chip = item;
                                    }
                                    else
                                    {
                                        NixieTubeUI.entity.Lightbulb = item;
                                    }
                                    if (Main.netMode == 1)
                                    {
                                        NixieTubeUI.entity.SendClientMessage();
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
                if (Utils.CenteredRectangle(newPos, texture.Size() * Main.inventoryScale).Contains(new Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface)
                {
                    Main.LocalPlayer.mouseInterface = true;
                    if (Main.mouseLeftRelease &&
                        Main.mouseLeft)
                    {
                        if (ItemSlot.ShiftInUse)
                        {
                            if (!IsEmpty(item) && IsEmpty(Main.mouseItem))
                            {
                                DropItem(item);
                                if (type > 0)
                                {
                                    NixieTubeUI.entity.Chip = new Item();
                                }
                                else
                                {
                                    NixieTubeUI.entity.Lightbulb = new Item();
                                }
                                if (Main.netMode == 1)
                                {
                                    NixieTubeUI.entity.SendClientMessage();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MouseActions(newPos, ref Main.mouseItem, ref item, ref swapFloat);
                if (type > 0)
                {
                    NixieTubeUI.entity.Chip = item;
                }
                else
                {
                    NixieTubeUI.entity.Lightbulb = item;
                }
                if (Main.netMode == 1)
                {
                    NixieTubeUI.entity.SendClientMessage();
                }
            }
            Mod       mod      = ModLoader.GetMod("Antiaris");
            Texture2D texture2 = mod.GetTexture("UIs/Slot");

            if (type > 0)
            {
                texture2 = mod.GetTexture("UIs/Chip");
            }
            Vector2 drawPos = newPos - texture.Size() * swapFloat / 2.0f + new Vector2(texture2.Width, texture2.Height) * swapFloat / 2.0f;

            if ((type > 0 ? NixieTubeUI.entity.Chip : NixieTubeUI.entity.Lightbulb) == null || (type > 0 ? NixieTubeUI.entity.Chip : NixieTubeUI.entity.Lightbulb).type <= 0 || (type > 0 ? NixieTubeUI.entity.Chip : NixieTubeUI.entity.Lightbulb).stack <= 0)
            {
                spriteBatch.Draw(texture2, drawPos + (type > 0 ? new Vector2(2, 3) : new Vector2(5, -5)), null, Color.White * 0.35f, 0.0f, new Vector2(), swapFloat, SpriteEffects.None, 0.0f);
            }
            else
            {
                DrawItem(spriteBatch, ref item, newPos, color, ref swapFloat);
            }
        }
Пример #13
0
 protected bool MouseActions(Vector2 position, ref Item item1, ref Item item2, ref float inventoryScale, bool delete = false, bool mouseItemActions = false)
 {
     if (Utils.CenteredRectangle(position, texture.Size() * inventoryScale).Contains(new Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface)
     {
         Main.LocalPlayer.mouseInterface = true;
         if (Main.mouseLeftRelease &&
             Main.mouseLeft)
         {
             if (ItemSlot.ShiftInUse)
             {
             }
             else
             {
                 if (!mouseItemActions)
                 {
                     if ((!IsEmpty(item2) && IsEmpty(item1) || !IsEmpty(item1) && AllowItem(item1)))
                     {
                         if (delete)
                         {
                             if (type > 0)
                             {
                                 NixieTubeUI.entity.Chip = new Item();
                             }
                             else
                             {
                                 NixieTubeUI.entity.Lightbulb = new Item();
                             }
                         }
                         if (item1.IsTheSameAs(item2) || item2.IsTheSameAs(item1))
                         {
                             if (item1.stack + item2.stack <= item1.maxStack)
                             {
                                 item2.stack += item1.stack;
                                 item1.stack  = 0;
                             }
                             else
                             {
                                 if (item2.stack >= item2.maxStack)
                                 {
                                     Utils.Swap <Item>(ref item1, ref item2);
                                 }
                                 else
                                 {
                                     int stack = item1.maxStack - item2.stack;
                                     item2.stack += stack;
                                     item1.stack -= stack;
                                 }
                             }
                             SoundEngine.PlaySound(7, -1, -1, 1, 1.0f, 0.0f);
                             return(true);
                         }
                         else
                         {
                             Utils.Swap <Item>(ref item2, ref item1);
                             SoundEngine.PlaySound(7, -1, -1, 1, 1.0f, 0.0f);
                             return(true);
                         }
                     }
                 }
             }
             return(true);
         }
         if (!Main.mouseRightRelease ||
             !Main.mouseRight)
         {
             if (!mouseItemActions)
             {
                 if ((!IsEmpty(item2) && IsEmpty(item1) || !IsEmpty(item1) && AllowItem(item1)))
                 {
                     if (item1.IsTheSameAs(item2) || item1.type == 0)
                     {
                         if (item1.stack < item1.maxStack || item1.type == 0 && item2.stack > 0)
                         {
                             if (Main.stackSplit <= 1 && Main.mouseRight)
                             {
                                 SoundEngine.PlaySound(7, -1, -1, 1, 1.0f, 0.0f);
                                 if (item1.type == 0)
                                 {
                                     item1.SetDefaults(item2.type);
                                     item1.stack = 0;
                                 }
                                 ++item1.stack;
                                 if (--item2.stack <= 0)
                                 {
                                     item2.SetDefaults(0, false);
                                 }
                                 Main.stackSplit = Main.stackSplit != 0 ? Main.stackDelay : 15;
                             }
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
Пример #14
0
        public override void AI()
        {
            Player  player = Main.player[npc.target];
            Vector2 target = npc.HasPlayerTarget ? player.Center : Main.npc[npc.target].Center;

            npc.netAlways = true;
            npc.rotation  = 0.0f;
            npc.TargetClosest(true);
            if (npc.life >= npc.lifeMax)
            {
                npc.life = npc.lifeMax;
            }
            if (npc.target < 0 || npc.target == 255 || player.dead || !player.active)
            {
                npc.TargetClosest(false);
                npc.direction  = 1;
                npc.velocity.Y = npc.velocity.Y - 0.1f;
                if (npc.timeLeft > 10)
                {
                    npc.timeLeft = 10;
                    return;
                }
            }
            if (this.stunned)
            {
                npc.velocity.Y = 0.0f;
                npc.velocity.X = 0.0f;
                ++this.stunnedTimer;
                if (this.stunnedTimer >= 105)
                {
                    this.stunned      = false;
                    this.stunnedTimer = 0;
                }
            }
            if (!this.secondState)
            {
                float distance = 250.0f;
                float k        = 1.26f;
                for (int count = 0; count < 10; count++)
                {
                    Vector2 spawn = npc.Center + distance * (count * k).ToRotationVector2();
                    NPC.NewNPC((int)spawn.X, (int)spawn.Y, ModContent.NPCType <ProtectiveStone2>(), 0, npc.whoAmI, 0.0f, count, 0.0f, 255);
                }
                this.secondState = true;
            }
            ++this.ai;
            npc.ai[0] = ai * 1f;
            int  velocity = (int)((double)npc.ai[0] / 50f);
            bool speedB   = (npc.life <= npc.lifeMax * 0.6 ? true : false);
            int  speedV   = (int)(speedB ? 6f : 0f);

            if (npc.ai[0] < 350.0 && !this.stunned)
            {
                this.frame = 0;
                AntiarisHelper.MoveTowards(npc, target, (int)(Vector2.Distance(target, npc.Center) > 300 ? (Main.expertMode ? 24f : 20f) : (Main.expertMode ? 9f : 7f)) + speedV, 30f);
                for (int k = 0; k < 5 * (npc.ai[0] / 50); k++)
                {
                    float scale = 0.4f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 0.65f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 62, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                npc.netUpdate = true;
                if (npc.ai[0] % 349.0 == 0)
                {
                    this.buffTime += 1;
                    //CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.Purple, "+1", false, false);
                }
            }
            else if (npc.ai[0] >= 350.0 && npc.ai[0] < 450.0)
            {
                this.stunned = true;
                this.frame   = 2;
                AntiarisHelper.MoveTowards(npc, target, (int)(Vector2.Distance(target, npc.Center) > 300 ? (Main.expertMode ? 24f : 20f) : (Main.expertMode ? 9f : 7f)) + speedV, 30f);
                for (int k = 0; k < 2 * (npc.ai[0] / 45); k++)
                {
                    float scale = 0.65f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 0.81f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 62, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                player.AddBuff(ModContent.BuffType <Injured>(), Main.expertMode ? 560 : 420, true);
                npc.netUpdate = true;
            }
            if (npc.ai[0] > 450.0)
            {
                this.frame   = 1;
                this.stunned = false;
                npc.defense  = 40;
                if (!this.fastSpeed)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        this.fastSpeed = true;
                        npc.ai[2]      = 0f;
                    }
                    else
                    {
                        this.fastSpeed = true;
                        npc.ai[2]      = 1f;
                    }
                }
                else
                {
                    if (npc.ai[2] == 0.0)
                    {
                        if ((double)npc.ai[0] % 50 == 0)
                        {
                            float speed = 21f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 25f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                    else
                    {
                        npc.alpha = 180;
                        if ((double)npc.ai[0] % 35 == 0)
                        {
                            float speed = 28f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 30f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                }
                npc.netUpdate = true;
            }
            else
            {
                npc.defense = 22;
            }
            if (npc.ai[0] >= 650.0)
            {
                this.ai        = 0;
                npc.alpha      = 0;
                npc.ai[2]      = 0;
                this.fastSpeed = false;
            }
            if (npc.life <= npc.lifeMax * 0.333)
            {
                npc.alpha   = 0;
                this.ai     = 0;
                this.frame  = 0;
                npc.ai[1]  += 1 + (npc.life <= npc.lifeMax * 0.111 ? 1 : (npc.life <= npc.lifeMax * 0.222 ? 1 : 0));
                npc.defense = 25;
                if (npc.ai[1] < 200.0)
                {
                    this.frame     = 2;
                    npc.velocity.X = 0f;
                    npc.velocity.Y = 0f;
                }
                if (npc.ai[1] < 200.0)
                {
                    for (int k = 0; k < 3 * (npc.ai[1] / 50); k++)
                    {
                        float scale = 0.81f;
                        if (npc.ai[0] % 2 == 1)
                        {
                            scale = 1f;
                        }
                        int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 62, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                        Main.dust[index2].position  -= new Vector2(2f);
                        Main.dust[index2].noGravity  = true;
                        Main.dust[index2].scale      = scale;
                        Main.dust[index2].customData = npc;
                    }
                }
                if (npc.ai[1] % 200.0 == 0 && npc.ai[1] <= 399.0)
                {
                    this.attackTimer += 1;
                    if (this.attackTimer <= 2)
                    {
                        Vector2 shootPos   = npc.Center;
                        float   inaccuracy = 10f * (npc.life / npc.lifeMax);
                        Vector2 shootVel   = target - shootPos + new Vector2(Main.rand.NextFloat(-inaccuracy, inaccuracy), Main.rand.NextFloat(-inaccuracy, inaccuracy));
                        shootVel.Normalize();
                        shootVel *= 14f;
                        SoundEngine.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88);
                        for (int k = 0; k < (Main.expertMode ? 5 : 3); k++)
                        {
                            Projectile.NewProjectile(shootPos.X + -100 * npc.direction + Main.rand.Next(-40, 41), shootPos.Y - Main.rand.Next(-50, 40), shootVel.X, shootVel.Y, ModContent.ProjectileType <GolemCrystal2>(), npc.damage / 3, 5f);
                        }
                    }
                    else
                    {
                        if (Main.expertMode)
                        {
                            for (int i = 0; i < 7; i++)
                            {
                                Projectile.NewProjectile((int)((player.position.X - 50) + Main.rand.Next(100)), (int)((player.position.Y - 50) + Main.rand.Next(100)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeper2Sheet>(), npc.damage / 3, 4.5f);
                            }
                        }
                        for (int k = 0; k < (Main.expertMode ? 8 : 5); k++)
                        {
                            Vector2 shootPos = player.position + new Vector2(Main.rand.Next(-300, 300), -1000);
                            Vector2 shootVel = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(9f, 14f));
                            Projectile.NewProjectile(shootPos, shootVel, ModContent.ProjectileType <GolemCrystal2>(), npc.damage / 2, 4.5f);
                        }
                        SoundEngine.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88);
                        this.attackTimer = 0;
                    }
                }
                if (npc.ai[1] > 200.0)
                {
                    AntiarisHelper.MoveTowards(npc, player.Center, 8f + (npc.life <= npc.lifeMax * 0.111 ? 3 : (npc.life <= npc.lifeMax * 0.222 ? 2 : 0)), 8f + (npc.life <= npc.lifeMax * 0.111 ? 3 : (npc.life <= npc.lifeMax * 0.222 ? 2 : 0)));
                }
                if (npc.ai[1] >= 350f)
                {
                    npc.ai[1] = 0f;
                }
                npc.netUpdate = true;
            }
            if (npc.life <= npc.lifeMax * 0.135)
            {
                this.frame   = 1;
                this.stunned = false;
                if (!this.secondState2)
                {
                    float distance = 160f;
                    float k        = 1.26f;
                    for (int count = 0; count < 10; count++)
                    {
                        Vector2 spawn = npc.Center + distance * (count * k).ToRotationVector2();
                        NPC.NewNPC((int)spawn.X, (int)spawn.Y, ModContent.NPCType <ProtectiveStone2>(), 0, npc.whoAmI, 0.0f, count, 0.0f, 255);
                    }
                    this.secondState2 = true;
                }
                if (NPC.AnyNPCs(ModContent.NPCType <ProtectiveStone2>()))
                {
                    //if ((double)this.ai % 215.0 == 0.0)
                    this.stunned = true;
                    if (Main.rand.Next(5) == 0)
                    {
                        Projectile.NewProjectile((int)((npc.position.X - 500) + Main.rand.Next(1000)), (int)((npc.position.Y - 500) + Main.rand.Next(1000)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeper2Sheet>(), npc.damage / 3, 4.5f);
                    }
                    npc.dontTakeDamage = true;
                }
                else
                {
                    if (Main.expertMode)
                    {
                        this.stunned = false;
                        npc.alpha    = 255;
                        if ((double)npc.ai[0] % 120 == 0)
                        {
                            float speed = 24.0f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 26.0f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        Projectile.NewProjectile((int)((npc.position.X - 500) + Main.rand.Next(1000)), (int)((npc.position.Y - 500) + Main.rand.Next(1000)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeper2Sheet>(), npc.damage / 3, 4.5f);
                    }
                    npc.dontTakeDamage = false;
                }
            }
            if (this.buffTime >= 3)
            {
                ++this.buffTimeKey;
                if (this.buffTimeKey >= 120)
                {
                    player.AddBuff(BuffID.BrokenArmor, Main.expertMode ? 320 : 60, true);
                    player.AddBuff(BuffID.Slow, Main.expertMode ? 320 : 60, true);
                    Main.LocalPlayer.statMana = 0;
                    this.buffTime             = 0;
                    this.buffTimeKey          = 0;
                    npc.netUpdate             = true;
                }
            }
            if (this.checkDead)
            {
                npc.dontTakeDamage = true;
                this.ai            = 0;
                npc.ai[0]          = 0;
                npc.ai[1]          = 0;
                npc.velocity.X     = npc.velocity.Y = 0f;
                ++this.deadTimer;
                this.frame = 0;
                for (int k = 0; k < 5 * (this.deadTimer / 50); k++)
                {
                    npc.dontTakeDamage = true;
                    float scale = 0.81f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 1f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 62, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                if (this.deadTimer == 100)
                {
                    SoundEngine.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/NPCs/TowerKeeperDeath"), npc.position);
                }
                if (this.deadTimer >= 300)
                {
                    this.frame = 1;
                    if (this.deadTimer >= 400)
                    {
                        npc.life = 0;
                        npc.HitEffect(0, 1337);
                        npc.checkDead();
                        SoundEngine.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 43);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore1"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore2"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore3"), 1f);
                    }
                }
                if (this.deadTimer >= 0)
                {
                    Main.musicFade[Main.curMusic] = 1f / (float)(this.deadTimer / 15 * 0.5f);
                }
            }
        }
        public override void AI()
        {
            if (Projectile.localAI[1] == 0)
            {
                Projectile.localAI[1] = 1;

                SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
            }

            Projectile.frameCounter++;
            if (Projectile.frameCounter > 2)
            {
                Projectile.frameCounter = 0;
                Projectile.frame++;
                if (Projectile.frame > 3)
                {
                    Projectile.frame = 0;
                }
            }

            if (--Projectile.ai[0] == 0)
            {
                Projectile.velocity  = Vector2.Normalize(Projectile.velocity) * 0.1f;
                Projectile.netUpdate = true;
            }

            if (--Projectile.ai[1] == 0)
            {
                Projectile.Kill();
                return;
            }

            Lighting.AddLight(Projectile.Center, 1.1f, 0.9f, 0.4f);

            ++Projectile.localAI[0];
            if ((double)Projectile.localAI[0] == 12.0) //loads of vanilla dust :echprime:
            {
                Projectile.localAI[0] = 0.0f;
                for (int index1 = 0; index1 < 12; ++index1)
                {
                    Vector2 vector2 = (Vector2.UnitX * (float)-Projectile.width / 2f + -Vector2.UnitY.RotatedBy((double)index1 * 3.14159274101257 / 6.0, new Vector2()) * new Vector2(8f, 16f)).RotatedBy((double)Projectile.rotation - 1.57079637050629, new Vector2());
                    int     index2  = Dust.NewDust(Projectile.Center, 0, 0, 6, 0.0f, 0.0f, 160, new Color(), 1f);
                    Main.dust[index2].scale     = 1.1f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].position  = Projectile.Center + vector2;
                    Main.dust[index2].velocity  = Projectile.velocity * 0.1f;
                    Main.dust[index2].velocity  = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[index2].position) * 1.25f;
                }
            }
            if (Main.rand.NextBool(4))
            {
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double)Projectile.velocity.ToRotation(), new Vector2());
                    int     index2  = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 100, new Color(), 1f);
                    Main.dust[index2].velocity *= 0.1f;
                    Main.dust[index2].position  = Projectile.Center + vector2 * (float)Projectile.width / 2f;
                    Main.dust[index2].fadeIn    = 0.9f;
                }
            }
            if (Main.rand.NextBool(32))
            {
                for (int index1 = 0; index1 < 1; ++index1)
                {
                    Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double)Projectile.velocity.ToRotation(), new Vector2());
                    int     index2  = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f);
                    Main.dust[index2].velocity *= 0.3f;
                    Main.dust[index2].position  = Projectile.Center + vector2 * (float)Projectile.width / 2f;
                    if (Main.rand.NextBool())
                    {
                        Main.dust[index2].fadeIn = 1.4f;
                    }
                }
            }
            if (Main.rand.NextBool())
            {
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double)Projectile.velocity.ToRotation(), new Vector2());
                    int     index2  = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0.0f, 0.0f, 0, new Color(), 1.2f);
                    Main.dust[index2].velocity *= 0.3f;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].position  = Projectile.Center + vector2 * (float)Projectile.width / 2f;
                    if (Main.rand.NextBool())
                    {
                        Main.dust[index2].fadeIn = 1.4f;
                    }
                }
            }
        }
Пример #16
0
 public override void Kill(int timeLeft)
 {
     Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType(GetType().Name + "Explosion"), projectile.damage, projectile.knockBack, projectile.owner);
     SoundEngine.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10);
 }
Пример #17
0
 private void FadedMouseOver(UIMouseEvent evt, UIElement listeningElement)
 {
     SoundEngine.PlaySound(12);
     ((UIPanel)evt.Target).BackgroundColor = new Color(73, 94, 171);
     ((UIPanel)evt.Target).BorderColor     = Colors.FancyUIFatButtonMouseOver;
 }
Пример #18
0
        public override void AI()
        {
            Player target = Main.player[(int)Projectile.ai[0]];

            Projectile.localAI[0]++;
            switch ((int)Projectile.ai[1])
            {
            case 0:     //true eye movement code
                Vector2 newVel = target.Center - Projectile.Center + new Vector2(-200f * Projectile.localAI[1], -200f);
                if (newVel != Vector2.Zero)
                {
                    newVel.Normalize();
                    newVel *= 24f;
                    Projectile.velocity.X = (Projectile.velocity.X * 29 + newVel.X) / 30;
                    Projectile.velocity.Y = (Projectile.velocity.Y * 29 + newVel.Y) / 30;
                }
                if (Projectile.Distance(target.Center) < 150f)
                {
                    if (Projectile.Center.X < target.Center.X)
                    {
                        Projectile.velocity.X -= 0.25f;
                    }
                    else
                    {
                        Projectile.velocity.X += 0.25f;
                    }

                    if (Projectile.Center.Y < target.Center.Y)
                    {
                        Projectile.velocity.Y -= 0.25f;
                    }
                    else
                    {
                        Projectile.velocity.Y += 0.25f;
                    }
                }

                if (Projectile.localAI[0] > 60f)
                {
                    Projectile.localAI[0] = 0f;
                    Projectile.ai[1]++;
                    Projectile.netUpdate = true;
                }
                break;

            case 1:                                    //slow down
                Projectile.velocity *= 0.9f;
                if (Projectile.velocity.Length() < 1f) //stop, FIRE LASER
                {
                    Projectile.velocity   = Vector2.Zero;
                    Projectile.localAI[0] = 0f;
                    Projectile.ai[1]++;
                    Projectile.netUpdate = true;
                }
                break;

            case 2:     //shoot
                if (Projectile.localAI[0] == 7f)
                {
                    SoundEngine.PlaySound(SoundID.NPCDeath6, Projectile.Center);
                    ShootBolts(target);
                }
                else if (Projectile.localAI[0] == 14f)
                {
                    ShootBolts(target);
                }
                else if (Projectile.localAI[0] > 21f)
                {
                    Projectile.localAI[0] = 0f;
                    Projectile.ai[1]++;
                }
                break;

            default:
                for (int i = 0; i < 30; i++)
                {
                    int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 135, 0f, 0f, 0, default(Color), 3f);
                    Main.dust[d].noGravity = true;
                    Main.dust[d].noLight   = true;
                    Main.dust[d].velocity *= 8f;
                }
                SoundEngine.PlaySound(new SoundStyle("Terraria/Sounds/Zombie_102"), Projectile.Center);
                Projectile.Kill();
                break;
            }

            if (Projectile.rotation > 3.14159274101257)
            {
                Projectile.rotation = Projectile.rotation - 6.283185f;
            }
            Projectile.rotation = Projectile.rotation <= -0.005 || Projectile.rotation >= 0.005 ? Projectile.rotation * 0.96f : 0.0f;
            if (++Projectile.frameCounter >= 4)
            {
                Projectile.frameCounter = 0;
                if (++Projectile.frame >= Main.projFrames[Projectile.type])
                {
                    Projectile.frame = 0;
                }
            }
            if (Projectile.ai[1] != 2f) //custom pupil when attacking
            {
                UpdatePupil();
            }
        }
Пример #19
0
        public override void AI()
        {
            if (NPC.localAI[3] == 0) //spawn friends
            {
                NPC.TargetClosest(false);
                NPC.localAI[3] = 1;

                /*if (NPC.Distance(Main.player[NPC.target].Center) < 1500)
                 * {
                 *  NPC.localAI[3] = 1;
                 * }
                 * else
                 * {
                 *  Movement(Main.player[NPC.target].Center, 0.8f, 32f);
                 *  return;
                 * }*/

                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, -3f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[0] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                    n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, -2f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[1] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                    n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, -1f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[2] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                    n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, 1f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[3] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                    n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, 2f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[4] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                    n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <NatureChampionHead>(), NPC.whoAmI, 0f, NPC.whoAmI, 0f, 3f, NPC.target);
                    if (n != Main.maxNPCs)
                    {
                        heads[5] = n;
                        Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f);
                        Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }

                    for (int i = 0; i < heads.Length; i++) //failsafe, die if couldnt spawn heads
                    {
                        if (heads[i] == -1 && Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            NPC.active = false;
                            return;
                        }
                    }
                }
            }

            EModeGlobalNPC.championBoss = NPC.whoAmI;

            Player  player = Main.player[NPC.target];
            Vector2 targetPos;

            if (NPC.HasValidTarget && NPC.Distance(player.Center) < 3000 && player.Center.Y >= Main.worldSurface * 16 && !player.ZoneUnderworldHeight)
            {
                NPC.timeLeft = 600;
            }

            if (player.Center.X < NPC.position.X)
            {
                NPC.direction = NPC.spriteDirection = -1;
            }
            else if (player.Center.X > NPC.position.X + NPC.width)
            {
                NPC.direction = NPC.spriteDirection = 1;
            }

            switch ((int)NPC.ai[0])
            {
            case -1:     //mourning wood movement
            {
                NPC.noTileCollide = true;
                NPC.noGravity     = true;

                if (NPC.position.X < player.Center.X && player.Center.X < NPC.position.X + NPC.width)
                {
                    NPC.velocity.X *= 0.92f;
                    if (Math.Abs(NPC.velocity.X) < 0.1f)
                    {
                        NPC.velocity.X = 0f;
                    }
                }
                else
                {
                    float accel = 2f;

                    /*if (Math.Abs(player.Center.X - NPC.Center.X) > 1200) //secretly fast run
                     * {
                     *  accel = 24f;
                     * }
                     * else
                     * {
                     *  if (Math.Abs(NPC.velocity.X) > 2)
                     *      NPC.velocity.X *= 0.97f;
                     * }*/
                    if (player.Center.X > NPC.Center.X)
                    {
                        NPC.velocity.X = (NPC.velocity.X * 20 + accel) / 21;
                    }
                    else
                    {
                        NPC.velocity.X = (NPC.velocity.X * 20 - accel) / 21;
                    }
                }

                bool onPlatforms = false;
                for (int i = (int)NPC.position.X; i <= NPC.position.X + NPC.width; i += 16)
                {
                    if (Framing.GetTileSafely(new Vector2(i, NPC.position.Y + NPC.height + NPC.velocity.Y + 1)).TileType == TileID.Platforms)
                    {
                        onPlatforms = true;
                        break;
                    }
                }

                bool onCollision = Collision.SolidCollision(NPC.position, NPC.width, NPC.height);

                if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width &&
                    NPC.position.Y + NPC.height < player.position.Y + player.height - 16)
                {
                    NPC.velocity.Y += 0.5f;
                }
                else if (onCollision || (onPlatforms && player.position.Y + player.height <= NPC.position.Y + NPC.height))
                {
                    if (NPC.velocity.Y > 0f)
                    {
                        NPC.velocity.Y = 0f;
                    }

                    if (onCollision)
                    {
                        if (NPC.velocity.Y > -0.2f)
                        {
                            NPC.velocity.Y -= 0.025f;
                        }
                        else
                        {
                            NPC.velocity.Y -= 0.2f;
                        }

                        if (NPC.velocity.Y < -4f)
                        {
                            NPC.velocity.Y = -4f;
                        }
                    }
                }
                else
                {
                    if (NPC.velocity.Y < 0f)
                    {
                        NPC.velocity.Y = 0f;
                    }

                    if (NPC.velocity.Y < 0.1f)
                    {
                        NPC.velocity.Y += 0.025f;
                    }
                    else
                    {
                        NPC.velocity.Y += 0.5f;
                    }
                }

                if (NPC.velocity.Y > 10f)
                {
                    NPC.velocity.Y = 10f;
                }
            }
            break;

            case 0:     //think
                NPC.noTileCollide = false;
                NPC.noGravity     = false;

                if (++NPC.ai[1] > 45)
                {
                    NPC.TargetClosest();
                    NPC.ai[0]++;
                    NPC.ai[1]     = 0;
                    NPC.ai[2]     = 0;
                    NPC.ai[3]     = 0;
                    NPC.netUpdate = true;
                }
                goto case -1;

            case 1:     //stomp
            {
                void StompDust()
                {
                    SoundEngine.PlaySound(SoundID.Item14, NPC.Center);

                    for (int k = -2; k <= 2; k++)         //explosions
                    {
                        Vector2 dustPos = NPC.Center;
                        int     width   = NPC.width / 5;
                        dustPos.X += width * k + Main.rand.NextFloat(-width, width);
                        dustPos.Y += Main.rand.NextFloat(NPC.height / 2);

                        for (int i = 0; i < 30; i++)
                        {
                            int dust = Dust.NewDust(dustPos, 32, 32, 31, 0f, 0f, 100, default(Color), 3f);
                            Main.dust[dust].velocity *= 1.4f;
                        }

                        for (int i = 0; i < 20; i++)
                        {
                            int dust = Dust.NewDust(dustPos, 32, 32, 6, 0f, 0f, 100, default(Color), 3.5f);
                            Main.dust[dust].noGravity = true;
                            Main.dust[dust].velocity *= 7f;
                            dust = Dust.NewDust(dustPos, 32, 32, 6, 0f, 0f, 100, default(Color), 1.5f);
                            Main.dust[dust].velocity *= 3f;
                        }

                        float scaleFactor9 = 0.5f;
                        for (int j = 0; j < 4; j++)
                        {
                            int gore = Gore.NewGore(NPC.GetSource_FromThis(), dustPos, default(Vector2), Main.rand.Next(61, 64));
                            Main.gore[gore].velocity   *= scaleFactor9;
                            Main.gore[gore].velocity.X += 1f;
                            Main.gore[gore].velocity.Y += 1f;
                        }
                    }
                }

                int jumpTime = 60;
                if (NPC.ai[3] == 1)
                {
                    jumpTime = 30;
                }

                NPC.noGravity     = true;
                NPC.noTileCollide = true;

                if (NPC.ai[2] == 0)         //move over player
                {
                    StompDust();

                    NPC.ai[2]     = 1;
                    NPC.netUpdate = true;

                    targetPos    = player.Center;
                    targetPos.Y -= NPC.ai[3] == 1 ? 300 : 600;

                    NPC.velocity = (targetPos - NPC.Center) / jumpTime;
                }

                if (++NPC.ai[1] > jumpTime + (NPC.ai[3] == 1 ? 1 : 18))         //do the stomp
                {
                    NPC.noGravity     = false;
                    NPC.noTileCollide = false;

                    if (NPC.velocity.Y == 0 || NPC.ai[3] == 1)         //landed, now stomp
                    {
                        StompDust();

                        if (NPC.ai[3] == 1)                                           //enraged
                        {
                            for (int i = Main.rand.Next(2); i < heads.Length; i += 2) //activate alternating heads for deathray
                            {
                                if (Main.npc[heads[i]].ai[0] != 0)                    //don't act on a head currently doing something
                                {
                                    continue;
                                }

                                Main.npc[heads[i]].ai[0]      = 4f;
                                Main.npc[heads[i]].localAI[0] = 0;
                                Main.npc[heads[i]].ai[2]      = 0;
                                Main.npc[heads[i]].localAI[1] = 0;
                                Main.npc[heads[i]].netUpdate  = true;

                                int glowType;
                                switch ((int)Main.npc[heads[i]].ai[3])
                                {
                                case -3: glowType = -7; break;

                                case -2: glowType = -8; break;

                                case -1: glowType = -9; break;

                                case 1: glowType = -10; break;

                                case 2: glowType = -11; break;

                                case 3: glowType = -12; break;

                                default: glowType = 0; break;
                                }

                                if (Main.netMode != NetmodeID.MultiplayerClient)
                                {
                                    Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, heads[i], glowType);
                                }
                            }
                        }

                        NPC.TargetClosest();
                        NPC.ai[0]++;
                        NPC.ai[1]     = NPC.ai[3] == 1 ? 40 : 0;
                        NPC.ai[2]     = 0;
                        NPC.ai[3]     = 0;
                        NPC.netUpdate = true;
                    }
                }
                else if (NPC.ai[1] > jumpTime)         //falling
                {
                    if (NPC.velocity.X > 2)
                    {
                        NPC.velocity.X = 2;
                    }
                    if (NPC.velocity.X < -2)
                    {
                        NPC.velocity.X = -2;
                    }
                    NPC.velocity.Y = 30f;
                }
            }
            break;

            case 2:
                if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 3000f ||
                    player.Center.Y < Main.worldSurface * 16 || player.ZoneUnderworldHeight)        //despawn code
                {
                    NPC.TargetClosest(false);
                    if (NPC.timeLeft > 30)
                    {
                        NPC.timeLeft = 30;
                    }

                    NPC.noTileCollide = true;
                    NPC.noGravity     = true;
                    NPC.velocity.Y   += 1f;

                    break;
                }
                goto case 0;

            case 3:     //decide an attack
                if (NPC.ai[2] == 0)
                {
                    void ActivateHead(int targetHead)
                    {
                        if (Main.npc[targetHead].ai[0] != 0)     //don't act on a head currently doing something
                        {
                            return;
                        }

                        Main.npc[targetHead].ai[0]     += Main.npc[targetHead].ai[3];
                        Main.npc[targetHead].localAI[0] = 0;
                        Main.npc[targetHead].ai[2]      = 0;
                        Main.npc[targetHead].localAI[1] = 0;
                        Main.npc[targetHead].netUpdate  = true;

                        SoundEngine.PlaySound(SoundID.ForceRoarPitched, Main.npc[targetHead].Center);

                        int glowType;

                        switch ((int)Main.npc[targetHead].ai[3])
                        {
                        case -3: glowType = -7; break;

                        case -2: glowType = -8; break;

                        case -1: glowType = -9; break;

                        case 1: glowType = -10; break;

                        case 2: glowType = -11; break;

                        case 3: glowType = -12; break;

                        default: glowType = 0; break;
                        }

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, targetHead, glowType);
                        }
                    };

                    NPC.ai[2]     = 1;
                    NPC.netUpdate = true;

                    int set = Main.rand.Next(configurations.Length);
                    while (heads[configurations[set].Key] == heads[configurations[lastSet].Key] ||  //don't reuse heads you just attacked with
                           heads[configurations[set].Key] == heads[configurations[lastSet].Value] ||
                           heads[configurations[set].Value] == heads[configurations[lastSet].Key] ||
                           heads[configurations[set].Value] == heads[configurations[lastSet].Value])
                    {
                        set = Main.rand.Next(configurations.Length);
                    }
                    lastSet = set;

                    if (Main.expertMode)     //activate both in expert
                    {
                        ActivateHead(heads[configurations[set].Key]);
                        ActivateHead(heads[configurations[set].Value]);
                    }
                    else     //only activate one in normal
                    {
                        if (Main.rand.NextBool())
                        {
                            ActivateHead(heads[configurations[set].Key]);
                        }
                        else
                        {
                            ActivateHead(heads[configurations[set].Value]);
                        }
                    }
                }

                if (++NPC.ai[1] > 300)     //wait
                {
                    NPC.TargetClosest();
                    NPC.ai[0]++;
                    NPC.ai[1]     = 0;
                    NPC.ai[2]     = 0;
                    NPC.ai[3]     = 0;
                    NPC.netUpdate = true;
                }
                goto case -1;

            case 4:
                goto case 2;

            case 5:
                goto case 3;

            case 6:
                goto case 2;

            case 7:
                goto case 3;

            case 8:
                goto case 2;

            case 9:
                goto case 1;

            case 10:
                goto case 2;

            case 11:     //deathrays
                if (NPC.ai[2] == 0 && FargoSoulsWorld.EternityMode)
                {
                    NPC.ai[2] = 1;

                    SoundEngine.PlaySound(SoundID.Roar, NPC.Center);

                    for (int i = 0; i < heads.Length; i++)     //activate all heads
                    {
                        Main.npc[heads[i]].ai[0]      = 4f;
                        Main.npc[heads[i]].localAI[0] = 0;
                        Main.npc[heads[i]].ai[2]      = 0;
                        Main.npc[heads[i]].localAI[1] = 0;
                        Main.npc[heads[i]].netUpdate  = true;

                        int glowType;
                        switch ((int)Main.npc[heads[i]].ai[3])
                        {
                        case -3: glowType = -7; break;

                        case -2: glowType = -8; break;

                        case -1: glowType = -9; break;

                        case 1: glowType = -10; break;

                        case 2: glowType = -11; break;

                        case 3: glowType = -12; break;

                        default: glowType = 0; break;
                        }

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, heads[i], glowType);
                        }
                    }
                }

                if (++NPC.ai[1] > 330 || !FargoSoulsWorld.EternityMode)     //wait
                {
                    NPC.TargetClosest();
                    NPC.ai[0]++;
                    NPC.ai[1]     = 0;
                    NPC.ai[2]     = 0;
                    NPC.ai[3]     = 0;
                    NPC.netUpdate = true;
                }
                goto case -1;

            default:
                NPC.ai[0] = 0;
                goto case 0;
            }

            if (FargoSoulsWorld.EternityMode)
            {
                if (NPC.HasValidTarget && NPC.Distance(player.Center) > 1400 && Vector2.Distance(NPC.Center, player.Center) < 3000f &&
                    player.Center.Y > Main.worldSurface * 16 && !player.ZoneUnderworldHeight && NPC.ai[0] > 1) // && NPC.ai[0] != 9) //enrage
                {
                    NPC.ai[0]     = 1;
                    NPC.ai[1]     = 0;
                    NPC.ai[2]     = 0;
                    NPC.ai[3]     = 1; //marks enrage jump
                    NPC.netUpdate = true;

                    SoundEngine.PlaySound(SoundID.ForceRoarPitched, player.Center);
                }

                Vector2 dustOffset = Vector2.Normalize(player.Center - NPC.Center) * 1400;
                for (int i = 0; i < 20; i++) //dust ring for enrage range
                {
                    int d = Dust.NewDust(NPC.Center + dustOffset.RotatedByRandom(2 * Math.PI), 0, 0, 59, Scale: 2f);
                    Main.dust[d].velocity  = NPC.velocity;
                    Main.dust[d].noGravity = true;
                }
            }
        }
Пример #20
0
            public void Draw(SpriteBatch spriteBatch, Vector2 iconAnchorPositionOnScreen, Player targetPlayer)
            {
                Rectangle       rectangle       = Utils.CenteredRectangle(iconAnchorPositionOnScreen, new Vector2(14f, 14f));
                Point           value           = Main.MouseScreen.ToPoint();
                Texture2D       value2          = Texture.Value;
                bool            flag            = rectangle.Contains(value) && !PlayerInput.IgnoreMouseInterface;
                WireToggleState wireToggleState = _stateProvider(targetPlayer);
                Color           color           = Color.White;

                switch (wireToggleState)
                {
                case WireToggleState.Bright:
                    color = Color.White;
                    break;

                case WireToggleState.Normal:
                    color = Color.Gray;
                    break;

                case WireToggleState.Faded:
                    color = Color.Gray * 0.66f;
                    break;
                }

                if (flag)
                {
                    targetPlayer.mouseInterface = true;
                    string arg = "";
                    switch (wireToggleState)
                    {
                    case WireToggleState.Bright:
                        arg = Language.GetTextValue("GameUI.Bright");
                        break;

                    case WireToggleState.Normal:
                        arg = Language.GetTextValue("GameUI.Normal");
                        break;

                    case WireToggleState.Faded:
                        arg = Language.GetTextValue("GameUI.Faded");
                        break;
                    }

                    string cursorText = $"{Language.GetTextValue(_nameKey)}: {arg}";
                    Main.instance.MouseText(cursorText, 0, 0);
                    Main.mouseText = true;
                    Texture2D value3 = TextureAssets.InfoIcon[13].Value;
                    spriteBatch.Draw(value3, iconAnchorPositionOnScreen, null, Main.OurFavoriteColor, 0f, value3.Size() / 2f, 1f, SpriteEffects.None, 0f);
                }

                if (flag && Main.mouseLeft && Main.mouseLeftRelease)
                {
                    _performClickMethod(targetPlayer);
                    SoundEngine.PlaySound(12);
                    Main.mouseLeftRelease = false;
                }

                Rectangle sourceRectangle = Frame.GetSourceRectangle(value2);

                spriteBatch.Draw(value2, iconAnchorPositionOnScreen, sourceRectangle, color, 0f, sourceRectangle.Size() / 2f, 1f, SpriteEffects.None, 0f);
            }
Пример #21
0
 private static void OpenSources(UIMouseEvent evt, UIElement listeningElement)
 {
     SoundEngine.PlaySound(10, -1, -1, 1);
     Directory.CreateDirectory(Loader.ModSourcesPath);
     Process.Start(Loader.ModSourcesPath);
 }
        /*
         * private void CalamityBoost(Player player)
         * {
         *  CalamityMod.CalPlayer.CalamityPlayer CalamityPlayer = Player.GetModPlayer<CalamityMod.CalPlayer.CalamityPlayer>();
         *  CalamityPlayer.throwingCrit += 10;
         * }
         * private void RedemptionBoost(Player player)
         * {
         *  Redemption.Items.DruidDamageClass.DruidDamagePlayer RedemptionPlayer = Player.GetModPlayer<Redemption.Items.DruidDamageClass.DruidDamagePlayer>();
         *  RedemptionPlayer.druidCrit += 10;
         * }
         * private void ThoriumBoosts(Player player)
         * {
         *  ThoriumMod.ThoriumPlayer ThoriumPlayer = Player.GetModPlayer<ThoriumMod.ThoriumPlayer>();
         *  ThoriumPlayer.symphonicCrit += 10;
         *  ThoriumPlayer.radiantCrit += 10;
         * }
         */

        public override void ProcessTriggers(TriggersSet triggersSet)
        {
            if (DistantPotionsUse && PlayerInput.Triggers.Current.QuickBuff)
            {
                SoundStyle type1 = SoundID.Item3;
                bool       flag  = true;
                for (int index1 = 0; index1 < 40; ++index1)
                {
                    if (Player.CountBuffs() == 22)
                    {
                        return;
                    }
                    if (Player.bank.item[index1].stack > 0 && Player.bank.item[index1].type > 0 && (Player.bank.item[index1].buffType > 0 && !Player.bank.item[index1].CountsAsClass(DamageClass.Summon)) && Player.bank.item[index1].buffType != 90)
                    {
                        // IMPLEMENT WHEN WEAKREFERENCES FIXED

                        /*
                         * if (ModLoader.GetMod("CalamityMod") != null)
                         * {
                         *      if (Player.bank.item[index1].buffType == ModLoader.GetMod("CalamityMod").BuffType("AbsoluteRage"))
                         *      {
                         *              for (int v = 0; v < 200; ++v)
                         *              {
                         *                      NPC npc = Main.npc[v];
                         *                      if (NPC.active && NPC.boss)
                         *                      {
                         *                              return;
                         *                      }
                         *              }
                         *              CalamityRage(Player);
                         *      }
                         * }
                         */
                        int type2 = Player.bank.item[index1].buffType;
                        for (int index2 = 0; index2 < 22; ++index2)
                        {
                            if (type2 == 27 && (Player.buffType[index2] == type2 || Player.buffType[index2] == 101 || Player.buffType[index2] == 102))
                            {
                                flag = false;
                                break;
                            }
                            if (Player.buffType[index2] == type2)
                            {
                                flag = false;
                                break;
                            }
                            if (Main.meleeBuff[type2] && Main.meleeBuff[Player.buffType[index2]])
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (Main.lightPet[Player.bank.item[index1].buffType] || Main.vanityPet[Player.bank.item[index1].buffType])
                        {
                            for (int index2 = 0; index2 < 22; ++index2)
                            {
                                if (Main.lightPet[Player.buffType[index2]] && Main.lightPet[Player.bank.item[index1].buffType])
                                {
                                    flag = false;
                                }
                                if (Main.vanityPet[Player.buffType[index2]] && Main.vanityPet[Player.bank.item[index1].buffType])
                                {
                                    flag = false;
                                }
                            }
                        }
                        if (Player.bank.item[index1].mana > 0 & flag)
                        {
                            if (Player.statMana >= (int)((double)Player.bank.item[index1].mana * (double)Player.manaCost))
                            {
                                Player.manaRegenDelay = (int)Player.maxRegenDelay;
                                Player.statMana       = Player.statMana - (int)((double)Player.bank.item[index1].mana * (double)Player.manaCost);
                            }
                            else
                            {
                                flag = false;
                            }
                        }
                        if (Player.whoAmI == Main.myPlayer && Player.bank.item[index1].type == 603 && !Main.runningCollectorsEdition)
                        {
                            flag = false;
                        }
                        if (type2 == 27)
                        {
                            type2 = Main.rand.Next(3);
                            if (type2 == 0)
                            {
                                type2 = 27;
                            }
                            if (type2 == 1)
                            {
                                type2 = 101;
                            }
                            if (type2 == 2)
                            {
                                type2 = 102;
                            }
                        }
                        if (flag)
                        {
                            type1 = (SoundStyle)Player.bank.item[index1].UseSound;
                            int time1 = Player.bank.item[index1].buffTime;
                            if (time1 == 0)
                            {
                                time1 = 3600;
                            }

                            if (AlchemistCharmTier4)
                            {
                                time1 += time1 / 2;
                            }
                            else if (AlchemistCharmTier3)
                            {
                                time1 += (time1 / 20) * 7;
                            }
                            else if (AlchemistCharmTier2)
                            {
                                time1 += time1 / 4;
                            }
                            else if (AlchemistCharmTier1)
                            {
                                time1 += time1 / 10;
                            }

                            Player.AddBuff(type2, time1, true);

                            if (Player.bank.item[index1].consumable)
                            {
                                if (AlchemistCharmTier4 == true)
                                {
                                    // IMPLEMENT WHEN WEAKREFERENCES FIXED

                                    /*
                                     * Mod Calamity = ModLoader.GetMod("CalamityMod");
                                     * if (Calamity != null)
                                     * {
                                     * if ((bool)Calamity.Call("Downed", "supreme calamitas"))
                                     * {
                                     * }
                                     * else if (Main.rand.NextFloat() >= .25f)
                                     * {
                                     * }
                                     * else
                                     * {
                                     * --Player.bank.item[index1].stack;
                                     * }
                                     * }
                                     */
                                    if (Main.rand.NextFloat() >= .25f)  //Replaced else if until weakreferences fixed
                                    {
                                    }
                                    else
                                    {
                                        --Player.bank.item[index1].stack;
                                    }
                                }

                                else if (AlchemistCharmTier3 == true)
                                {
                                    if (Main.rand.Next(2) == 0)
                                    {
                                    }
                                    else
                                    {
                                        --Player.bank.item[index1].stack;
                                    }
                                }

                                else if (AlchemistCharmTier2 == true)
                                {
                                    if (Main.rand.Next(4) == 0)
                                    {
                                    }
                                    else
                                    {
                                        --Player.bank.item[index1].stack;
                                    }
                                }

                                else if (AlchemistCharmTier1 == true)
                                {
                                    if (Main.rand.Next(10) == 0)
                                    {
                                    }
                                    else
                                    {
                                        --Player.bank.item[index1].stack;
                                    }
                                }
                                else
                                {
                                    --Player.bank.item[index1].stack;
                                }
                                if (Player.bank.item[index1].stack <= 0)
                                {
                                    Player.bank.item[index1].TurnToAir();
                                }
                            }
                        }
                    }
                }
                //if (type1 == null)
                //return;
                if (flag)
                {
                    SoundEngine.PlaySound(type1, Player.position);
                }
                //Recipe.FindRecipes();
            }
            if (AlchemistNPCLite.DiscordBuff.JustPressed)
            {
                if (Main.myPlayer == Player.whoAmI && Player.HasBuff(ModContent.BuffType <Buffs.DiscordBuff>()))
                {
                    Vector2 vector2 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
                    if (!Collision.SolidCollision(vector2, Player.width, Player.height))
                    {
                        Player.Teleport(vector2, 1, 0);
                        NetMessage.SendData(65, -1, -1, (NetworkText)null, 0, (float)Player.whoAmI, (float)vector2.X, (float)vector2.Y, 1, 0, 0);
                        if (Player.chaosState)
                        {
                            Player.statLife = Player.statLife - Player.statLifeMax2 / 3;
                            PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13);
                            if (Main.rand.Next(2) == 0)
                            {
                                damageSource = PlayerDeathReason.ByOther(Player.Male ? 14 : 15);
                            }
                            if (Player.statLife <= 0)
                            {
                                Player.KillMe(damageSource, 1.0, 0, false);
                            }
                            Player.lifeRegenCount = 0;
                            Player.lifeRegenTime  = 0;
                        }
                        Player.AddBuff(88, 600, true);
                        Player.AddBuff(164, 60, true);
                    }
                }
                if (Main.myPlayer == Player.whoAmI && Player.HasBuff(ModContent.BuffType <Buffs.TrueDiscordBuff>()))
                {
                    Vector2 vector2 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
                    if (!Collision.SolidCollision(vector2, Player.width, Player.height))
                    {
                        Player.Teleport(vector2, 1, 0);
                        NetMessage.SendData(65, -1, -1, (NetworkText)null, 0, (float)Player.whoAmI, (float)vector2.X, (float)vector2.Y, 1, 0, 0);
                        if (Player.chaosState)
                        {
                            Player.statLife = Player.statLife - Player.statLifeMax2 / 7;
                            PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13);
                            if (Main.rand.Next(2) == 0)
                            {
                                damageSource = PlayerDeathReason.ByOther(Player.Male ? 14 : 15);
                            }
                            if (Player.statLife <= 0)
                            {
                                Player.KillMe(damageSource, 1.0, 0, false);
                            }
                            Player.lifeRegenCount = 0;
                            Player.lifeRegenTime  = 0;
                        }
                        Player.AddBuff(88, 360, true);
                    }
                }
            }
        }
Пример #23
0
        private bool DrawValueBarDynamicWidth(SpriteBatch spriteBatch, out float sliderValueThatWasSet)
        {
            sliderValueThatWasSet = 0.0f;
            Texture2D texture1   = TextureAssets.ColorBar.Value;
            Rectangle rectangle1 = this.GetDimensions().ToRectangle();
            Rectangle rectangle2 = new Rectangle(5, 4, 4, 4);

            Utils.DrawSplicedPanel(spriteBatch, texture1, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height, rectangle2.X, rectangle2.Width, rectangle2.Y, rectangle2.Height, Color.White);
            Rectangle destinationRectangle1 = rectangle1;

            destinationRectangle1.X      += rectangle2.Left;
            destinationRectangle1.Width  -= rectangle2.Right;
            destinationRectangle1.Y      += rectangle2.Top;
            destinationRectangle1.Height -= rectangle2.Bottom;
            Texture2D texture2   = TextureAssets.MagicPixel.Value;
            Rectangle rectangle3 = new Rectangle(0, 0, 1, 1);

            spriteBatch.Draw(texture2, destinationRectangle1, new Rectangle?(rectangle3), this.EmptyColor);
            Rectangle destinationRectangle2 = destinationRectangle1;

            destinationRectangle2.Height = (int)((double)destinationRectangle2.Height * (double)this.FillPercent);
            destinationRectangle2.Y     += destinationRectangle1.Height - destinationRectangle2.Height;
            spriteBatch.Draw(texture2, destinationRectangle2, new Rectangle?(rectangle3), this.FilledColor);
            Rectangle destinationRectangle3 = Utils.CenteredRectangle(new Vector2((float)(destinationRectangle2.Center.X + 1), (float)destinationRectangle2.Top), new Vector2((float)(destinationRectangle2.Width + 16), 4f));
            Rectangle destinationRectangle4 = destinationRectangle3;

            destinationRectangle4.Inflate(2, 2);
            spriteBatch.Draw(texture2, destinationRectangle4, new Rectangle?(rectangle3), Color.Black);
            spriteBatch.Draw(texture2, destinationRectangle3, new Rectangle?(rectangle3), Color.White);
            Rectangle rectangle4 = destinationRectangle1;

            rectangle4.Inflate(4, 0);
            bool flag1 = rectangle4.Contains(Main.MouseScreen.ToPoint());

            this._isReallyMouseOvered = flag1;
            bool flag2 = flag1;

            if (this.IgnoresMouseInteraction)
            {
                flag2 = false;
            }
            int usageLevel = this.GetUsageLevel();

            if (usageLevel == 2)
            {
                flag2 = false;
            }
            if (usageLevel == 1)
            {
                flag2 = true;
            }
            if (flag2 || usageLevel == 1)
            {
                if (!this._alreadyHovered)
                {
                    SoundEngine.PlaySound(12, -1, -1, 1, 1f, 0.0f);
                }
                this._alreadyHovered = true;
            }
            else
            {
                this._alreadyHovered = false;
            }
            if (!flag2)
            {
                return(false);
            }
            sliderValueThatWasSet = Utils.GetLerpValue((float)destinationRectangle1.Bottom, (float)destinationRectangle1.Top, (float)Main.mouseY, true);
            return(true);
        }
Пример #24
0
 public override void MouseDown(UIMouseEvent evt)
 {
     this._player.skinVariant = this.ClothStyleId;
     SoundEngine.PlaySound(12, -1, -1, 1, 1f, 0.0f);
     base.MouseDown(evt);
 }
Пример #25
0
		private void ReloadMods(UIMouseEvent evt, UIElement listeningElement) {
			SoundEngine.PlaySound(10, -1, -1, 1);
			if (items.Count > 0)
				ModLoader.Reload();
		}
Пример #26
0
 public override void AI()
 {
     npc.wet         = false;
     npc.lavaWet     = false;
     npc.honeyWet    = false;
     npc.immune[255] = 30;
     npc.direction   = npc.spriteDirection = -1;
     if (timer > 0.0f)
     {
         timer--;
     }
     foreach (Player player in Main.player)
     {
         if (!player.active)
         {
             continue;
         }
         if (player.inventory[player.selectedItem].type == ModContent.ItemType <SteelShovel>())
         {
             if (player.itemAnimation > 0 && timer <= 0.0f)
             {
                 var FirstRectangle = new Rectangle((int)player.itemLocation.X, (int)player.itemLocation.Y, 34, 34);
                 FirstRectangle.Width  = (int)(FirstRectangle.Width * player.inventory[player.selectedItem].scale);
                 FirstRectangle.Height = (int)(FirstRectangle.Height * player.inventory[player.selectedItem].scale);
                 if (player.direction == -1)
                 {
                     FirstRectangle.X -= FirstRectangle.Width;
                 }
                 if (player.gravDir == 1f)
                 {
                     FirstRectangle.Y -= FirstRectangle.Height;
                 }
                 if (player.itemAnimation < player.itemAnimationMax * 0.333)
                 {
                     if (player.direction == -1)
                     {
                         FirstRectangle.X -= (int)(FirstRectangle.Width * 1.4 - FirstRectangle.Width);
                     }
                     FirstRectangle.Width  = (int)(FirstRectangle.Width * 1.4);
                     FirstRectangle.Y     += (int)(FirstRectangle.Height * 0.5 * player.gravDir);
                     FirstRectangle.Height = (int)(FirstRectangle.Height * 1.1);
                 }
                 else if (player.itemAnimation >= player.itemAnimationMax * 0.666)
                 {
                     if (player.direction == 1)
                     {
                         FirstRectangle.X -= (int)(FirstRectangle.Width * 1.2);
                     }
                     FirstRectangle.Width *= 2;
                     FirstRectangle.Y     -= (int)((FirstRectangle.Height * 1.4 - FirstRectangle.Height) * player.gravDir);
                     FirstRectangle.Height = (int)(FirstRectangle.Height * 1.4);
                 }
                 Rectangle SecondRectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
                 if (FirstRectangle.Intersects(SecondRectangle) && (npc.noTileCollide || Collision.CanHit(player.position, player.width, player.height, npc.position, npc.width, npc.height)))
                 {
                     if (frame < 3)
                     {
                         timer = 60.0f;
                         SoundEngine.PlaySound(2, (int)player.position.X, (int)player.position.Y, 48);
                         for (int i = 0; i < 20; i++)
                         {
                             Dust.NewDust(npc.position + new Vector2(6.0f, 0.0f), npc.width, npc.height, 212, (i - 20) * 0.1f, -1.5f);
                         }
                         if (frame < 3)
                         {
                             frame += 1;
                         }
                     }
                 }
             }
         }
     }
     if (Main.netMode != NetmodeID.MultiplayerClient)
     {
         npc.homeless  = false;
         npc.homeTileX = -1;
         npc.homeTileY = -1;
         npc.netUpdate = true;
     }
 }
Пример #27
0
		private static void GotoModPacksMenu(UIMouseEvent evt, UIElement listeningElement) {
			if (!Interface.modsMenu.loading) {
				SoundEngine.PlaySound(12, -1, -1, 1);
				Main.menuMode = Interface.modPacksMenuID;
			}
		}
Пример #28
0
        public CameraMap()
        {
            _soundEngine = ThreadingEngine.GetThread <SoundEngine>();

            InitializeComponent();
        }
Пример #29
0
 public void PuzzleButtonPress()
 {
     SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundclick);
     Application.LoadLevel("SelectLevel");
 }
Пример #30
0
        public override bool PreAI(NPC npc)
        {
            bool result = base.PreAI(npc);

            EModeGlobalNPC.primeBoss = npc.whoAmI;

            if (FargoSoulsWorld.SwarmActive)
            {
                return(result);
            }

            if (npc.ai[1] == 3) //despawn faster
            {
                if (npc.timeLeft > 60)
                {
                    npc.timeLeft = 60;
                }
            }

            if (npc.ai[1] == 0f)
            {
                HaveShotGuardians = false;

                if (npc.ai[2] == 600 - 90) //telegraph spin
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType <TargetingReticle>(), 0, 0f, Main.myPlayer, npc.whoAmI, npc.type);
                    }
                }
                if (npc.ai[2] < 600 - 5)
                {
                    MemorizedTarget = npc.target;
                }
            }

            if (npc.ai[1] == 1f)
            {
                if (MemorizedTarget > -1 && MemorizedTarget < Main.maxPlayers)
                {
                    npc.target      = MemorizedTarget;
                    npc.netUpdate   = true;
                    MemorizedTarget = -1;
                    if (!npc.HasValidTarget)
                    {
                        npc.TargetClosest(false);
                    }
                }
            }

            if (npc.ai[0] != 2f || FargoSoulsWorld.MasochistModeReal)
            {
                if (!HaveShotGuardians && npc.ai[1] == 1f && npc.ai[2] > 2f) //spinning, do wave of guardians
                {
                    HaveShotGuardians = true;

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            for (int j = -2; j <= 2; j++)
                            {
                                Vector2 spawnPos = new Vector2(1200, 80 * j);
                                Vector2 vel      = -10 * Vector2.UnitX;
                                spawnPos = Main.player[npc.target].Center + spawnPos.RotatedBy(Math.PI / 2 * i);
                                vel      = vel.RotatedBy(Math.PI / 2 * i);
                                int p = Projectile.NewProjectile(npc.GetSource_FromThis(), spawnPos, vel, ModContent.ProjectileType <PrimeGuardian>(), FargoSoulsUtil.ScaledProjectileDamage(npc.damage), 0f, Main.myPlayer);
                                if (p != Main.maxProjectiles)
                                    Main.projectile[p].timeLeft = 1200 / 10 + 1;
                            }
                        }
                    }
                }

                if (++RocketTimer >= 360)
                {
                    RocketTimer = 0;

                    if (npc.HasPlayerTarget) //skeleton commando rockets LUL
                    {
                        Vector2 speed = Main.player[npc.target].Center - npc.Center;
                        speed.X += Main.rand.Next(-20, 21);
                        speed.Y += Main.rand.Next(-20, 21);
                        speed.Normalize();

                        int damage = FargoSoulsUtil.ScaledProjectileDamage(npc.damage);

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, 3f * speed, ProjectileID.RocketSkeleton, damage, 0f, Main.myPlayer);
                            Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, 3f * speed.RotatedBy(MathHelper.ToRadians(5f)), ProjectileID.RocketSkeleton, damage, 0f, Main.myPlayer);
                            Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, 3f * speed.RotatedBy(MathHelper.ToRadians(-5f)), ProjectileID.RocketSkeleton, damage, 0f, Main.myPlayer);
                        }

                        SoundEngine.PlaySound(SoundID.Item11, npc.Center);
                    }
                }
            }

            if (npc.ai[0] != 2f)                  //in phase 1
            {
                if (npc.life < npc.lifeMax * .75) //enter phase 2
                {
                    npc.ai[0] = 2f;

                    npc.ai[1] = 0f;              //revert to nonspin mode
                    npc.ai[2] = 600f - 90f - 2f; //but only for telegraph and then go back into spin

                    npc.ai[3]     = 0f;
                    npc.netUpdate = true;

                    if (!NPC.AnyNPCs(NPCID.PrimeLaser)) //revive all dead limbs
                    {
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeLaser, npc.whoAmI, 1f, npc.whoAmI, 0f, 150f, npc.target);
                    }
                    if (!NPC.AnyNPCs(NPCID.PrimeSaw))
                    {
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeSaw, npc.whoAmI, 1f, npc.whoAmI, 0f, 0f, npc.target);
                    }
                    if (!NPC.AnyNPCs(NPCID.PrimeCannon))
                    {
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeCannon, npc.whoAmI, -1f, npc.whoAmI, 0f, 150f, npc.target);
                    }
                    if (!NPC.AnyNPCs(NPCID.PrimeVice))
                    {
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeVice, npc.whoAmI, -1f, npc.whoAmI, 0f, 0f, npc.target);
                    }

                    string text = Language.GetTextValue($"Mods.{mod.Name}.Message.SkeletronRegrow");
                    FargoSoulsUtil.PrintLocalization($"{npc.FullName} {text}", new Color(175, 75, 255));

                    SoundEngine.PlaySound(SoundID.Roar, npc.Center);
                    return(result);
                }
            }
            else //in phase 2
            {
                npc.dontTakeDamage = false;

                if (npc.ai[1] == 1f && npc.ai[2] > 2f) //spinning
                {
                    //if (npc.HasValidTarget) npc.position += npc.DirectionTo(Main.player[npc.target].Center) * 5;

                    if (++ProjectileAttackTimer > 90) //projectile attack
                    {
                        ProjectileAttackTimer = -30;
                        int damage = npc.defDamage / 3;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            SoundEngine.PlaySound(SoundID.Item105 with {
                                Volume = 2f
                            }, npc.Center);

                            float modifier = (float)npc.life / npc.lifeMax;
                            if (FargoSoulsWorld.MasochistModeReal)
                            {
                                modifier = 0;
                            }
                            int starMax = (int)(7f - 6f * modifier);

                            const int max = 8;
                            for (int i = 0; i < max; i++)
                            {
                                Vector2 speed = 12f * npc.DirectionTo(Main.player[npc.target].Center).RotatedBy(2 * Math.PI / max * i);
                                for (int j = -starMax; j <= starMax; j++)
                                {
                                    int p = Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, speed.RotatedBy(MathHelper.ToRadians(2f) * j),
                                                                     ModContent.ProjectileType <DarkStar>(), damage, 0f, Main.myPlayer);
                                    Main.projectile[p].soundDelay = -1; //dont play sounds
                                    if (p != Main.maxProjectiles)
                                    {
                                        Main.projectile[p].timeLeft = 480;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (npc.ai[1] == 2f) //dg phase
                {
                    while (npc.buffType[0] != 0)
                    {
                        npc.buffImmune[npc.buffType[0]] = true;
                        npc.DelBuff(0);
                    }

                    if (!Main.dayTime && !FargoSoulsWorld.MasochistModeReal)
                    {
                        npc.position -= npc.velocity * 0.1f;
                        if (++DungeonGuardianStartup < 120)
                        {
                            npc.position -= npc.velocity * (120 - DungeonGuardianStartup) / 120 * 0.9f;
                        }
                    }
                }
                else //not spinning
                {
                    ProjectileAttackTimer = 0; //buffer this for spin

                    npc.position += npc.velocity / 4f;
                }

                if (!FullySpawnedLimbs && npc.ai[3] >= 0f) //spawn 4 more limbs
                {
                    npc.ai[3]++;
                    if (npc.ai[3] == 60f) //first set of limb management
                    {
                        int[] limbs = { NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeSaw, NPCID.PrimeVice };

                        foreach (NPC l in Main.npc.Where(l => l.active && l.ai[1] == npc.whoAmI && limbs.Contains(l.type)))
                        {
                            l.GetEModeNPCMod <PrimeLimb>().IsSwipeLimb = true;
                            l.ai[2] = 0;

                            int heal = (l.lifeMax - l.life) / 2;
                            l.life += heal;
                            if (heal > 0)
                            {
                                l.HealEffect(heal);
                            }
                            l.dontTakeDamage = false;

                            l.netUpdate = true;
                            NetSync(l);
                        }

                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeLaser, npc.whoAmI, -1f, npc.whoAmI, 0f, 150f, npc.target);
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeSaw, npc.whoAmI, -1f, npc.whoAmI, 0f, 0f, npc.target);
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeCannon, npc.whoAmI, 1f, npc.whoAmI, 0f, 150f, npc.target);
                        FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.PrimeVice, npc.whoAmI, 1f, npc.whoAmI, 0f, 0f, npc.target);
                    }
                    else if (npc.ai[3] >= 180f)
                    {
                        FullySpawnedLimbs = true;
                        npc.ai[3]         = -1f;
                        npc.netUpdate     = true;

                        SoundEngine.PlaySound(SoundID.Roar, npc.Center);

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int rangedArm = Main.rand.NextBool() ? NPCID.PrimeCannon : NPCID.PrimeLaser;
                            int meleeArm  = Main.rand.NextBool() ? NPCID.PrimeSaw : NPCID.PrimeVice;

                            int[] limbs = { NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeSaw, NPCID.PrimeVice };

                            foreach (NPC l in Main.npc.Where(l => l.active && l.ai[1] == npc.whoAmI && limbs.Contains(l.type) && !l.GetEModeNPCMod <PrimeLimb>().IsSwipeLimb))
                            {
                                l.GetEModeNPCMod <PrimeLimb>().RangedAttackMode = npc.type == rangedArm || npc.type == meleeArm;

                                int heal = l.lifeMax;
                                l.life = Math.Min(l.life + l.lifeMax / 2, l.lifeMax);
                                heal  -= l.life;
                                if (heal > 0)
                                {
                                    l.HealEffect(heal);
                                }

                                l.dontTakeDamage = false;

                                l.netUpdate = true;
                                NetSync(l);
                            }
                        }
                    }
                }
            }

            //accel at player whenever out of range
            if (npc.HasValidTarget && npc.Distance(Main.player[npc.target].Center) > 900)
            {
                npc.velocity += 0.1f * npc.DirectionTo(Main.player[npc.target].Center);
            }

            EModeUtils.DropSummon(npc, "MechSkull", NPC.downedMechBoss3, ref DroppedSummon, Main.hardMode);

            return(result);
        }
Пример #31
0
 public void BackButtonPress()
 {
     SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundclick);
     Application.LoadLevel("MainMenu");
 }
 void Awake()
 {
     m_Instancce = this;
 }
Пример #33
0
 public override void MouseOver(UIMouseEvent evt)
 {
     base.MouseOver(evt);
     SoundEngine.PlaySound(12, -1, -1, 1, 1f, 0.0f);
     this._hovered = true;
 }
Пример #34
0
        public override void AI()
        {
            //dust!
            int dustId = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.2f,
                                      Projectile.velocity.Y * 0.2f, 100, default(Color), 2f);

            Main.dust[dustId].noGravity = true;
            int dustId3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.2f,
                                       Projectile.velocity.Y * 0.2f, 100, default(Color), 2f);

            Main.dust[dustId3].noGravity = true;

            if (--Projectile.localAI[0] < 0)
            {
                Projectile.localAI[0] = 3;
                if (Projectile.owner == Main.myPlayer)
                {
                    Vector2 baseVel = Vector2.Normalize(Projectile.velocity).RotatedBy(Math.PI / 2);

                    int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 16f * baseVel,
                                                     ModContent.ProjectileType <PhantasmalSphere>(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, 1f);
                    if (p != Main.maxProjectiles)
                    {
                        Main.projectile[p].DamageType = Projectile.DamageType;
                    }

                    p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 16f * -baseVel,
                                                 ModContent.ProjectileType <PhantasmalSphere>(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, 1f);
                    if (p != Main.maxProjectiles)
                    {
                        Main.projectile[p].DamageType = Projectile.DamageType;
                    }

                    /*Vector2 vel = baseVel.RotatedByRandom(Math.PI / 4);
                     * Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 8f * vel, ModContent.ProjectileType<HentaiSpearArc>(),
                     *  Projectile.damage, Projectile.knockBack / 2, Projectile.owner, vel.ToRotation(), Projectile.timeLeft / Projectile.MaxUpdates);
                     * vel = -baseVel.RotatedByRandom(Math.PI / 4);
                     * Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, 8f * vel, ModContent.ProjectileType<HentaiSpearArc>(),
                     *  Projectile.damage, Projectile.knockBack / 2, Projectile.owner, vel.ToRotation(), Projectile.timeLeft / Projectile.MaxUpdates);*/
                }
            }

            if (Projectile.localAI[1] == 0f)
            {
                Projectile.localAI[1] = 1f;
                SoundEngine.PlaySound(SoundID.Item1, Projectile.Center);
                if (Projectile.owner == Main.myPlayer)
                {
                    int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Normalize(Projectile.velocity),
                                                     ModContent.ProjectileType <HentaiSpearDeathray>(), Projectile.damage, Projectile.knockBack,
                                                     Projectile.owner, 0f, Projectile.velocity.Length() * Projectile.MaxUpdates);
                    if (p != Main.maxProjectiles)
                    {
                        Main.projectile[p].DamageType = Projectile.DamageType;
                    }
                }
            }

            Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(135f);

            scaletimer++;
        }
Пример #35
0
        //public SpriteClasses.BloodControl.BloodDespawner despawn;
        /// <summary>
        /// Creates a new level, sets up Farseer world object and loads tiles
        /// </summary>
        /// <param name="serviceProvider"></param>
        public Level1ReallyOld(ContentManager serviceProvider, GraphicsDevice graphicDevice)
        {
            FarseerPhysics.Settings.EnableDiagnostics = false;
            FarseerPhysics.Settings.VelocityIterations = 6;
            FarseerPhysics.Settings.PositionIterations = 2;
            FarseerPhysics.Settings.ContinuousPhysics = false;

            content = serviceProvider;
            if (world == null)
            {
                world = new World(new Vector2(0f, 0f));
            }
            else
            {
                world.Clear();
            }

            LoadTiles();
            soundEngine = new SoundEngine(content);

            // create and configure the debug view
            _debugView = new DebugViewXNA(world);
            _debugView.Enabled = true;
            _debugView.AppendFlags(DebugViewFlags.DebugPanel);
            _debugView.DefaultShapeColor = Color.White;
            _debugView.SleepingShapeColor = Color.Lavender;
            _debugView.LoadContent(graphicDevice, content);
            _debugView.AdaptiveLimits = true;
            _debugView.AppendFlags(DebugViewFlags.AABB);
        }
Пример #36
0
 public override bool?UseItem(Player player)
 {
     NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <NPCs.Bosses.Org13.xion_firstPhase>());
     SoundEngine.PlaySound(SoundID.FemaleHit, player.position, 0);
     return(true);
 }
Пример #37
0
        public override void AI()
        {
            int       time     = 15 * (int)Projectile.ai[1];
            const int maxScale = 1;

            if (Projectile.ai[0] == 0)
            {
                p = Player.FindClosest(Projectile.Center, 0, 0);
            }

            if (p != -1)
            {
                Projectile.position += Main.player[p].velocity * 0.8f;

                Vector2 target = Main.player[p].Center;
                target.Y -= 400;

                Vector2 distance = target - Projectile.Center;
                distance           /= 6f;
                Projectile.velocity = (Projectile.velocity * 19f + distance) / 20f;
            }

            Projectile.ai[0]++;
            if (Projectile.ai[0] <= 30)
            {
                if (Main.rand.NextBool(4))
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515);
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.position  = Projectile.Center - spinningpoint * Main.rand.Next(10, 21);
                    dust.velocity  = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 4f;
                    dust.scale     = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn    = 0.5f;
                }
                if (Main.rand.NextBool(4))
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515);
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.position  = Projectile.Center - spinningpoint * 30f;
                    dust.velocity  = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 2f;
                    dust.scale     = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn    = 0.5f;
                }
            }
            else if (Projectile.ai[0] <= 60)
            {
                Projectile.scale    = (Projectile.ai[0] - 30) / 40 * maxScale;
                Projectile.alpha    = 255 - (int)(255 * Projectile.scale / maxScale);
                Projectile.rotation = Projectile.rotation - 0.1570796f;
                if (Main.rand.NextBool())
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity  = true;
                    dust.position   = Projectile.Center - spinningpoint * Main.rand.Next(10, 21);
                    dust.velocity   = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f;
                    dust.scale      = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn     = 0.5f;
                    dust.customData = Projectile.Center;
                }
                if (Main.rand.NextBool())
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity  = true;
                    dust.position   = Projectile.Center - spinningpoint * 30f;
                    dust.velocity   = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f;
                    dust.scale      = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn     = 0.5f;
                    dust.customData = Projectile.Center;
                }
            }
            else if (Projectile.ai[0] <= 60 + time)
            {
                Projectile.scale    = maxScale;
                Projectile.alpha    = 0;
                Projectile.rotation = Projectile.rotation - (float)Math.PI / 60f;
                if (Main.rand.NextBool())
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity  = true;
                    dust.position   = Projectile.Center - spinningpoint * Main.rand.Next(10, 21);
                    dust.velocity   = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f;
                    dust.scale      = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn     = 0.5f;
                    dust.customData = Projectile.Center;
                }
                else
                {
                    Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                    Dust    dust          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity  = true;
                    dust.position   = Projectile.Center - spinningpoint * 30f;
                    dust.velocity   = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f;
                    dust.scale      = 0.5f + Main.rand.NextFloat();
                    dust.fadeIn     = 0.5f;
                    dust.customData = Projectile.Center;
                }

                if (Projectile.ai[0] == 60 + time) //shoot lightning out
                {
                    SoundEngine.PlaySound(SoundID.Item82, Projectile.Center);

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Vector2 dir    = Vector2.UnitY;
                        float   ai1New = Main.rand.Next(100);
                        Vector2 vel    = Vector2.Normalize(dir.RotatedByRandom(Math.PI / 4)) * 5f;
                        Projectile.NewProjectile(Terraria.Entity.InheritSource(Projectile), Projectile.Center, vel, ProjectileID.CultistBossLightningOrbArc,
                                                 Projectile.damage, 0, Main.myPlayer, dir.ToRotation(), ai1New);
                    }
                }
            }
            else
            {
                Projectile.scale    = (float)(1.0 - (Projectile.ai[0] - time) / 60.0) * maxScale;
                Projectile.alpha    = 255 - (int)(255 * Projectile.scale / maxScale);
                Projectile.rotation = Projectile.rotation - (float)Math.PI / 30f;
                if (Projectile.alpha >= 255)
                {
                    Projectile.Kill();
                }
                for (int index = 0; index < 2; ++index)
                {
                    switch (Main.rand.Next(3))
                    {
                    case 0:
                        Vector2 spinningpoint1 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                        Dust    dust1          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint1 * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
                        dust1.noGravity  = true;
                        dust1.position   = Projectile.Center - spinningpoint1 * Main.rand.Next(10, 21);
                        dust1.velocity   = spinningpoint1.RotatedBy(1.57079637050629, new Vector2()) * 6f;
                        dust1.scale      = 0.5f + Main.rand.NextFloat();
                        dust1.fadeIn     = 0.5f;
                        dust1.customData = Projectile.Center;
                        break;

                    case 1:
                        Vector2 spinningpoint2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * Projectile.scale;
                        Dust    dust2          = Main.dust[Dust.NewDust(Projectile.Center - spinningpoint2 * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)];
                        dust2.noGravity  = true;
                        dust2.position   = Projectile.Center - spinningpoint2 * 30f;
                        dust2.velocity   = spinningpoint2.RotatedBy(-1.57079637050629, new Vector2()) * 3f;
                        dust2.scale      = 0.5f + Main.rand.NextFloat();
                        dust2.fadeIn     = 0.5f;
                        dust2.customData = Projectile.Center;
                        break;
                    }
                }
            }

            Dust dust3 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 229, 0f, 0f, 0, new Color(), 1f)];

            dust3.velocity *= 5f;
            dust3.fadeIn    = 1f;
            dust3.scale     = 1f + Main.rand.NextFloat() + Main.rand.Next(4) * 0.3f;
            dust3.noGravity = true;
        }
Пример #38
0
 void Awake()
 {
     Instance = this;
     _sources = ClipEmitter.GetComponents<AudioSource>();
 }