Exemplo n.º 1
0
        public override void KillSecond(int timeLeft, Player player, OrchidModPlayer modPlayer, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            int nb = 2 + Main.rand.Next(2);

            for (int i = 0; i < nb; i++)
            {
                Vector2 vel       = (new Vector2(0f, -(float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(90)));
                int     spawnProj = alchProj.natureFlask.type == ItemType <Alchemist.Weapons.Nature.PoisonVial>() ? ProjectileType <Alchemist.Projectiles.Nature.PoisonVialProjAlt>() : ProjectileType <Alchemist.Projectiles.Water.SeafoamVialProjAlt>();
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, projectile.owner);
            }
            int dmg   = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
            int shoot = ProjectileType <Alchemist.Projectiles.Water.SeafoamVialProj>();

            if (alchProj.natureFlask.type == ItemType <Alchemist.Weapons.Nature.PoisonVial>())
            {
                dmg   = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, alchProj.natureFlask.type, alchProj.nbElements);
                shoot = ProjectileType <Alchemist.Projectiles.Nature.PoisonVialProj>();
            }
            nb = alchProj.hasCloud() ? 2 : 1;
            for (int i = 0; i < nb; i++)
            {
                Vector2 vel = (new Vector2(0f, -2.5f).RotatedByRandom(MathHelper.ToRadians(30)));
                vel *= (float)(1 - (Main.rand.Next(10) / 10));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel.X, vel.Y, shoot, dmg, 0.5f, projectile.owner);
            }
        }
Exemplo n.º 2
0
        public override void KillSecond(int timeLeft, Player player, OrchidModPlayer modPlayer, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            if (alchProj.fireFlask.type != 0)
            {
                int type = ProjectileType <Alchemist.Projectiles.Water.SlimeFlaskProj>();
                int dmg  = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, type, dmg, 0.5f, projectile.owner);
                OrchidModProjectile.spawnDustCircle(projectile.Center, 6, 10, 10, true, 1f, 1f, 5f, true, true, false, 0, 0, true);
                OrchidModProjectile.spawnDustCircle(projectile.Center, 6, 10, 10, true, 1.5f, 1f, 2f, true, true, false, 0, 0, true);
                Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 45);

                if (player.HasBuff(BuffType <Alchemist.Buffs.SlimeFlaskBuff>()))
                {
                    int nb = 2 + Main.rand.Next(3);
                    for (int i = 0; i < nb; i++)
                    {
                        Vector2 vel       = (new Vector2(0f, -(float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(80)));
                        int     spawnProj = ProjectileType <Alchemist.Projectiles.Fire.EmberVialProjAlt>();
                        Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, projectile.owner);
                    }
                    int itemType = ItemType <Alchemist.Weapons.Fire.EmberVial>();
                    int dmgAlt   = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, alchProj.nbElements, true);
                    int rand     = alchProj.nbElements + Main.rand.Next(2);
                    for (int i = 0; i < rand; i++)
                    {
                        Vector2 vel = (new Vector2(0f, -3f).RotatedByRandom(MathHelper.ToRadians(60)));
                        Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel.X, vel.Y, ProjectileType <Alchemist.Projectiles.Fire.EmberVialProj>(), dmgAlt, 0f, projectile.owner);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void PostUpdateEquips()
        {
            this.updateBuffEffects();
            this.updateItemEffects();

            this.generalPostUpdateEquips();
            OrchidModShamanHelper.shamanPostUpdateEquips(player, this, mod);
            OrchidModAlchemistHelper.alchemistPostUpdateEquips(player, this, mod);
            OrchidModGamblerHelper.gamblerPostUpdateEquips(player, this, mod);
            OrchidModDancerHelper.dancerPostUpdateEquips(player, this, mod);

            Mod thoriumMod = OrchidMod.ThoriumMod;

            if (thoriumMod != null)
            {
                object result = thoriumMod.Call("GetAllCrit", player);
                if (result is int thoriumCrit && thoriumCrit > 0)
                {
                    this.customCrit += thoriumCrit;
                }
            }

            this.shamanCrit    += this.customCrit;
            this.alchemistCrit += this.customCrit;
            this.gamblerCrit   += this.customCrit;
            this.dancerCrit    += this.customCrit;

            this.CheckWoodBreak(player);
        }
Exemplo n.º 4
0
        public override void PostUpdate()
        {
            ignoreScrollHotbar = false;

            OrchidModShamanHelper.postUpdateShaman(player, this, mod);
            OrchidModGamblerHelper.postUpdateGambler(player, this, mod);
            OrchidModAlchemistHelper.postUpdateAlchemist(player, this, mod);
        }
Exemplo n.º 5
0
        public bool getDailyHint(Player player, OrchidModPlayer modPlayer)
        {
            int progression = OrchidModAlchemistHelper.getProgressLevel();

            while (progression > 0)
            {
                bool validHint = false;
                foreach (AlchemistHiddenReactionRecipe recipe in OrchidMod.alchemistReactionRecipes)
                {
                    if (recipe.level == progression)
                    {
                        if (!(modPlayer.alchemistKnownReactions.Contains(recipe.typeName) || modPlayer.alchemistKnownHints.Contains(recipe.typeName)))
                        {
                            validHint = true;
                            break;
                        }
                    }
                }

                if (validHint)
                {
                    int scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier1>();
                    switch (progression)
                    {
                    case 2:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier2>();
                        break;

                    case 3:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier3>();
                        break;

                    case 4:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier4>();
                        break;

                    case 5:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier5>();
                        break;

                    case 6:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier6>();
                        break;

                    default:
                        scrollType = ItemType <Alchemist.Misc.Scrolls.ScrollTier1>();
                        break;
                    }
                    player.QuickSpawnItem(scrollType, 1);
                    return(true);
                }
                else
                {
                    progression--;
                }
            }
            return(false);
        }
Exemplo n.º 6
0
        public override void Update(Player player, ref int buffIndex)
        {
            OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>();

            if (modPlayer.timer120 % 60 == 0 && player.velocity.X != 0f)
            {
                int projType = ProjectileType <Alchemist.Projectiles.Water.BloodMoonFlaskProj>();
                int itemType = ItemType <Alchemist.Weapons.Water.BloodMoonFlask>();
                int damage   = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 2, true);
                Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, projType, damage, 1f, player.whoAmI);
            }
        }
Exemplo n.º 7
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            int rand = alchProj.nbElements;

            if (Main.rand.Next(10) < rand)
            {
                int     dmg            = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.AlchemistHive>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
Exemplo n.º 8
0
        public override void Initialize()
        {
            OrchidModGamblerHelper.clearGamblerCards(player, this);
            OrchidModAlchemistHelper.onRespawnAlchemist(player, this, mod);
            OrchidModShamanHelper.onRespawnShaman(player, this, mod);
            OrchidModGamblerHelper.onRespawnGambler(player, this);
            this.alchemistKnownReactions = new List <string>();
            this.alchemistKnownHints     = new List <string>();

            this.alchemistPotionBag = new Item[16];
            for (int i = 0; i < 16; i++)
            {
                this.alchemistPotionBag[i] = new Item();
                this.alchemistPotionBag[i].SetDefaults(0, true);
            }
        }
Exemplo n.º 9
0
        public override void Reaction(Player player, OrchidModPlayer modPlayer)
        {
            for (int i = 0; i < 10; i++)
            {
                int   alpha    = 175;
                Color newColor = new Color(0, 80, (int)byte.MaxValue, 100);
                int   dust     = Dust.NewDust(player.Center, 10, 10, 4, 0.0f, 0.0f, alpha, newColor, 1.2f);
                Main.dust[dust].velocity *= 1.5f;
                Main.dust[dust].scale    *= 1f;
            }

            int itemType  = ItemType <Alchemist.Weapons.Water.DungeonFlask>();
            int dmg       = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 4, true);
            int spawnProj = ProjectileType <Alchemist.Projectiles.Reactive.SpiritedBubble>();

            Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, spawnProj, dmg, 0f, player.whoAmI);
        }
Exemplo n.º 10
0
        public override void Reaction(Player player, OrchidModPlayer modPlayer)
        {
            int itemType = ItemType <Alchemist.Weapons.Nature.PoisonVial>();
            int dmg      = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 4, true);

            for (int i = 0; i < 7; i++)
            {
                int spawnProj = Main.rand.Next(2) == 0 ? ProjectileType <Alchemist.Projectiles.Water.SeafoamVialProj>() : ProjectileType <Alchemist.Projectiles.Nature.PoisonVialProj>();
                Projectile.NewProjectile(player.Center.X - 120 + i * 40, player.Center.Y, 0f, -(float)(3 + Main.rand.Next(4)) * 0.5f, spawnProj, dmg, 0f, player.whoAmI);
            }

            for (int i = 0; i < 11; i++)
            {
                Vector2 vel       = (new Vector2(0f, -(float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(10)));
                int     spawnProj = Main.rand.Next(2) == 0 ? ProjectileType <Alchemist.Projectiles.Water.SeafoamVialProjAlt>() : ProjectileType <Alchemist.Projectiles.Nature.PoisonVialProjAlt>();
                Projectile.NewProjectile(player.Center.X - 150 + i * 30, player.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, player.whoAmI);
            }
        }
Exemplo n.º 11
0
        public override void Reaction(Player player, OrchidModPlayer modPlayer)
        {
            int itemType = ItemType <Alchemist.Weapons.Nature.SunflowerFlask>();
            int dmg      = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 4, true);
            int nb       = 5 + Main.rand.Next(4);

            for (int i = 0; i < 5; i++)
            {
                Vector2 vel = (new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(10)).RotatedBy(MathHelper.ToRadians(-40 + (20 * i))));
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, ProjectileType <Alchemist.Projectiles.Nature.SunflowerFlaskProj1>(), dmg, 0f, player.whoAmI);
            }

            for (int i = 0; i < nb; i++)
            {
                Vector2 vel       = (new Vector2(0f, (float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(180)));
                int     spawnProj = ProjectileType <Alchemist.Projectiles.Nature.SunflowerFlaskProj4>();
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, player.whoAmI);
            }
        }
Exemplo n.º 12
0
        public override void ResetEffects()
        {
            customCrit      = 0;
            remoteCopterPet = false;

            generalTools  = false;
            generalStatic = false;

            OrchidModDancerHelper.ResetEffectsDancer(player, this, mod);
            OrchidModAlchemistHelper.ResetEffectsAlchemist(player, this, mod);
            OrchidModGamblerHelper.ResetEffectsGambler(player, this, mod);
            OrchidModShamanHelper.ResetEffectsShaman(player, this, mod);

            if (this.keepSelected != -1)
            {
                player.selectedItem = keepSelected;
                this.keepSelected   = -1;
            }
        }
Exemplo n.º 13
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            int rand = alchProj.nbElements;

            rand += alchProj.hasCloud() ? 2 : 0;
            if (Main.rand.Next(10) < rand && !alchProj.noCatalyticSpawn)
            {
                int dmg  = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                int proj = ProjectileType <Alchemist.Projectiles.Reactive.SeafoamBubble>();
                if (alchProj.natureFlask.type == ItemType <Alchemist.Weapons.Nature.PoisonVial>())
                {
                    dmg  = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, alchProj.natureFlask.type, alchProj.nbElements);
                    proj = ProjectileType <Alchemist.Projectiles.Reactive.PoisonBubble>();
                }
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
Exemplo n.º 14
0
        public override void Update(Player player, ref int buffIndex)
        {
            OrchidModProjectile.spawnDustCircle(player.Center, 261, 1, 1, true, 1.5f, 1f, 16f, true, true, false, 0, 0, true);
            OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>();

            if (modPlayer.alchemistLastAttackDelay > 60)
            {
                int        range            = 100;
                int        projType         = ProjectileType <Alchemist.Projectiles.Water.IceChestFlaskProj>();
                int        itemType         = ItemType <Alchemist.Weapons.Water.IceChestFlask>();
                int        damage           = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 2, true);
                int        newProjectileInt = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, projType, damage, 0f, player.whoAmI);
                Projectile newProjectile    = Main.projectile[newProjectileInt];
                newProjectile.width      = range * 2;
                newProjectile.height     = range * 2;
                newProjectile.position.X = player.Center.X - (newProjectile.width / 2);
                newProjectile.position.Y = player.Center.Y - (newProjectile.width / 2);
                newProjectile.netUpdate  = true;
            }
        }
Exemplo n.º 15
0
        public override void Reaction(Player player, OrchidModPlayer modPlayer)
        {
            int itemType  = ItemType <Alchemist.Weapons.Air.DeathweedFlask>();
            int itemType2 = ItemType <Alchemist.Weapons.Air.ShiverthornFlask>();

            itemType = OrchidModAlchemistHelper.containsAlchemistFlask(itemType, player, modPlayer) ? itemType : itemType2;
            int dmg = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 4, true);

            for (int i = 0; i < 10; i++)
            {
                Vector2 vel        = (new Vector2(0f, -5f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))));
                int     spawnProj  = ProjectileType <Alchemist.Projectiles.Air.AirSporeProj>();
                int     spawnProj2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, dmg, 0f, player.whoAmI);
                Main.projectile[spawnProj2].localAI[1] = 1f;
            }
            int nb = 4 + Main.rand.Next(3);

            for (int i = 0; i < nb; i++)
            {
                Vector2 vel       = (new Vector2(0f, (float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(180)));
                int     spawnProj = ProjectileType <Alchemist.Projectiles.Air.AirSporeProjAlt>();
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, player.whoAmI);
            }
            if (OrchidModAlchemistHelper.containsAlchemistFlask(ItemType <Alchemist.Weapons.Nature.GlowingAttractiteFlask>(), player, modPlayer))
            {
                for (int i = 0; i < 5; i++)
                {
                    Vector2 vel        = (new Vector2(0f, -5f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))));
                    int     spawnProj  = ProjectileType <Alchemist.Projectiles.Nature.NatureSporeProj>();
                    int     spawnProj2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, dmg, 0f, player.whoAmI);
                    Main.projectile[spawnProj2].localAI[1] = 1f;
                }
                for (int i = 0; i < 2; i++)
                {
                    Vector2 vel       = (new Vector2(0f, (float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(180)));
                    int     spawnProj = ProjectileType <Alchemist.Projectiles.Nature.NatureSporeProjAlt>();
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, player.whoAmI);
                }
            }
        }
Exemplo n.º 16
0
        public override void Reaction(Player player, OrchidModPlayer modPlayer)
        {
            int itemType = ItemType <Alchemist.Weapons.Air.QueenBeeFlask>();
            int dmg      = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, 4, true);

            for (int i = 0; i < 10; i++)
            {
                Vector2 vel = (new Vector2(0f, -(float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(80)));
                if (player.strongBees && Main.rand.Next(2) == 0)
                {
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, 566, (int)(dmg * 1.15f), 0f, player.whoAmI);
                }
                else
                {
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, 181, dmg, 0f, player.whoAmI);
                }
            }
            for (int i = 0; i < 10; i++)
            {
                Vector2 vel       = (new Vector2(0f, (float)(3 + Main.rand.Next(4))).RotatedByRandom(MathHelper.ToRadians(80)));
                int     spawnProj = ProjectileType <Alchemist.Projectiles.Air.QueenBeeFlaskProj>();
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, spawnProj, 0, 0f, player.whoAmI);
            }
        }
Exemplo n.º 17
0
 public override void OnRespawn(Player player)
 {
     OrchidModAlchemistHelper.onRespawnAlchemist(player, this, mod);
     OrchidModShamanHelper.onRespawnShaman(player, this, mod);
     OrchidModGamblerHelper.onRespawnGambler(player, this);
 }
Exemplo n.º 18
0
 public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
 {
     OrchidModAlchemistHelper.onRespawnAlchemist(player, this, mod);
     OrchidModShamanHelper.onRespawnShaman(player, this, mod);
     OrchidModGamblerHelper.onRespawnGambler(player, this);
 }
Exemplo n.º 19
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            this.Left.Set(Main.screenWidth / 2, 0f);
            this.Top.Set(Main.screenHeight / 2, 0f);

            CalculatedStyle dimensions = GetDimensions();

            int width  = (int)Math.Ceiling(dimensions.Width);
            int height = (int)Math.Ceiling(dimensions.Height);

            int bookWidth      = 384;
            int bookHeight     = 544;
            int baseOffSetX    = 25;
            int baseOffSetY    = 12;
            int recipesPerPage = 13;

            Point point      = new Point((int)dimensions.X - (bookWidth / 2), (int)dimensions.Y - (bookHeight / 2));
            Point mousePoint = new Point((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y);

            Rectangle rectangleArrowLeft  = new Rectangle(point.X + 270, point.Y + 478, 36, 34);
            Rectangle rectangleArrowRight = new Rectangle(point.X + 326, point.Y + 478, 36, 34);

            Player          player    = Main.LocalPlayer;
            OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>();

            if (!player.dead)
            {
                if (modPlayer.alchemistBookUIDisplay)
                {
                    spriteBatch.Draw(ressourceBookPage, new Rectangle(point.X, point.Y, bookWidth, bookHeight), backgroundColor);

                    int    offSetY = baseOffSetY;
                    int    offSetX = baseOffSetX;
                    int    index   = 0;
                    string msg     = "";

                    Item item = null;

                    foreach (AlchemistHiddenReactionRecipe recipe in OrchidMod.alchemistReactionRecipes)
                    {
                        int  progression = OrchidModAlchemistHelper.getProgressLevel();
                        bool knownRecipe = modPlayer.alchemistKnownReactions.Contains(recipe.typeName);
                        bool knownHint   = modPlayer.alchemistKnownHints.Contains(recipe.typeName);
                        if (index < ((this.bookPageIndex * recipesPerPage) + recipesPerPage) && index >= (this.bookPageIndex * recipesPerPage) &&
                            (knownRecipe || knownHint || (progression >= recipe.level && recipe.level > 0)))
                        {
                            foreach (int ingredientID in recipe.ingredients)
                            {
                                if (knownRecipe || knownHint)
                                {
                                    Texture2D itemTexture = Main.itemTexture[ingredientID];
                                    spriteBatch.Draw(ressourceBookSlot, new Rectangle(point.X + offSetX, point.Y + offSetY, 36, 36), backgroundColor);
                                    Rectangle itemRectangle = new Rectangle(point.X + offSetX + 2, point.Y + offSetY + 2, 30, 30);
                                    spriteBatch.Draw(itemTexture, itemRectangle, knownRecipe ? backgroundColor : Color.Gray);
                                    if (itemRectangle.Contains(mousePoint) && this.bookPopupRecipe.typeName == "RecipeBlank")
                                    {
                                        item = new Item();
                                        item.SetDefaults(ingredientID);
                                    }
                                    Rectangle lineRectangle = new Rectangle(point.X, point.Y + offSetY + 2, bookWidth, 36);
                                    if (lineRectangle.Contains(mousePoint) && (Main.mouseLeft && Main.mouseLeftRelease) &&
                                        this.bookPopupRecipe.typeName == "RecipeBlank" && knownRecipe)
                                    {
                                        this.bookPopupRecipe = recipe;
                                        Main.PlaySound(10, (int)player.Center.X, (int)player.Center.Y, 0);
                                        this.drawpause = true;
                                    }
                                }
                                else
                                {
                                    spriteBatch.Draw(ressourceBookSlotEmpty, new Rectangle(point.X + offSetX, point.Y + offSetY, 36, 36), backgroundColor);
                                }
                                offSetX += 40;
                            }
                            msg = knownRecipe ? recipe.name : "Unknown Reaction";
                            Color textColor = knownRecipe ? backgroundColor : new Color(175, 175, 175);
                            ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, msg, new Vector2(point.X + offSetX, point.Y + offSetY + 7), textColor, 0f, Vector2.Zero, Vector2.One, -1f, 2f);
                            offSetX  = baseOffSetX;
                            offSetY += 35;
                        }
                        index += ((progression >= recipe.level && recipe.level > 0) || knownRecipe || knownHint) ? 1 : 0;
                    }

                    int maxPages = (int)(index / recipesPerPage);
                    if (this.bookPopupRecipe.typeName == "RecipeBlank")
                    {
                        if ((Main.mouseLeft && Main.mouseLeftRelease) && rectangleArrowLeft.Contains(mousePoint))
                        {
                            this.bookPageIndex -= this.bookPageIndex > 0 ? 1 : 0;
                            Main.PlaySound(10, (int)player.Center.X, (int)player.Center.Y, 0);
                        }

                        if ((Main.mouseLeft && Main.mouseLeftRelease) && rectangleArrowRight.Contains(mousePoint))
                        {
                            this.bookPageIndex += this.bookPageIndex < maxPages ? 1 : 0;
                            Main.PlaySound(10, (int)player.Center.X, (int)player.Center.Y, 0);
                        }
                    }
                    else
                    {
                        int offSetPopupX = 34;
                        int offSetPopupY = 158;
                        if ((Main.mouseLeft && Main.mouseLeftRelease) && !this.drawpause)
                        {
                            this.bookPopupRecipe = new Alchemist.Recipes.RecipeBlank();
                            Main.PlaySound(10, (int)player.Center.X, (int)player.Center.Y, 0);
                        }

                        spriteBatch.Draw(ressourceBookPopup, new Rectangle(point.X + offSetPopupX, point.Y + offSetPopupY, 318, 200), backgroundColor);
                        offSetX = 194;
                        int offSetPopup = 0;
                        offSetPopup = ((int)(40 * this.bookPopupRecipe.ingredients.Count / 2));
                        foreach (int ingredientID in this.bookPopupRecipe.ingredients)
                        {
                            Texture2D itemTexturePopup = Main.itemTexture[ingredientID];
                            spriteBatch.Draw(ressourceBookSlot, new Rectangle(point.X + offSetX - offSetPopup, point.Y + offSetPopupY + 16, 36, 36), backgroundColor);
                            Rectangle itemRectangle = new Rectangle(point.X + offSetX + 2 - offSetPopup, point.Y + offSetPopupY + 18, 30, 30);
                            spriteBatch.Draw(itemTexturePopup, itemRectangle, backgroundColor);
                            if (itemRectangle.Contains(mousePoint))
                            {
                                item = new Item();
                                item.SetDefaults(ingredientID);
                            }
                            offSetX += 40;
                        }
                        Vector2 textPos = new Vector2(point.X + offSetPopupX + 25, point.Y + offSetPopupY + 70);
                        msg = this.bookPopupRecipe.name;
                        ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, msg, textPos, backgroundColor, 0f, Vector2.Zero, Vector2.One, -1f, 2f);
                        msg        = this.bookPopupRecipe.description;
                        textPos.Y += 40;
                        textPos.X -= 12;
                        ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, msg, textPos, backgroundColor, 0f, Vector2.Zero, Vector2.One, -1f, 2f);
                    }

                    if (item != null)
                    {
                        ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, item.Name, Main.MouseScreen + new Vector2(15f, 15f), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f);
                    }

                    this.drawpause = this.drawpause ? Main.mouseLeftRelease : false;

                    msg = "Page " + (this.bookPageIndex + 1) + "/" + (maxPages + 1);
                    ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, msg, new Vector2(point.X + 282, point.Y + 508), backgroundColor, 0f, Vector2.Zero, Vector2.One, -1f, 2f);
                }
            }
        }
Exemplo n.º 20
0
        public void initializeAlchemistProjectile()
        {
            Player          player    = Main.player[projectile.owner];
            OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>();

            bool[] elements = modPlayer.alchemistElements;
            Item[] flasks   = modPlayer.alchemistFlasks;

            this.projOwner = (projectile.owner == Main.myPlayer);

            this.nbElements   = modPlayer.alchemistNbElements;
            projectile.damage = (int)(modPlayer.alchemistFlaskDamage * modPlayer.alchemistDamage + 5E-06f);

            if (elements[0])
            {
                this.waterFlask       = flasks[0];
                this.waterFlaskGlobal = this.waterFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            if (elements[1])
            {
                this.fireFlask       = flasks[1];
                this.fireFlaskGlobal = this.fireFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            if (elements[2])
            {
                this.natureFlask       = flasks[2];
                this.natureFlaskGlobal = this.natureFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            if (elements[3])
            {
                this.airFlask       = flasks[3];
                this.airFlaskGlobal = this.airFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            if (elements[4])
            {
                this.lightFlask       = flasks[4];
                this.lightFlaskGlobal = this.lightFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            if (elements[5])
            {
                this.darkFlask       = flasks[5];
                this.darkFlaskGlobal = this.darkFlask.GetGlobalItem <OrchidModGlobalItem>();
            }

            this.addVariousEffects();
            this.glowColor = new Color(modPlayer.alchemistColorR, modPlayer.alchemistColorG, modPlayer.alchemistColorB);

            modPlayer.alchemistFlaskDamage = 0;
            modPlayer.alchemistNbElements  = 0;
            OrchidModAlchemistHelper.clearAlchemistElements(player, modPlayer, mod);
            OrchidModAlchemistHelper.clearAlchemistFlasks(player, modPlayer, mod);
            OrchidModAlchemistHelper.clearAlchemistColors(player, modPlayer, mod);

            if (this.fireFlask.type == ItemType <GunpowderFlask>())
            {
                this.noCatalyticSpawn = true;
            }

            if (this.nbElements > 2)
            {
                if (modPlayer.alchemistMeteor)
                {
                    player.AddBuff((BuffType <Alchemist.Buffs.MeteorSpeed>()), 60 * 10);
                }
            }
        }
Exemplo n.º 21
0
        public void KillSecond(int timeLeft, Player player, OrchidModPlayer modPlayer)
        {
            if (this.fireFlaskGlobal != null)
            {
                fireFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.fireFlaskGlobal);
            }

            if (this.waterFlaskGlobal != null)
            {
                waterFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.waterFlaskGlobal);
            }

            if (this.natureFlaskGlobal != null)
            {
                natureFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.natureFlaskGlobal);
            }

            if (this.airFlaskGlobal != null)
            {
                airFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.airFlaskGlobal);
            }

            if (this.lightFlaskGlobal != null)
            {
                lightFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.lightFlaskGlobal);
            }

            if (this.darkFlaskGlobal != null)
            {
                darkFlaskGlobal.killSecondDelegate(timeLeft, player, modPlayer, this, projectile, this.darkFlaskGlobal);
            }

            if (this.nbElements > 2 && player.HasBuff(BuffType <Alchemist.Buffs.QueenBeeFlaskBuff>()))
            {
                int itemType = ItemType <QueenBeeFlask>();
                int dmg      = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, this.nbElements, true);
                int rand     = this.nbElements + Main.rand.Next(3);
                for (int i = 0; i < rand; i++)
                {
                    Vector2 vel = (new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(80)));
                    if (player.strongBees && Main.rand.Next(2) == 0)
                    {
                        Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, 566, (int)(dmg * 1.15f), 0f, player.whoAmI, 0f, 0f);
                    }
                    else
                    {
                        Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, 181, dmg, 0f, player.whoAmI, 0f, 0f);
                    }
                }
            }

            if (player.HasBuff(BuffType <Alchemist.Buffs.SpiritedWaterBuff>()))
            {
                int spawnProj = ProjectileType <Alchemist.Projectiles.Water.DungeonFlaskProj>();
                int itemType  = ItemType <DungeonFlask>();
                int dmg       = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, itemType, this.nbElements, true);
                for (int i = 0; i < this.nbElements; i++)
                {
                    Vector2 vel = (new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(180)));
                    Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel.X, vel.Y, spawnProj, dmg, 0f, projectile.owner);
                }
            }
        }