示例#1
0
        protected override void FireRangedWeapon()
        {
            var  cache     = _equipmentSlots[0].ItemCache;
            bool noconsume = false;

            if (ModdedPlayer.instance.ReusabilityChance >= 0 && Random.value < ModdedPlayer.instance.ReusabilityChance)
            {
                noconsume = true;
            }
            noconsume = noconsume || cache._maxAmount < 0 || RemoveItem(cache._ammoItemId, 1, false, true);
            if (noconsume && cache._ammoItemId == 231)
            {
                AddItem(231);
            }
            Multishot.Fired();
            this.StartCoroutine(RCoroutines.i.AsyncRangedFire(this, _weaponChargeStartTime, _equipmentSlots[0], _inventoryItemViewsCache[cache._ammoItemId][0], noconsume));

            _weaponChargeStartTime = 0f;
            float duration = (!noconsume) ? cache._reloadDuration : cache._dryFireReloadDuration;

            if (GreatBow.isEnabled)
            {
                duration *= 10;
            }
            SetReloadDelay(duration);
            _isThrowing = false;
        }
        protected override void FireRangedWeapon()
        {
            var cache = _equipmentSlots[0].ItemCache;

            if (EquippedModel == BaseItem.WeaponModelType.Polearm)
            {
                return;
            }
            bool noconsume = ModdedPlayer.Stats.perk_projectileNoConsumeChance >= 0 && Random.value < ModdedPlayer.Stats.perk_projectileNoConsumeChance;

            noconsume = noconsume || cache._maxAmount < 0 || RemoveItem(cache._ammoItemId, 1, false, true);
            if (noconsume && cache._ammoItemId == 231)
            {
                AddItem(231);
            }
            Multishot.Fired();
            COTFEvents.Instance.OnAttackRanged.Invoke();
            this.StartCoroutine(RCoroutines.i.AsyncRangedFire(this, _weaponChargeStartTime, _equipmentSlots[0], _inventoryItemViewsCache[cache._ammoItemId][0], noconsume));

            _weaponChargeStartTime = 0f;
            float duration = (!noconsume) ? cache._reloadDuration : cache._dryFireReloadDuration;

            if (GreatBow.isEnabled)
            {
                duration *= 10;
            }
            SetReloadDelay(duration);
            _isThrowing = false;
        }