Exemple #1
0
 public ProjectileTracker()
 {
     for (int x = 0; x < Projectiles.Length; x++)
     {
         Projectiles[x] = new PvPProjectile(0);
     }
 }
Exemple #2
0
        /// <summary>
        /// Applies nebula, spectre, and frost armor effects.
        /// </summary>
        public void ApplyArmorEffects(PvPPlayer target, PvPItem weapon, PvPProjectile projectile)
        {
            if (TPlayer.setNebula && TPlayer.nebulaCD == 0 && Main.rand.Next(3) == 0 && PvPModifier.Config.EnableNebula && weapon.magic)
            {
                TPlayer.nebulaCD = 30;
                int type = Terraria.Utils.SelectRandom(Main.rand, 3453, 3454, 3455);

                int index = Item.NewItem((int)TPlayer.position.X, (int)TPlayer.position.Y, TPlayer.width, TPlayer.height, type);

                float velocityY = Main.rand.Next(-20, 1) * 0.2f;
                float velocityX = Main.rand.Next(10, 31) * 0.2f * Main.rand.Next(-1, 1).Replace(0, 1);

                var itemDrop = new PacketWriter()
                               .SetType((int)PacketTypes.UpdateItemDrop)
                               .PackInt16((short)index)
                               .PackSingle(target.TPlayer.position.X)
                               .PackSingle(target.TPlayer.position.Y)
                               .PackSingle(velocityX)
                               .PackSingle(velocityY)
                               .PackInt16(1)
                               .PackByte(0)
                               .PackByte(0)
                               .PackInt16((short)type)
                               .GetByteData();
                var itemOwner = new PacketWriter()
                                .SetType((int)PacketTypes.ItemOwner)
                                .PackInt16((short)index)
                                .PackByte((byte)Index)
                                .GetByteData();

                foreach (var pvper in PvPModifier.ActivePlayers)
                {
                    pvper.SendRawData(itemDrop);
                    pvper.SendRawData(itemOwner);
                }
            }

            if ((weapon.ranged || weapon.melee) && TPlayer.frostArmor && PvPModifier.Config.EnableFrost)
            {
                target.SetBuff(44, (int)(PvPModifier.Config.FrostDuration * 30));
            }

            if (TPlayer.ghostHurt && projectile?.type != 356)
            {
                TerrariaUtils.ActivateSpectreBolt(this, target, weapon, weapon.ConfigDamage);
            }
        }
Exemple #3
0
        public void InsertProjectile(int index, int projectileType, int ownerIndex, PvPItem item)
        {
            var projectile = new PvPProjectile(projectileType, index, ownerIndex, item);

            Projectiles[projectileType] = projectile;
        }
Exemple #4
0
 /// <summary>
 /// Applies effects that normally won't work in vanilla pvp.
 /// Effects include nebula/frost armor, yoyo-bag projectiles, and thorns/turtle damage.
 /// </summary>
 public void ApplyPvPEffects(PvPPlayer attacker, PvPItem weapon, PvPProjectile projectile, int damage)
 {
     this.ApplyReflectDamage(attacker, damage, weapon);
     this.ApplyArmorEffects(attacker, weapon, projectile);
     TerrariaUtils.ActivateYoyoBag(this, attacker, damage, weapon.knockBack);
 }