예제 #1
0
        public override ModItem Clone()
        {
            Bandoliers clone = (Bandoliers)base.Clone();

            clone.Bullets = Bullets.ConvertAll(item => item.Clone());
            return(clone);
        }
예제 #2
0
        public override void ProcessTriggers(TriggersSet triggersSet)
        {
            Item item = player.FindAmmo(i => i.modItem is Bandoliers);

            if (item == null)
            {
                return;
            }
            Bandoliers band = item.modItem as Bandoliers;

            if (Erilipah.Bandolier.JustPressed && item != null)
            {
                Main.PlaySound(SoundID.Item11, player.Center);
                List <Item> newQueue = new List <Item>
                {
                    band.Bullets.Last() // Add the last element to the front.
                };
                foreach (var curBullet in band.Bullets)
                {
                    // Excepting the last element because it was already added,
                    // add all the elements back to the new list.
                    if (curBullet != band.Bullets.Last())
                    {
                        newQueue.Add(curBullet);
                    }
                } // This COULD be done with more Linq expressions, but it's cleaner this way.

                // Update the queue, update the stats, and run no more code.
                band.Bullets = newQueue;
                band.UpdateStats();
                CombatText.NewText(player.getRect(), new Color(0, 255, 255), band.Bullet.Name);
            }
        }