Exemplo n.º 1
0
        // The following method follows vanilla principles view MharadiumHandling.cs for extra information

        public override void Update(Player player, ref int buffIndex)
        {
            MharadiumModPlayer modPlayer = (MharadiumModPlayer)player.GetModPlayer(mod, "MharadiumModPlayer");

            modPlayer.onMharadiumFire = true;

            if (player.wet)
            {
                player.buffTime[buffIndex] = 2;
            }
        }
        // The following method follows vanilla principles view MharadiumHandling.cs for extra information

        public override void Update(Player player, ref int buffIndex)
        {
            MharadiumModPlayer modPlayer = (MharadiumModPlayer)player.GetModPlayer(mod, "MharadiumModPlayer");

            modPlayer.hasSuperPowers  = true;
            modPlayer.drawSuperPowers = true;
            player.paladinGive        = true; // needed for paladin buff

            // Ice Barrier
            if ((double)player.statLife <= (double)player.statLifeMax2 * 0.5)
            {
                Lighting.AddLight((int)((double)player.Center.X / 16.0), (int)((double)player.Center.Y / 16.0), 0.1f, 0.2f, 0.45f);
                player.iceBarrier = true;
                player.endurance += 0.25f;
                ++player.iceBarrierFrameCounter;
                if ((int)player.iceBarrierFrameCounter > 2)
                {
                    player.iceBarrierFrameCounter = (byte)0;
                    ++player.iceBarrierFrame;
                    if ((int)player.iceBarrierFrame >= 12)
                    {
                        player.iceBarrierFrame = (byte)0;
                    }
                }
            }
            // this is used by ice barrier, but we aren't adding the ice barrier buff!

            /*else
             * {
             *  player.DelBuff(buffIndex);
             *  --buffIndex;
             * }*/

            player.buffImmune[BuffID.Lifeforce] = true;
            for (int i = 71; i < 79; i++)
            {
                player.buffImmune[i] = true;
            }
            player.buffImmune[BuffID.Inferno]        = true;
            player.buffImmune[BuffID.MagicPower]     = true;
            player.buffImmune[BuffID.Clairvoyance]   = true;
            player.buffImmune[BuffID.PaladinsShield] = true;
            player.buffImmune[BuffID.IceBarrier]     = true;
        }
Exemplo n.º 3
0
        public override void Update(Player player, ref int buffIndex)
        {
            player.buffTime[buffIndex] = 18000;
            int buffNewType = mod.ProjectileType("BabyCrimera");

            // we use a ModPlayer instead of player.eater (bool)
            MharadiumModPlayer modPlayer = (MharadiumModPlayer)player.GetModPlayer(mod, "MharadiumModPlayer");

            modPlayer.babycrimera = true;

            bool flag = true;

            if (player.ownedProjectileCounts[mod.ProjectileType("BabyCrimera")] > 0) // already has a babycrimera
            {
                flag = false;
            }

            if (flag && player.whoAmI == Main.myPlayer)
            {
                Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0.0f, 0.0f, buffNewType, 0, 0.0f, player.whoAmI, 0.0f, 0.0f);
            }
        }
Exemplo n.º 4
0
        public override void AI()
        {
            // kill pet if plr is dead
            Player             player    = Main.player[projectile.owner];
            MharadiumModPlayer modPlayer = (MharadiumModPlayer)player.GetModPlayer(mod, "MharadiumModPlayer");

            if (player.dead)
            {
                modPlayer.babycrimera = false;
            }
            if (modPlayer.babycrimera)
            {
                projectile.timeLeft = 2;
            }


            // calculate movement in ai
            float num2 = 0.1f;

            projectile.tileCollide = false;
            int     num3      = 300;
            Vector2 vector2_1 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
            float   num4      = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2_1.X;
            float   num5      = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2_1.Y;

            if (projectile.type == (int)sbyte.MaxValue)
            {
                num5 = Main.player[projectile.owner].position.Y - vector2_1.Y;
            }
            float num6 = (float)Math.Sqrt((double)num4 * (double)num4 + (double)num5 * (double)num5);
            float num7 = 7f;

            if ((double)num6 < (double)num3 && (double)Main.player[projectile.owner].velocity.Y == 0.0 && ((double)projectile.position.Y + (double)projectile.height <= (double)Main.player[projectile.owner].position.Y + (double)Main.player[projectile.owner].height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)))
            {
                projectile.ai[0] = 0.0f;
                if ((double)projectile.velocity.Y < -6.0)
                {
                    projectile.velocity.Y = -6f;
                }
            }
            if ((double)num6 < 150.0)
            {
                if ((double)Math.Abs(projectile.velocity.X) > 2.0 || (double)Math.Abs(projectile.velocity.Y) > 2.0)
                {
                    Projectile proj      = projectile;
                    Vector2    vector2_2 = proj.velocity * 0.99f;
                    proj.velocity = vector2_2;
                }
                num2 = 0.01f;
                if ((double)num4 < -2.0)
                {
                    num4 = -2f;
                }
                if ((double)num4 > 2.0)
                {
                    num4 = 2f;
                }
                if ((double)num5 < -2.0)
                {
                    num5 = -2f;
                }
                if ((double)num5 > 2.0)
                {
                    num5 = 2f;
                }
            }
            else
            {
                if ((double)num6 > 300.0)
                {
                    num2 = 0.2f;
                }
                float num8 = num7 / num6;
                num4 *= num8;
                num5 *= num8;
            }
            if ((double)Math.Abs(num4) > (double)Math.Abs(num5) || (double)num2 == 0.0500000007450581)
            {
                if ((double)projectile.velocity.X < (double)num4)
                {
                    projectile.velocity.X = projectile.velocity.X + num2;
                    if ((double)num2 > 0.0500000007450581 && (double)projectile.velocity.X < 0.0)
                    {
                        projectile.velocity.X = projectile.velocity.X + num2;
                    }
                }
                if ((double)projectile.velocity.X > (double)num4)
                {
                    projectile.velocity.X = projectile.velocity.X - num2;
                    if ((double)num2 > 0.0500000007450581 && (double)projectile.velocity.X > 0.0)
                    {
                        projectile.velocity.X = projectile.velocity.X - num2;
                    }
                }
            }
            if ((double)Math.Abs(num4) <= (double)Math.Abs(num5) || (double)num2 == 0.0500000007450581)
            {
                if ((double)projectile.velocity.Y < (double)num5)
                {
                    projectile.velocity.Y = projectile.velocity.Y + num2;
                    if ((double)num2 > 0.0500000007450581 && (double)projectile.velocity.Y < 0.0)
                    {
                        projectile.velocity.Y = projectile.velocity.Y + num2;
                    }
                }
                if ((double)projectile.velocity.Y > (double)num5)
                {
                    projectile.velocity.Y = projectile.velocity.Y - num2;
                    if ((double)num2 > 0.0500000007450581 && (double)projectile.velocity.Y > 0.0)
                    {
                        projectile.velocity.Y = projectile.velocity.Y - num2;
                    }
                }
            }
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f;
            ++projectile.frameCounter;
            if (projectile.frameCounter > 6)
            {
                ++projectile.frame;
                projectile.frameCounter = 0;
            }
            if (projectile.frame <= 1)
            {
                return;
            }
            projectile.frame = 0;
        }