示例#1
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.Shatter, projectile.Center);

            int radius = 100;

            float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 8; i++)
            {
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.CrimsonSpray, 0, 0, Main.myPlayer);
            }

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + projectile.Center.X / 16.0f);
                    int yPosition = (int)(y + projectile.Center.Y / 16.0f);

                    // Circle
                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)
                    {
                        WorldGen.Convert(xPosition, yPosition, 4, 1); // Convert to crimson
                    }
                }
            }
        }
示例#2
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Shatter, (int)position.X, (int)position.Y);

            float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 8; i++)
            {
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.HallowSpray, 0, 0, Main.myPlayer);
            }

            for (int x = -Main.maxTilesX; x < Main.maxTilesX; x++)
            {
                for (int y = -Main.maxTilesY; y < Main.maxTilesY; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    WorldGen.Convert(xPosition, yPosition, 2, 1); // convert to hallow
                }
            }
        }
示例#3
0
        public override void RandomUpdate(int i, int j)//grappling hook breaks the grass, its running killtile for some reason?
        {
            int x = Main.rand.Next(-4, 4);
            int y = Main.rand.Next(-4, 4);

            if (Main.tile[i + x, j + y].active() && Main.hardMode)//spread, using the clentaminator method
            {
                WorldGen.Convert(i + x, j + y, 1, 1);
            }

            if (!Main.tile[i, j + 1].active() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick())//vines
            {
                WorldGen.PlaceTile(i, j + 1, TileType <VineJungleCorrupt>(), true);
            }

            if (!Main.tile[i, j - 1].active() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick())//grass
            {
                if (Main.rand.Next(2) == 0)
                {
                    WorldGen.PlaceTile(i, j - 1, TileType <TallgrassJungleCorrupt>(), true);
                    Main.tile[i, j - 1].frameY = (short)(Main.rand.Next(9) * 18);
                }
            }

            if (!Main.tile[i, j - 1].active() && !Main.tile[i, j - 2].active() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick())//double grass
            {
                if (Main.rand.Next(4) == 0)
                {
                    WorldGen.PlaceTile(i, j - 2, TileType <TallgrassJungleCorrupt2>(), true);
                    int rand = Main.rand.Next(6);
                    Main.tile[i, j - 1].frameY = (short)(rand * 36);
                    Main.tile[i, j - 2].frameY = (short)(18 + rand * 36);
                }
            }
        }
        public override void Kill(int timeLeft)
        {
            #region Updated WorldGen Convert
            Vector2 position = projectile.Center;
            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            int radius = 120;
            //float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            //float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 58; i++)
            {
                float speedX = Main.rand.NextFloat(-12, 12);
                float speedY = Main.rand.NextFloat(-10, 10);
                //Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.PureSpray, 0, 0, Main.myPlayer);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 45, speedX, speedY, 100, new Color(), 1.5f);
            }

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)     //circle
                    {
                        WorldGen.Convert(xPosition, yPosition, 3, 1); // convert to mushroom
                    }
                }
            }
            #endregion
        }
示例#5
0
        public override void Explosion()
        {
            Vector2 position = projectile.Center;
            int     width    = 250;            //Explosion Width
            int     height   = Main.maxTilesY; //Explosion Height

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            for (int x = -width; x < width; x++)
            {
                for (int y = -120; y <= height; y++)
                {
                    int i = (int)(x + position.X / 16.0f);
                    int j = (int)(y + position.Y / 16.0f);

                    if (WorldGen.InWorld(i, j))
                    {
                        WorldGen.Convert(i, j, 0, 2);
                        //NetMessage.SendTileSquare(-1, i, j, 1);
                    }
                }
            }
        }
示例#6
0
        public override void Update()
        {
            int i = Position.X + Main.rand.Next(-range, range + 1);
            int j = Position.Y + Main.rand.Next(-range, range + 1);

            WorldGen.Convert(i, j, 0, 0);
        }
示例#7
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Shatter, (int)position.X, (int)position.Y);

            int radius = 100;

            float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 8; i++)
            {
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.PureSpray, 0, 0, Main.myPlayer);
            }

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)     //circle
                    {
                        WorldGen.Convert(xPosition, yPosition, 0, 1); // convert to purity
                        //WorldGen.Convert(xPosition, yPosition, 1, 1); // convert to corrupt
                        //WorldGen.Convert(xPosition, yPosition, 2, 1); // convert to hallow
                        //WorldGen.Convert(xPosition, yPosition, 3, 1); // convert to mushroom
                        //WorldGen.Convert(xPosition, yPosition, 4, 1); // convert to crimson
                    }
                }
            }
        }
示例#8
0
 public override bool OnTileCollide(Projectile projectile, Vector2 oldVelocity)
 {
     if (projectile.type == 94 && projectile.localAI[0] == 100)
     {
         WorldGen.Convert((int)(projectile.position.X + (float)(projectile.width / 2)) / 16, (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16, 2, 2);
     }
     return(base.OnTileCollide(projectile, oldVelocity));
 }
示例#9
0
        public static void ClentaminatorAI(Projectile projectile, int conversionType, int dustType, Color color)
        {
            if (projectile.owner == Main.myPlayer)
            {
                WorldGen.Convert((int)(projectile.Center.X) / 16, (int)(projectile.Center.Y) / 16, conversionType, 2);
            }
            if (projectile.timeLeft > 133)
            {
                projectile.timeLeft = 133;
            }
            if (projectile.ai[0] > 7f)
            {
                float scale = 1f;
                switch (projectile.ai[0])
                {
                case 8f:
                    scale = 0.2f;
                    break;

                case 9f:
                    scale = 0.4f;
                    break;

                case 10f:
                    scale = 0.6f;
                    break;

                case 11f:
                    scale = 0.8f;
                    break;
                }
                projectile.ai[0]++;
                for (int num354 = 0; num354 < 1; num354++)
                {
                    int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, color);
                    Main.dust[d].noGravity = true;
                    Dust dust1 = Main.dust[d];
                    Dust dust2 = dust1;
                    dust2.scale             *= 1.75f;
                    Main.dust[d].velocity.X *= 2f;
                    Main.dust[d].velocity.Y *= 2f;
                    dust1        = Main.dust[d];
                    dust2        = dust1;
                    dust2.scale *= scale;
                }
            }
            else
            {
                projectile.ai[0]++;
            }
            projectile.rotation += 0.3f * projectile.direction;
        }
示例#10
0
 public override void Kill(Projectile projectile, int timeLeft)
 {
     if (projectile.type == 4 && projectile.knockBack == 5.12345f)
     {
         int p = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X / 2, projectile.velocity.Y / 2, 11, 0, 0, projectile.owner);
         WorldGen.Convert((int)(projectile.position.X + (float)(projectile.width / 2)) / 16, (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16, 1, 2);
         projectile.noDropItem = true;
     }
     if (projectile.type == 12 && projectile.damage <= 500 && projectile.localAI[1] == 1)
     {
         Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, 75, 1, false, 0, false, false);
     }
 }
示例#11
0
 public override void RandomUpdate(int i, int j)
 {
     for (int x = -5; x <= 5; x++)
     {
         for (int y = -5; y <= 5; y++)
         {
             WorldGen.Convert(i + x, j + y, 0, 0);
             Tile tile = Main.tile[i + x, j + y];
             if (tile.active() && (tile.type == TileID.Demonite || tile.type == TileID.Crimtane) && Main.rand.Next(3) == 0)
             {
                 tile.type = (ushort)mod.TileType("PuriumOre");
                 NetMessage.SendTileRange(Main.myPlayer, i + x, j + y, 1, 1);
             }
         }
     }
 }
示例#12
0
        public override void Kill(int timeLeft)
        {
            SoundEngine.PlaySound(SoundID.Shatter, Projectile.Center);

            int radius = 150;

            float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 8; i++)
            {
                Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX[i], speedY[i], projType, 0, 0, Main.myPlayer);
            }

            if (supreme)
            {
                for (int x = -Main.maxTilesX; x < Main.maxTilesX; x++)
                {
                    for (int y = -Main.maxTilesY; y < Main.maxTilesY; y++)
                    {
                        int xPosition = (int)(x + Projectile.Center.X / 16.0f);
                        int yPosition = (int)(y + Projectile.Center.Y / 16.0f);

                        WorldGen.Convert(xPosition, yPosition, convertType, 1);
                    }
                }
            }
            else
            {
                for (int x = -radius; x <= radius; x++)
                {
                    for (int y = -radius; y <= radius; y++)
                    {
                        int xPosition = (int)(x + Projectile.Center.X / 16.0f);
                        int yPosition = (int)(y + Projectile.Center.Y / 16.0f);

                        // Circle
                        if (Math.Sqrt(x * x + y * y) <= radius + 0.5)
                        {
                            WorldGen.Convert(xPosition, yPosition, convertType, 1);
                        }
                    }
                }
            }
        }
示例#13
0
文件: RPG.cs 项目: Geodew/RPGClasses
        //zzz this should be in MPlayer
        public void ActiveAbilityStart(MPlayer mplayer)
        {
            Player player = mplayer.player;

            if (mplayer.knight)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 600);
                int damage = 6;
                int count  = mplayer.specialProgressionCount;
                int projectileType;
                if (count <= 5)
                {
                    damage        += 2 * count;
                    projectileType = ProjectileType <Projectiles.Shield1>();
                }
                else if (count <= 9)
                {
                    damage        += 3 * count;
                    projectileType = ProjectileType <Projectiles.Shield2>();
                }
                else if (count <= 12)
                {
                    damage        += 5 * count;
                    projectileType = ProjectileType <Projectiles.Shield3>();
                }
                else
                {
                    damage        += 7 * count;
                    projectileType = ProjectileType <Projectiles.Shield3>();
                }
                float num11 = damage * player.meleeDamage + player.statDefense;
                int   p     = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0, 0, projectileType, (int)num11, 10, player.whoAmI);
            }
            else if (mplayer.fortress)
            {
                player.AddBuff(BuffID.Stoned, 240);
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
            }
            else if (mplayer.warmage)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                mplayer.specialTimer = 600;
            }
            else if (mplayer.harpy)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 240);
                Main.PlaySound(2, player.position, 32);
                int   damage = 11;
                int   count  = mplayer.specialProgressionCount;
                float scalar = 1f + (float)Math.Pow(count, 1.75) / 7;
                damage = (int)(damage * Math.Max(player.thrownDamage, player.rangedDamage) * scalar);
                Vector2 vel = Main.MouseWorld - player.position;
                vel.Normalize();
                vel *= 11 + count / 2;
                for (int i = 0; i < 3 + count / 3; i++)
                {
                    int p = Projectile.NewProjectile(player.position.X, player.position.Y, vel.X + Main.rand.Next(-20, 21) / 6, vel.Y + Main.rand.Next(-20, 21) / 6, ProjectileID.HarpyFeather, damage, 3, player.whoAmI);
                    Main.projectile[p].friendly = true;
                    Main.projectile[p].hostile  = false;
                    Main.projectile[p].ranged   = true;
                }
                Main.PlaySound(2, player.position, 32);
            }
            else if (mplayer.spiritMage)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                int minionsKilled = 0;
                for (int i = 0; i < 1000; i++)
                {
                    if (Main.projectile[i].minion && Main.projectile[i].owner == Main.myPlayer)
                    {
                        for (int j = 0; j < 20; j++)
                        {
                            int dust = Dust.NewDust(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 15);
                            Main.dust[dust].velocity.Normalize();
                            Main.dust[dust].velocity *= 3.0f;

                            SpawnDustNetMsg.SerializeAndSendPlayer(
                                this,
                                player.whoAmI,
                                15,
                                true,
                                true,
                                3.0f);
                        }
                        Main.projectile[i].Kill();
                        minionsKilled++;
                    }
                }
                mplayer.specialTimer = 480;
                mplayer.special2     = minionsKilled;
            }
            else if (mplayer.demon)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 20);
                for (int i = 0; i < 1000; i++)
                {
                    if (Main.projectile[i].type == ProjectileType <Projectiles.Demon>() && Main.projectile[i].owner == Main.myPlayer && !Main.projectile[i].tileCollide && Main.projectile[i].active)
                    {
                        Vector2 vel = Main.MouseWorld - Main.projectile[i].position;
                        vel.Normalize();
                        vel *= 10 + mplayer.specialProgressionCount / 2;
                        Main.projectile[i].velocity  = vel;
                        Main.projectile[i].alpha     = 150;
                        Main.projectile[i].friendly  = true;
                        Main.projectile[i].netUpdate = true;
                        Main.PlaySound(2, player.position, 8);
                        mplayer.special--;
                        break;
                    }
                }
            }
            else if (mplayer.werewolf)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 10800);
                Main.PlaySound(3, player.position, 6);
                mplayer.specialTimer = 3600;
            }
            else if (mplayer.sage)
            {
                if (player.statManaMax >= 20)
                {
                    mplayer.specialTimer = 3;

                    if ((Main.myPlayer == player.whoAmI) && (mplayer.special == 119))
                    {
                        Main.PlaySound(25, -1, -1, 1);
                        for (int i = 0; i < 5; i++)
                        {
                            int num3 = Dust.NewDust(player.position, player.width, player.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
                            Main.dust[num3].noLight   = true;
                            Main.dust[num3].noGravity = true;
                            Main.dust[num3].velocity *= 0.5f;

                            //zzz net sync needed for Dust
                        }
                    }
                }
            }
            else if (mplayer.dragoon)
            {
                mplayer.specialTimer = 3;

                if ((Main.myPlayer == player.whoAmI) && (mplayer.special == 119))
                {
                    Main.PlaySound(25, -1, -1, 1);
                    for (int i = 0; i < 5; i++)
                    {
                        int num3 = Dust.NewDust(player.position, player.width, player.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
                        Main.dust[num3].noLight   = true;
                        Main.dust[num3].noGravity = true;
                        Main.dust[num3].velocity *= 0.5f;

                        //zzz net sync needed for Dust
                    }
                }
            }
            else if (mplayer.soulbound)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1500);
                mplayer.specialTimer = 600;
                if (Main.expertMode)
                {
                    // Terraria code automatically doubles the duration of Cursed debuffs, but we want it to be exactly 10 seconds, so say 5 instead.
                    player.AddBuff(BuffID.Cursed, 300);
                }
                else
                {
                    player.AddBuff(BuffID.Cursed, 600);
                }
            }
            else if (mplayer.ninja)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 900);
                Vector2 vel = Main.MouseWorld - player.Center;
                vel.Normalize();
                vel *= 11;
                int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, ProjectileType <Projectiles.DeathMark>(), 1, 0, player.whoAmI);
                Main.PlaySound(2, player.position, 19);
            }
            else if (mplayer.merman)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600 * 8);
                Main.raining       = true;
                Main.cloudBGActive = 1;
                Main.cloudBGAlpha  = 255;
                Main.maxRaining    = 1;
                Main.rainTime      = 3600 * 4;
            }
            else if (mplayer.cavalry)
            {
                mplayer.specialTimer = 60;
                player.velocity.X   += (14 + mplayer.specialProgressionCount) * player.direction;
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 600);
            }
            else if (mplayer.pirate)
            {
                bool flag = (player.position.X <850 * 16 || player.position.X> (Main.maxTilesX - 850) * 16) && player.position.Y < Main.worldSurface * 16;
                if (flag)
                {
                    player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                    int   damage = 30;
                    int   count  = mplayer.specialProgressionCount;
                    float scalar = 1f + (float)Math.Pow(count, 1.65) / 6;
                    damage = (int)(player.rangedDamage * damage * scalar);
                    int     direction = (player.position.X < 850 * 16) ? 1 : -1;
                    Vector2 soundPos  = new Vector2(player.position.X - 1000 * direction);
                    Main.PlaySound(2, soundPos, 38);
                    float posX = Main.MouseWorld.X - 1220 * direction;
                    float posY = Main.MouseWorld.Y - 3000;
                    for (int i = 0; i < 3 + count / 2; i++)
                    {
                        int p = Projectile.NewProjectile(posX + Main.rand.Next(-150, 151), posY + Main.rand.Next(-150, 151), 12 * direction, 0, 162, damage, 8, player.whoAmI);
                    }
                }
                else
                {
                    player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 18000);
                    player.AddBuff(BuffType <Buffs.RumDrunk>(), 7200);
                    Main.PlaySound(2, player.position, 3);
                }
            }
            else if (mplayer.pharaoh)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 14400);
                mplayer.specialTimer = 1800;
                if (player.ZoneDesert || player.ZoneUndergroundDesert)
                {
                    mplayer.special2 = 1;  // Get bigger bonuses
                }
            }
            else if (mplayer.arcaneSniper)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                mplayer.specialTimer = 600;
                mplayer.special2     = 1 + mplayer.specialProgressionCount / 4; // Number of empowered shots
            }
            else if (mplayer.hallowMage)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                mplayer.specialTimer = 25 + mplayer.specialProgressionCount * 8;
            }
            else if (mplayer.explorer)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                player.TeleportationPotion();
            }
            else if (mplayer.taintedElf)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                mplayer.specialTimer = 600;
            }
            else if (mplayer.bloodKnight)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600);
                WorldGen.Convert((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 4, 30);
                int   damage = 25;
                int   count  = mplayer.specialProgressionCount;
                float scalar = 1f + (float)Math.Pow(count, 1.6) / 6;
                damage = (int)(player.meleeDamage * damage * scalar);
                Main.PlaySound(41, player.position);
                DamageArea(player.Center, 150, damage, 10);//set damage progression
                for (int j = 0; j < 50; j++)
                {
                    int dust = Dust.NewDust(player.position, player.width, player.height, 90);
                    Main.dust[dust].velocity.Normalize();
                    Main.dust[dust].velocity *= 16.0f;
                    Main.dust[dust].noGravity = true;

                    SpawnDustNetMsg.SerializeAndSendPlayer(
                        this,
                        player.whoAmI,
                        90,
                        true,
                        true,
                        16.0f);
                }
            }
            else if (mplayer.wanderer)
            {
                if (mplayer.special3 > 0)
                {
                    player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 60);
                    int p = Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0, 0, ProjectileType <Projectiles.WandererPortal>(), 0, 0, Main.myPlayer);
                    mplayer.special++;
                    for (int i = 0; i < 1000; i++)
                    {
                        if (Main.projectile[i].type == ProjectileType <Projectiles.WandererCharge>() && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].ai[1] == mplayer.special3)
                        {
                            Main.projectile[i].Kill();
                            break;
                        }
                    }
                }
            }
            else if (mplayer.angel)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 7200);
                mplayer.specialTimer = 600;
            }
            else if (mplayer.marksman)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 5400);
                mplayer.specialTimer = 600;
                player.AddBuff(BuffID.NightOwl, 600);
            }
            else if (mplayer.ranger)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600);
                mplayer.specialTimer = 300;
            }
            else if (mplayer.dwarf)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600 * 6);
                player.AddBuff(BuffType <Buffs.DwarvenStout>(), 7200);
                Main.PlaySound(2, player.position, 3);
            }
            else if (mplayer.savage)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 7200);
                mplayer.specialTimer = 900;
                if (Main.expertMode)
                {
                    player.AddBuff(BuffID.Bleeding, 450);
                }
                else
                {
                    player.AddBuff(BuffID.Bleeding, 900);
                }
                player.Hurt(new Terraria.DataStructures.PlayerDeathReason(), 1, 0);
            }
            else if (mplayer.berserker)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 7200);
                player.AddBuff(BuffID.Battle, 1200);
                mplayer.specialTimer = 1200;
            }
            else if (mplayer.chronomancer)
            {
                if (mplayer.specialTimer <= 0)
                {
                    player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 120);
                    mplayer.specialTimer = 600;
                    int p = Projectile.NewProjectile(player.position.X, player.position.Y, 0, 0, ProjectileType <Projectiles.ChronoGhost>(), 0, 0, player.whoAmI);
                    mplayer.special2 = p;
                    mplayer.special  = player.statLife;
                }
                else
                {
                    player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600);
                    Projectile proj = Main.projectile[mplayer.special2];
                    player.Teleport(proj.position);
                    float scalar = 1.0f + (float)Math.Pow(mplayer.specialProgressionCount, 1.7) / 4.0f;
                    float damage = 48.0f * scalar * player.magicDamage * (1.0f + player.magicCrit / 100.0f);
                    DamageArea(proj.Center, 256, (int)damage, 15);
                    for (int i = 1; i < 5; i++)
                    {
                        float velocityScalar = 2.5f * i;

                        for (int j = 0; j < (15 * i); j++)
                        {
                            //zzz This loop doesn't depend on j. What's the point of generating multiple Dust objects on top of each other?
                            //    Was velocityScalar supposed to scale with j instead of i, perhaps?
                            int d = Dust.NewDust(proj.Center, proj.width, proj.height, 15);
                            Main.dust[d].velocity.Normalize();
                            Main.dust[d].velocity *= velocityScalar;

                            SpawnDustNetMsg.SerializeAndSendProjectile(
                                this,
                                proj.whoAmI,
                                15,
                                true,
                                true,
                                velocityScalar);
                        }
                    }
                    if (player.statLife < mplayer.special)
                    {
                        int healAmount = mplayer.special - player.statLife;
                        player.HealEffect(healAmount);
                        player.statLife = mplayer.special;

                        HealPlayerNetMsg.SerializeAndSend(
                            this,
                            player.whoAmI,
                            healAmount);
                    }
                    proj.Kill();
                }
            }
            else if (mplayer.contractedSword)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                float scalar = 1.0f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 7.0f;
                float damage = 18.0f * scalar * (player.meleeDamage + player.minionDamage - 1.5f);
                Projectile.NewProjectile(player.position.X, player.position.Y, 8 * player.direction, 0, ProjectileType <Projectiles.SpiritKnight>(), (int)damage, 10, player.whoAmI);
            }
            else if (mplayer.angler)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                Vector2 vel = Main.MouseWorld - player.Center;
                vel.Normalize();
                vel *= 9;
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, ProjectileType <Projectiles.AnglerChum>(), 1, 0, player.whoAmI);
            }
            else if (mplayer.conjuror)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 600);
                float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                float damage = 3 * scalar * (player.minionDamage);
                Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0, 0, ProjectileType <Projectiles.ConjurorCrystal>(), (int)damage, 0, player.whoAmI);
            }
            else if (mplayer.celestial)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 180);
                if (mplayer.special == 0)
                {
                    mplayer.special = 1;
                }
                else
                {
                    mplayer.special = 0;
                }
            }
            else if (mplayer.voidwalker)
            {
                int cost = 15 + 20 * mplayer.special2;
                if (player.statMana < cost)
                {
                    return;
                }
                Vector2 vector15;
                vector15.X = (float)Main.mouseX + Main.screenPosition.X;
                if (player.gravDir == 1f)
                {
                    vector15.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height;
                }
                else
                {
                    vector15.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
                }

                // Reduce to max teleport distance
                float dist    = Vector2.Distance(vector15, player.Center);
                float maxDist = 200 + 50 * mplayer.specialProgressionCount;
                if (dist > maxDist)
                {
                    Vector2 toMouse = Main.MouseWorld - player.Center;
                    toMouse.Normalize();
                    toMouse  *= (dist - maxDist);
                    vector15 -= toMouse;
                }
                vector15.X += player.width / 2f;
                vector15.Y += player.height / 2f;
                if (vector15.X > 50f && vector15.X < (float)(Main.maxTilesX * 16 - 50) && vector15.Y > 50f && vector15.Y < (float)(Main.maxTilesY * 16 - 50))
                {
                    int num260 = (int)(vector15.X / 16f);
                    int num261 = (int)(vector15.Y / 16f);
                    if (((Main.tile[num260, num261].wall != WallID.LihzahrdBrickUnsafe) || ((double)num261 <= Main.worldSurface) || NPC.downedPlantBoss) &&  // Don't allow teleport inside the Jungle Temple unless the player should have a Temple Key by now (Plantera defeated)
                        !Collision.SolidCollision(vector15, player.width, player.height))
                    {
                        player.Teleport(vector15, 1, 0);
                        NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, vector15.X, vector15.Y, 1, 0, 0);

                        player.statMana      -= cost;
                        player.manaRegenDelay = 90;
                        mplayer.special2++;
                        player.AddBuff(BuffType <Buffs.ActiveCooldown>(), Math.Max(480 - mplayer.specialProgressionCount * 30, 60));
                        player.AddBuff(BuffID.ChaosState, 600);
                        mplayer.specialTimer = 600;
                        if (mplayer.special2 > 3)
                        {
                            int selfDam = Math.Min(player.statLifeMax / 20 * (mplayer.special2 - 3), player.statLifeMax / 5);
                            player.statLife -= selfDam;
                            CombatText.NewText(player.getRect(), Color.OrangeRed, selfDam.ToString());
                            player.lifeRegenTime  = 0;
                            player.lifeRegenCount = 0;
                            if (player.statLife <= 0)
                            {
                                player.KillMe(new Terraria.DataStructures.PlayerDeathReason(), 1.0, 0);
                            }
                        }

                        // Deal area damage
                        float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                        float damage = 14 * scalar * Math.Max(player.magicDamage, player.meleeDamage) * Math.Max(1 + player.magicCrit / 100f, 1 + player.meleeCrit / 100f) * (1 + mplayer.special2 / 3f);
                        DamageArea(vector15, 144, (int)damage, 3);

                        // Visuals
                        for (int i = 0; i < 30; i++)
                        {
                            int d = Dust.NewDust(vector15, 1, 1, 27);
                            Main.dust[d].velocity *= 4.0f;

                            SpawnDustNetMsg.SerializeAndSendPosition(
                                this,
                                vector15,
                                27,
                                true,
                                false,
                                4.0f);
                        }
                    }
                }
            }
            else if (mplayer.moth)
            {
                if (mplayer.special == 0)
                {
                    mplayer.special = 1;
                }
                else
                {
                    mplayer.special = 0;
                }
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 180);
            }
            else if (mplayer.monk)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 600);
                float   scalar  = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.7) / 6;
                float   dam     = 18 * scalar * player.meleeDamage;
                Vector2 toMouse = Main.MouseWorld - player.Center;
                toMouse.Normalize();
                toMouse *= 4;
                //toMouse += player.velocity;
                int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, toMouse.X, toMouse.Y, ProjectileType <Projectiles.MonkPalm>(), (int)dam, 0, player.whoAmI);
            }
            else if (mplayer.warpKnight)
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 900 - mplayer.specialProgressionCount * 30);
                float   scalar  = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                float   dam     = 18 * scalar * player.meleeDamage;
                Vector2 toMouse = Main.MouseWorld - player.Center;
                toMouse.Normalize();
                toMouse *= 11;
                int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, toMouse.X, toMouse.Y, ProjectileType <Projectiles.WarpBolt>(), (int)dam, 0, player.whoAmI);
            }
            else if (mplayer.heritor)
            {
                if (mplayer.special == 0)
                {
                    //reset between uses
                    if (mplayer.special3 == -1)
                    {
                        mplayer.special3 = 0;
                    }
                    if (mplayer.special3 == 0)
                    {
                        player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 60);
                        //begin cycle, exclude special2
                        mplayer.special3 = 540;
                    }
                    else
                    {
                        mplayer.special      = mplayer.special4;
                        mplayer.special3     = -1;
                        mplayer.specialTimer = 1800;
                        player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 1800);
                    }
                }
            }
            else
            {
                player.AddBuff(BuffType <Buffs.ActiveCooldown>(), 3600);
                player.statLife += 30 + mplayer.specialProgressionCount * 5;
                player.HealEffect(30 + mplayer.specialProgressionCount * 5);
            }
        }
示例#14
0
        public override void Kill(int timeLeft)
        {
            #region Original
            //Vector2 position = projectile.Center;
            //Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
            //int radius = 120;     //this is the explosion radius, the highter is the value the bigger is the explosion

            //for (int x = -radius; x <= radius; x++)
            //{
            //    for (int y = -radius; y <= radius; y++)
            //    {
            //        int xPosition = (int)(x + position.X / 16.0f);
            //        int yPosition = (int)(y + position.Y / 16.0f);

            //        if (Math.Sqrt(x * x + y * y) <= radius + 0.5)   //this make so the explosion radius is a circle
            //        {
            //            int type = (int)Main.tile[xPosition, yPosition].type;
            //            int wall = (int)Main.tile[xPosition, yPosition].wall;

            //            #region Walls
            //            if (wall == 3 || wall == 1 || wall == 61 || wall == 83) //EbonStone, stone wall, Cave, Crimson
            //            {
            //                Main.tile[xPosition, yPosition].wall = 28; //pearlstone wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (wall == 69 || (wall > 62 && wall < 66) || wall == 81 || (wall > 187 && wall < 196))// || (wall > 200 && wall < 203)) //Corrupt grass, Hallowed, Crimson grass, Corrupt 1-4 - Crimson 1-4, Hallow 1-4
            //            {
            //                Main.tile[xPosition, yPosition].wall = 70; //Hallowed Grass Wall natural
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (wall == 220 || wall == 221 || wall ==187) //Ebonsandstone wall, Crimsandstone, sandstone wall
            //            {
            //                Main.tile[xPosition, yPosition].wall = 222; //Pearlsandstone wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (wall == 217 || wall == 218 || wall == 216) //Hardened Ebonsand wall, Hardened Crimsand, Hardened sand wall
            //            {
            //                Main.tile[xPosition, yPosition].wall = 219; //Hardened Pearlsand wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            #endregion

            //            #region Blocks
            //            if (type == 25 || type == 1 || type == 203) //Ebonstone, stone, and Crimstone
            //            {
            //                Main.tile[xPosition, yPosition].type = 117; //PearlStone block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (type == 23 || type == 2 || type == 199) //Corrupt grass, Grass, and Crimson grass
            //            {
            //                Main.tile[xPosition, yPosition].type = 109; //Hallowed Grass block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (type == 112 || type == 53 || type == 234) //Ebonsand, sand, and Crimsand
            //            {
            //                Main.tile[xPosition, yPosition].type = 116; //PearlSand
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (type == 400 || type == 401 || type == 396) //Ebonsandstone, Crimsandstone, and sandstone
            //            {
            //                Main.tile[xPosition, yPosition].type = 403; //PearlSandstone Block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (type == 398 || type == 399 || type == 397) //Hardened Ebonsand, Crimsand, and Hardenedsand
            //            {
            //                Main.tile[xPosition, yPosition].type = 402; //Hardened PearlSand Block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            if (type == 163 || type == 161 || type == 200) //Purple, Ice Block, and Red ice blocks
            //            {
            //                Main.tile[xPosition, yPosition].type = 164; //Pink Ice block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            #endregion

            //            #region Bushes
            //            if (type == 32 || type == 352) //Corrupt Thorny Bush, Crimson Thorny Bush
            //            {
            //                WorldGen.KillTile(xPosition, yPosition, false, false, false);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //            #endregion
            //        }
            //    }
            //}
            //Vector2 dustposition = projectile.Center;
            //int dustradius = 2;
            //for (int dx = -dustradius; dx <= dustradius; dx++)
            //{
            //    for (int dy = -radius; dy <= radius; dy++)
            //    {
            //        int dxPosition = (int)(dx + position.X / 16.0f);
            //        int dyPosition = (int)(dy + position.Y / 16.0f);
            //        if (Math.Sqrt(dx * dx + dy * dy) <= radius + 0.5)
            //            Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, 0f, 0f, 100, new Color(), 0.5f);
            //    }
            //}
            #endregion

            #region Updated WorldGen Convert
            Vector2 position = projectile.Center;
            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            int radius = 120;
            //float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            //float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 58; i++)
            {
                float speedX = Main.rand.NextFloat(-12, 12);
                float speedY = Main.rand.NextFloat(-10, 10);
                //Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.PureSpray, 0, 0, Main.myPlayer);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 56, speedX, speedY, 100, new Color(), 1.5f);
            }

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)     //circle
                    {
                        WorldGen.Convert(xPosition, yPosition, 2, 1); // convert to hallowed
                    }
                }
            }
            #endregion
        }
示例#15
0
        public override void Kill(int timeLeft)
        {
            #region Original
            //Vector2 position = projectile.Center;
            //Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
            //int radius = 120;     //this is the explosion radius, the highter is the value the bigger is the explosion

            //for (int x = -radius; x <= radius; x++)
            //{
            //    for (int y = -radius; y <= radius; y++)
            //    {
            //        int xPosition = (int)(x + position.X / 16.0f);
            //        int yPosition = (int)(y + position.Y / 16.0f);

            //        if (Math.Sqrt(x * x + y * y) <= radius + 0.5)   //this make so the explosion radius is a circle
            //        {
            //            int type = (int)Main.tile[xPosition, yPosition].type;
            //            int wall = (int)Main.tile[xPosition, yPosition].wall;
            //            //Walls
            //            if (wall == 1 || wall == 28 || wall == 61)// || wall == 3) //Stone, Pearl, Cave, Ebonstone Walls
            //            {
            //                Main.tile[xPosition, yPosition].wall = 83; //Crimstone wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //                if (wall == 70 || (wall > 62 && wall < 66) || (wall > 199 && wall < 204)) //Hallowed, Grass - Flower grass, Hallow 1-4
            //            {
            //                    Main.tile[xPosition, yPosition].wall = 81; //Crimson Grass natural
            //                    WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //                }
            //                if (wall == 187 || wall == 222)// || wall ==220) //Sandstone, Pearlsandstone, Ebonsandstone
            //            {
            //                Main.tile[xPosition, yPosition].wall = 221; //Crimsandstone wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //                }
            //                if (wall == 216 || wall == 219)// || wall == 217) //Hardened Sand, Hardened Pearlsand, Hardened Ebonsand
            //            {
            //                Main.tile[xPosition, yPosition].wall = 218; //Hardened Crimsand wall
            //                WorldGen.SquareWallFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }

            //                //Blocks //Coruption and Crimson are both allowed now so only convert normal and holy blocks.
            //        if (type == 1 || type == 117)// || type == 25) //Stone block, Pearlstone, and Ebonstone
            //        {
            //            Main.tile[xPosition, yPosition].type = 203; //CrimStone block
            //            WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //            NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //        }
            //            if (type == 2 || type == 109)// || type == 23) //Grass, Hallowed grass, and Corrupt Grass
            //            {
            //                Main.tile[xPosition, yPosition].type = 199; //Crimson Grass block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //                if (type == 53 || type == 116)// || type == 112) //Sand, Pearlsand, and Ebonsand
            //                {
            //                    Main.tile[xPosition, yPosition].type = 234; //CrimSand
            //                    WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //                }
            //                if (type == 396 || type == 403)// || type == 400) //Sandstone, Pearlsandstone, and Ebonsandstone
            //            {
            //                Main.tile[xPosition, yPosition].type = 401; //CrimSandstone Block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //                if (type == 397 || type == 402)// || type == 398) //Hardened Sand, Hardened Pearlsand, and Hardened Ebonsand
            //            {
            //                Main.tile[xPosition, yPosition].type = 399; //Hardened CrimSand Block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //                if (type == 161 || type == 164)// || type == 163) //Ice block, Pink Ice, and Purple Ice
            //            {
            //                Main.tile[xPosition, yPosition].type = 200; //Red Ice block
            //                WorldGen.SquareTileFrame(xPosition, yPosition, true);
            //                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            //            }
            //        }
            //    }
            //}
            //Vector2 dustposition = projectile.Center;
            //int dustradius = 2;
            //for (int dx = -dustradius; dx <= dustradius; dx++)
            //{
            //    for (int dy = -radius; dy <= radius; dy++)
            //    {
            //        int dxPosition = (int)(dx + position.X / 16.0f);
            //        int dyPosition = (int)(dy + position.Y / 16.0f);
            //        if (Math.Sqrt(dx * dx + dy * dy) <= radius + 0.5)
            //            Dust.NewDust(projectile.position, projectile.width, projectile.height, 183, 0f, 0f, 100, new Color(), 0.5f);
            //    }
            //}
            #endregion

            #region Updated WorldGen Convert
            Vector2 position = projectile.Center;
            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            int radius = 120;
            //float[] speedX = { 0, 0, 5, 5, 5, -5, -5, -5 };
            //float[] speedY = { 5, -5, 0, 5, -5, 0, 5, -5 };

            for (int i = 0; i < 58; i++)
            {
                float speedX = Main.rand.NextFloat(-12, 12);
                float speedY = Main.rand.NextFloat(-10, 10);
                //Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX[i], speedY[i], ProjectileID.PureSpray, 0, 0, Main.myPlayer);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 183, speedX, speedY, 100, new Color(), 1.5f);
            }

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)     //circle
                    {
                        WorldGen.Convert(xPosition, yPosition, 4, 1); // convert to crimson
                    }
                }
            }
            #endregion
        }
示例#16
0
 public override void Convert(int i, int j, int size = 4)
 {
     WorldGen.Convert(i, j, 4, size);
 }
示例#17
0
        public override void HotKeyPressed(string name)
        {
            Player  player  = Main.player[Main.myPlayer];
            MPlayer mplayer = (MPlayer)(player.GetModPlayer(this, "MPlayer"));

            if (name.Equals("Active Ability") && player.FindBuffIndex(BuffType("ActiveCooldown")) == -1)
            {
                if (mplayer.knight)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 600);
                    int    damage = 6;
                    int    count  = mplayer.specialProgressionCount;
                    string type   = "Shield1";
                    if (count <= 5)
                    {
                        damage += (int)(2 * count);
                    }
                    else if (count <= 9)
                    {
                        damage += (int)(3 * count);
                        type    = "Shield2";
                    }
                    else if (count <= 12)
                    {
                        damage += 5 * count;
                        type    = "Shield3";
                    }
                    else
                    {
                        damage += 7 * count;
                        type    = "Shield3";
                    }
                    float num11 = damage * player.meleeDamage + player.statDefense;
                    int   p     = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0, 0, ProjectileType(type), (int)num11, 10, player.whoAmI);
                }
                else if (mplayer.fortress)
                {
                    player.AddBuff(BuffID.Stoned, 240);
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                }
                else if (mplayer.warmage)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    mplayer.specialTimer = 600;
                }
                else if (mplayer.harpy)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 240);
                    Main.PlaySound(2, player.position, 32);
                    int   damage = 11;
                    int   count  = mplayer.specialProgressionCount;
                    float scalar = 1f + (float)Math.Pow(count, 1.75) / 7;
                    damage = (int)(damage * Math.Max(player.thrownDamage, player.rangedDamage) * scalar);
                    Vector2 vel = Main.MouseWorld - player.position;
                    vel.Normalize();
                    vel *= 11 + count / 2;
                    for (int i = 0; i < 3 + count / 3; i++)
                    {
                        int p = Projectile.NewProjectile(player.position.X, player.position.Y, vel.X + Main.rand.Next(-20, 21) / 6, vel.Y + Main.rand.Next(-20, 21) / 6, ProjectileID.HarpyFeather, damage, 3, player.whoAmI);
                        Main.projectile[p].friendly = true;
                        Main.projectile[p].hostile  = false;
                        Main.projectile[p].ranged   = true;
                    }
                    Main.PlaySound(2, player.position, 32);
                }
                else if (mplayer.spiritMage)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    int minionsKilled = 0;
                    for (int i = 0; i < 1000; i++)
                    {
                        if (Main.projectile[i].minion && Main.projectile[i].owner == Main.myPlayer)
                        {
                            for (int j = 0; j < 20; j++)
                            {
                                int dust = Dust.NewDust(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 15);
                                Main.dust[dust].velocity.Normalize();
                                Main.dust[dust].velocity *= 3;
                                var netMessage = GetPacket();
                                netMessage.Write("Dust");
                                netMessage.Write(player.whoAmI);
                                netMessage.Write(15);
                                netMessage.Write(true);
                                netMessage.Write(3.0);
                                netMessage.Send();
                            }
                            Main.projectile[i].Kill();
                            minionsKilled++;
                        }
                    }
                    mplayer.specialTimer = 480;
                    mplayer.special2     = minionsKilled;
                }
                else if (mplayer.demon)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 20);
                    for (int i = 0; i < 1000; i++)
                    {
                        if (Main.projectile[i].type == ProjectileType("Demon") && Main.projectile[i].owner == Main.myPlayer && !Main.projectile[i].tileCollide && Main.projectile[i].active)
                        {
                            Vector2 vel = Main.MouseWorld - Main.projectile[i].position;
                            vel.Normalize();
                            vel *= 10 + mplayer.specialProgressionCount / 2;
                            Main.projectile[i].velocity = vel;
                            Main.projectile[i].alpha    = 150;
                            Main.projectile[i].friendly = true;
                            Main.PlaySound(2, player.position, 8);
                            mplayer.special--;
                            break;
                        }
                    }
                }
                else if (mplayer.werewolf)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 10800);
                    Main.PlaySound(3, player.position, 6);
                    mplayer.specialTimer = 3600;
                }
                else if (mplayer.sage)
                {
                    if (player.statManaMax <= 0)
                    {
                        return;
                    }
                    mplayer.specialTimer = 3;
                    if (mplayer.special == 119)
                    {
                        Main.PlaySound(25, -1, -1, 1);
                        for (int i = 0; i < 5; i++)
                        {
                            int num3 = Dust.NewDust(player.position, player.width, player.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
                            Main.dust[num3].noLight   = true;
                            Main.dust[num3].noGravity = true;
                            Main.dust[num3].velocity *= 0.5f;
                        }
                    }
                }
                else if (mplayer.dragoon)
                {
                    mplayer.specialTimer = 3;
                    if (mplayer.special == 119)
                    {
                        Main.PlaySound(25, -1, -1, 1);
                        for (int i = 0; i < 5; i++)
                        {
                            int num3 = Dust.NewDust(player.position, player.width, player.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
                            Main.dust[num3].noLight   = true;
                            Main.dust[num3].noGravity = true;
                            Main.dust[num3].velocity *= 0.5f;
                        }
                    }
                }
                else if (mplayer.soulbound)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1500);
                    mplayer.specialTimer = 600;
                    if (Main.expertMode)
                    {
                        player.AddBuff(BuffID.Cursed, 300);
                    }
                    else
                    {
                        player.AddBuff(BuffID.Cursed, 600);
                    }
                }
                else if (mplayer.ninja)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 900);
                    Vector2 vel = Main.MouseWorld - player.Center;
                    vel.Normalize();
                    vel *= 11;
                    int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, ProjectileType("DeathMark"), 1, 0, player.whoAmI);
                    Main.PlaySound(2, player.position, 19);
                }
                else if (mplayer.merman)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 3600 * 8);
                    Main.raining       = true;
                    Main.cloudBGActive = 1;
                    Main.cloudBGAlpha  = 255;
                    Main.maxRaining    = 1;
                    Main.rainTime      = 3600 * 4;
                }
                else if (mplayer.cavalry)
                {
                    mplayer.specialTimer = 60;
                    player.velocity.X   += (14 + mplayer.specialProgressionCount) * player.direction;
                    player.AddBuff(BuffType("ActiveCooldown"), 600);
                }
                else if (mplayer.pirate)
                {
                    bool flag = (player.position.X <850 * 16 || player.position.X> (Main.maxTilesX - 850) * 16) && player.position.Y < Main.worldSurface * 16;
                    if (flag)
                    {
                        player.AddBuff(BuffType("ActiveCooldown"), 1800);
                        int   damage = 30;
                        int   count  = mplayer.specialProgressionCount;
                        float scalar = 1f + (float)Math.Pow(count, 1.65) / 6;
                        damage = (int)(player.rangedDamage * damage * scalar);
                        int     direction = (player.position.X < 850 * 16) ? 1 : -1;
                        Vector2 soundPos  = new Vector2(player.position.X - 1000 * direction);
                        Main.PlaySound(2, soundPos, 38);
                        float posX = Main.MouseWorld.X - 1220 * direction;
                        float posY = Main.MouseWorld.Y - 3000;
                        for (int i = 0; i < 3 + count / 2; i++)
                        {
                            int p = Projectile.NewProjectile(posX + Main.rand.Next(-150, 151), posY + Main.rand.Next(-150, 151), 12 * direction, 0, 162, damage, 8, player.whoAmI);
                        }
                    }
                    else
                    {
                        player.AddBuff(BuffType("ActiveCooldown"), 18000);
                        player.AddBuff(BuffType("RumDrunk"), 7200);
                        Main.PlaySound(2, player.position, 3);
                    }
                }
                else if (mplayer.pharaoh)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 14400);
                    mplayer.specialTimer = 1800;
                    if (player.ZoneDesert || player.ZoneUndergroundDesert)
                    {
                        mplayer.special2 = 1;//get bigger bonuses
                    }
                }
                else if (mplayer.arcaneSniper)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    mplayer.specialTimer = 600;
                    mplayer.special2     = 1 + mplayer.specialProgressionCount / 4;//number of empowered shots
                }
                else if (mplayer.hallowMage)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    mplayer.specialTimer = 25 + mplayer.specialProgressionCount * 8;
                }
                else if (mplayer.explorer)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    player.TeleportationPotion();
                }
                else if (mplayer.taintedElf)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    mplayer.specialTimer = 600;
                }
                else if (mplayer.bloodKnight)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 3600);
                    WorldGen.Convert((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 4, 30);
                    int   damage = 25;
                    int   count  = mplayer.specialProgressionCount;
                    float scalar = 1f + (float)Math.Pow(count, 1.6) / 6;
                    damage = (int)(player.meleeDamage * damage * scalar);
                    Main.PlaySound(41, player.position);
                    DamageArea(player.Center, 150, damage, 10);//set damage progression
                    for (int j = 0; j < 50; j++)
                    {
                        int dust = Dust.NewDust(player.position, player.width, player.height, 90);
                        Main.dust[dust].velocity.Normalize();
                        Main.dust[dust].velocity *= 16;
                        Main.dust[dust].noGravity = true;
                        var netMessage = GetPacket();
                        netMessage.Write("DustNormalize");
                        netMessage.Write(player.whoAmI);
                        netMessage.Write(90);
                        netMessage.Write(true);
                        netMessage.Write(16.0);
                        netMessage.Send();
                    }
                }
                else if (mplayer.wanderer)
                {
                    if (mplayer.special3 <= 0)
                    {
                        return;
                    }
                    player.AddBuff(BuffType("ActiveCooldown"), 60);
                    int p = Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0, 0, ProjectileType("WandererPortal"), 0, 0, Main.myPlayer);
                    mplayer.special++;
                    for (int i = 0; i < 1000; i++)
                    {
                        if (Main.projectile[i].type == ProjectileType("WandererCharge") && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].ai[1] == mplayer.special3)
                        {
                            Main.projectile[i].Kill();
                            break;
                        }
                    }
                }
                else if (mplayer.angel)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 7200);
                    mplayer.specialTimer = 600;
                }
                else if (mplayer.marksman)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 5400);
                    mplayer.specialTimer = 600;
                    player.AddBuff(BuffID.NightOwl, 600);
                }
                else if (mplayer.ranger)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 3600);
                    mplayer.specialTimer = 300;
                }
                else if (mplayer.dwarf)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 3600 * 6);
                    player.AddBuff(BuffType("DwarvenStout"), 7200);
                    Main.PlaySound(2, player.position, 3);
                }
                else if (mplayer.savage)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 7200);
                    mplayer.specialTimer = 900;
                    if (Main.expertMode)
                    {
                        player.AddBuff(BuffID.Bleeding, 450);
                    }
                    else
                    {
                        player.AddBuff(BuffID.Bleeding, 900);
                    }
                    player.Hurt(new Terraria.DataStructures.PlayerDeathReason(), 1, 0);
                }
                else if (mplayer.berserker)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 7200);
                    player.AddBuff(BuffID.Battle, 1200);
                    mplayer.specialTimer = 1200;
                }
                else if (mplayer.chronomancer)
                {
                    if (mplayer.specialTimer <= 0)
                    {
                        player.AddBuff(BuffType("ActiveCooldown"), 120);
                        mplayer.specialTimer = 600;
                        int p = Projectile.NewProjectile(player.position.X, player.position.Y, 0, 0, ProjectileType("ChronoGhost"), 0, 0, player.whoAmI);
                        mplayer.special2 = p;
                        mplayer.special  = player.statLife;
                    }
                    else
                    {
                        player.AddBuff(BuffType("ActiveCooldown"), 3600);
                        Projectile proj = Main.projectile[mplayer.special2];
                        player.Teleport(proj.position);
                        float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.7) / 4;
                        float damage = 48 * scalar * player.magicDamage * (1 + player.magicCrit / 100.0f);
                        DamageArea(proj.Center, 256, (int)damage, 15);
                        for (int i = 1; i < 5; i++)
                        {
                            for (int j = 0; j < 15 * i; j++)
                            {
                                int d = Dust.NewDust(proj.Center, proj.width, proj.height, 15);
                                Main.dust[d].velocity.Normalize();
                                Main.dust[d].velocity *= 2.5f * i;
                                var netMessage = GetPacket();
                                netMessage.Write("DustNormalizeProj");
                                netMessage.Write(proj.whoAmI);
                                netMessage.Write(15);
                                netMessage.Write(true);
                                netMessage.Write(2.5 * i);
                                netMessage.Send();
                            }
                        }
                        if (player.statLife < mplayer.special)
                        {
                            player.HealEffect(mplayer.special - player.statLife);
                            var netMessage = GetPacket();
                            netMessage.Write("Heal");
                            netMessage.Write(player.whoAmI);
                            netMessage.Write(player.statLife = mplayer.special);
                            netMessage.Send();
                            player.statLife = mplayer.special;
                        }
                        proj.Kill();
                    }
                }
                else if (mplayer.contractedSword)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 7;
                    float damage = 18 * scalar * (player.meleeDamage + player.minionDamage - 1.5f);
                    Projectile.NewProjectile(player.position.X, player.position.Y, 8 * player.direction, 0, ProjectileType("SpiritKnight"), (int)damage, 10, player.whoAmI);
                }
                else if (mplayer.angler)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 1800);
                    Vector2 vel = Main.MouseWorld - player.Center;
                    vel.Normalize();
                    vel *= 9;
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, ProjectileType("AnglerChum"), 1, 0, player.whoAmI);
                }
                else if (mplayer.conjuror)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 600);
                    float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                    float damage = 3 * scalar * (player.minionDamage);
                    Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0, 0, ProjectileType("ConjurorCrystal"), (int)damage, 0, player.whoAmI);
                }
                else if (mplayer.celestial)
                {
                    if (mplayer.special == 0)
                    {
                        mplayer.special = 1;
                    }
                    else
                    {
                        mplayer.special = 0;
                    }
                    player.AddBuff(BuffType("ActiveCooldown"), 180);
                }
                else if (mplayer.voidwalker)
                {
                    int cost = 15 + 20 * mplayer.special2;
                    if (player.statMana < cost)
                    {
                        return;
                    }
                    Vector2 vector15;
                    vector15.X = (float)Main.mouseX + Main.screenPosition.X;
                    if (player.gravDir == 1f)
                    {
                        vector15.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height;
                    }
                    else
                    {
                        vector15.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
                    }
                    //reduce to max teleport distance
                    float dist    = Vector2.Distance(vector15, player.Center);
                    float maxDist = 200 + 50 * mplayer.specialProgressionCount;
                    if (dist > maxDist)
                    {
                        Vector2 toMouse = Main.MouseWorld - player.Center;
                        toMouse.Normalize();
                        toMouse  *= (dist - maxDist);
                        vector15 -= toMouse;
                    }
                    vector15.X += (float)(player.width / 2);
                    vector15.Y += (float)(player.height / 2);
                    if (vector15.X > 50f && vector15.X < (float)(Main.maxTilesX * 16 - 50) && vector15.Y > 50f && vector15.Y < (float)(Main.maxTilesY * 16 - 50))
                    {
                        int num260 = (int)(vector15.X / 16f);
                        int num261 = (int)(vector15.Y / 16f);
                        if ((Main.tile[num260, num261].wall != 87 || (double)num261 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector15, player.width, player.height))
                        {
                            player.Teleport(vector15, 1, 0);
                            NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, vector15.X, vector15.Y, 1, 0, 0);
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                    player.statMana      -= cost;
                    player.manaRegenDelay = 90;
                    mplayer.special2++;
                    player.AddBuff(BuffType("ActiveCooldown"), 480 - mplayer.specialProgressionCount * 30);
                    player.AddBuff(BuffID.ChaosState, 600);
                    mplayer.specialTimer = 600;
                    if (mplayer.special2 > 3)
                    {
                        int selfDam = Math.Min(player.statLifeMax / 20 * (mplayer.special2 - 3), player.statLifeMax / 5);
                        player.statLife -= selfDam;
                        CombatText.NewText(player.getRect(), Color.OrangeRed, selfDam + "");
                        player.lifeRegenTime  = 0;
                        player.lifeRegenCount = 0;
                        if (player.statLife <= 0)
                        {
                            player.KillMe(new Terraria.DataStructures.PlayerDeathReason(), 1.0, 0);
                        }
                    }
                    //deal area damage
                    float scalar = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                    float damage = 14 * scalar * Math.Max(player.magicDamage, player.meleeDamage) * Math.Max(1 + player.magicCrit / 100f, 1 + player.meleeCrit / 100f) * (1 + mplayer.special2 / 3f);
                    DamageArea(vector15, 144, (int)damage, 3);
                    //visuals
                    for (int i = 0; i < 30; i++)
                    {
                        int d = Dust.NewDust(vector15, 1, 1, 27);
                        Main.dust[d].velocity *= 4;
                    }
                    var netMessage = GetPacket();
                    netMessage.Write("DustPosMult");
                    netMessage.Write((int)vector15.X);
                    netMessage.Write((int)vector15.Y);
                    netMessage.Write(27);
                    netMessage.Write(true);
                    netMessage.Write(4);
                    netMessage.Send();
                }
                else if (mplayer.moth)
                {
                    if (mplayer.special == 0)
                    {
                        mplayer.special = 1;
                    }
                    else
                    {
                        mplayer.special = 0;
                    }
                    player.AddBuff(BuffType("ActiveCooldown"), 180);
                }
                else if (mplayer.monk)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 600);
                    float   scalar  = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.7) / 6;
                    float   dam     = 18 * scalar * player.meleeDamage;
                    Vector2 toMouse = Main.MouseWorld - player.Center;
                    toMouse.Normalize();
                    toMouse *= 4;
                    //toMouse += player.velocity;
                    int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, toMouse.X, toMouse.Y, ProjectileType("MonkPalm"), (int)dam, 0, player.whoAmI);
                }
                else if (mplayer.warpKnight)
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 900 - mplayer.specialProgressionCount * 30);
                    float   scalar  = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 6;
                    float   dam     = 18 * scalar * player.meleeDamage;
                    Vector2 toMouse = Main.MouseWorld - player.Center;
                    toMouse.Normalize();
                    toMouse *= 11;
                    int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, toMouse.X, toMouse.Y, ProjectileType("WarpBolt"), (int)dam, 0, player.whoAmI);
                }
                else if (mplayer.heritor)
                {
                    if (mplayer.special == 0)
                    {
                        //reset between uses
                        if (mplayer.special3 == -1)
                        {
                            mplayer.special3 = 0;
                        }
                        if (mplayer.special3 == 0)
                        {
                            player.AddBuff(BuffType("ActiveCooldown"), 60);
                            //begin cycle, exclude special2
                            mplayer.special3 = 540;
                        }
                        else
                        {
                            mplayer.special      = mplayer.special4;
                            mplayer.special3     = -1;
                            mplayer.specialTimer = 1800;
                            player.AddBuff(BuffType("ActiveCooldown"), 1800);
                        }
                    }
                }
                else
                {
                    player.AddBuff(BuffType("ActiveCooldown"), 3600);
                    player.statLife += 30 + mplayer.specialProgressionCount * 5;
                    player.HealEffect(30 + mplayer.specialProgressionCount * 5);
                }
            }
        }