コード例 #1
0
        public virtual void OnActiveReloadSuccess(MultiActiveReload reload)
        {
            if (reload == null || reload.stopsReload)
            {
                info.Invoke(base.gun, new object[] { true, false, false });
            }
            float num = 1f;

            if (Gun.ActiveReloadActivated && this.PickedUpByPlayer && this.Player.IsPrimaryPlayer)
            {
                num *= CogOfBattleItem.ACTIVE_RELOAD_DAMAGE_MULTIPLIER;
            }
            if (Gun.ActiveReloadActivatedPlayerTwo && this.PickedUpByPlayer && !this.Player.IsPrimaryPlayer)
            {
                num *= CogOfBattleItem.ACTIVE_RELOAD_DAMAGE_MULTIPLIER;
            }
            if (reload == null || reload.usesActiveReloadData)
            {
                if (base.gun.LocalActiveReload && (reload == null || reload.reloadData == null))
                {
                    num *= Mathf.Pow(this.gun.activeReloadData.damageMultiply, (float)((int)info2.GetValue(base.gun) + 1));
                }
                else if (reload != null && reload.reloadData != null)
                {
                    num *= Mathf.Pow(reload.reloadData.damageMultiply, reload.reloadData.ActiveReloadStacks ? (float)((int)info2.GetValue(base.gun) + 1) : 1);
                }
            }
            this.damageMult = num;
        }
コード例 #2
0
        public static MultiActiveReload GetMultiActiveReloadForController(this GameUIReloadBarController controller)
        {
            MultiActiveReload result = null;

            if (tempraryActiveReloads.ContainsKey(controller))
            {
                foreach (MultiActiveReload reload in tempraryActiveReloads[controller])
                {
                    if (controller.progressSlider.Value >= (float)reload.startValue && controller.progressSlider.Value <= (float)reload.endValue)
                    {
                        result = reload;
                        break;
                    }
                }
            }
            return(result);
        }
コード例 #3
0
 public static void OnActiveReloadPressedHook(Action <Gun, PlayerController, Gun, bool> orig, Gun self, PlayerController p, Gun g, bool actualPress)
 {
     orig(self, p, g, actualPress);
     if (self.IsReloading || self.reloadTime < 0f)
     {
         PlayerController playerController = self.CurrentOwner as PlayerController;
         if (playerController && (actualPress || true))
         {
             MultiActiveReloadController controller = self.GetComponent <MultiActiveReloadController>();
             if (controller != null && controller.activeReloadEnabled && controller.canAttemptActiveReload && !GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).IsActiveReloadGracePeriod())
             {
                 bool flag2 = GameUIRoot.Instance.AttemptActiveReloadOnlyMultireload(self.CurrentOwner as PlayerController);
                 MultiActiveReload reload = GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).GetMultiActiveReloadForController();
                 if (flag2)
                 {
                     controller.OnActiveReloadSuccess(reload);
                     GunFormeSynergyProcessor component = self.GetComponent <GunFormeSynergyProcessor>();
                     if (component)
                     {
                         component.JustActiveReloaded = true;
                     }
                     ChamberGunProcessor component2 = self.GetComponent <ChamberGunProcessor>();
                     if (component2)
                     {
                         component2.JustActiveReloaded = true;
                     }
                 }
                 else
                 {
                     controller.OnActiveReloadFailure(reload);
                 }
                 if (reload == null || !reload.canAttemptActiveReloadAfterwards)
                 {
                     ETGModConsole.Log("yes");
                     controller.canAttemptActiveReload = false;
                     Action <PlayerController, Gun, bool> act = (Action <PlayerController, Gun, bool>)info2.CreateDelegate <Action <PlayerController, Gun, bool> >();
                     self.OnReloadPressed -= act;
                 }
             }
         }
     }
 }
コード例 #4
0
        public override void OnActiveReloadSuccess(MultiActiveReload reload)
        {
            base.OnActiveReloadSuccess(reload);
            PlayerController player = gun.CurrentOwner as PlayerController;

            if (reload.Name == "AccuracyUp" && AccReload == false)
            {
                AccReload = true;
                this.AddCurrentGunStatModifier(PlayerStats.StatType.Accuracy, .25f, StatModifier.ModifyMethod.MULTIPLICATIVE);
                if (gun.ClipShotsRemaining == 0)
                {
                    Projectile projectile = ((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);
                    GameObject gameObject = SpawnManager.SpawnProjectile(projectile.gameObject, Owner.CurrentGun.transform.position, Quaternion.Euler(0f, 0f, (base.Owner.CurrentGun == null) ? 0f : base.Owner.CurrentGun.CurrentAngle), true);
                    Projectile component  = gameObject.GetComponent <Projectile>();
                    if (component != null)
                    {
                        component.Owner               = gun.CurrentOwner;
                        component.Shooter             = gun.CurrentOwner.specRigidbody;
                        component.baseData.speed     *= 1f;
                        component.baseData.damage     = 7f;
                        component.AppliesStun         = true;
                        component.StunApplyChance     = 1f;
                        component.AppliedStunDuration = 2f;
                    }
                }
            }
            else
            {
                if (reload.Name == "FireRateUp" && FireReload == false)
                {
                    FireReload = true;
                    this.AddCurrentGunStatModifier(PlayerStats.StatType.RateOfFire, 1.65f, StatModifier.ModifyMethod.MULTIPLICATIVE);
                }
            }
            player.stats.RecalculateStats(player, false, false);
        }
コード例 #5
0
 public static void TriggerReloadHook(Action <GameUIReloadBarController, PlayerController, Vector3, float, float, int> orig, GameUIReloadBarController self, PlayerController attachParent, Vector3 offset, float duration, float activeReloadStartPercent,
                                      int pixelWidth)
 {
     if (tempraryActiveReloads.ContainsKey(self))
     {
         foreach (MultiActiveReload multiactivereload in tempraryActiveReloads[self])
         {
             if (multiactivereload.sprite != null && multiactivereload.sprite.gameObject != null)
             {
                 UnityEngine.Object.Destroy(multiactivereload.sprite.gameObject);
             }
             if (multiactivereload.celebrationSprite != null && multiactivereload.celebrationSprite.gameObject != null)
             {
                 UnityEngine.Object.Destroy(multiactivereload.celebrationSprite.gameObject);
             }
         }
         tempraryActiveReloads[self].Clear();
     }
     orig(self, attachParent, offset, duration, activeReloadStartPercent, pixelWidth);
     if (attachParent != null && attachParent.CurrentGun != null && attachParent.CurrentGun.GetComponent <MultiActiveReloadController>() != null)
     {
         foreach (MultiActiveReloadData data in attachParent.CurrentGun.GetComponent <MultiActiveReloadController>().reloads)
         {
             dfSprite sprite = UnityEngine.Object.Instantiate(self.activeReloadSprite);
             self.activeReloadSprite.Parent.AddControl(sprite);
             sprite.enabled = true;
             float width    = self.progressSlider.Width;
             float maxValue = self.progressSlider.MaxValue;
             float num      = data.startValue / maxValue * width;
             float num2     = data.endValue / maxValue * width;
             float x        = num + (num2 - num) * data.activeReloadStartPercentage;
             float width2   = (float)pixelWidth * Pixelator.Instance.CurrentTileScale;
             sprite.RelativePosition = self.activeReloadSprite.RelativePosition;
             sprite.RelativePosition = GameUIUtility.QuantizeUIPosition(sprite.RelativePosition.WithX(x));
             sprite.Width            = width2;
             sprite.IsVisible        = true;
             dfSprite celebrationSprite = UnityEngine.Object.Instantiate(self.celebrationSprite);
             self.activeReloadSprite.Parent.AddControl(celebrationSprite);
             celebrationSprite.enabled = true;
             dfSpriteAnimation component = celebrationSprite.GetComponent <dfSpriteAnimation>();
             component.Stop();
             component.SetFrameExternal(0);
             celebrationSprite.enabled          = false;
             celebrationSprite.RelativePosition = sprite.RelativePosition + new Vector3(Pixelator.Instance.CurrentTileScale * -1f, Pixelator.Instance.CurrentTileScale * -2f, 0f);
             int activeReloadStartValue = Mathf.RoundToInt((float)(data.endValue - data.startValue) * data.activeReloadStartPercentage) + data.startValue - data.activeReloadLastTime / 2;
             MultiActiveReload reload   = new MultiActiveReload
             {
                 sprite            = sprite,
                 celebrationSprite = celebrationSprite,
                 startValue        = activeReloadStartValue,
                 endValue          = activeReloadStartValue + data.activeReloadLastTime,
                 stopsReload       = data.stopsReload,
                 canAttemptActiveReloadAfterwards = data.canAttemptActiveReloadAfterwards,
                 reloadData           = data.reloadData,
                 usesActiveReloadData = data.usesActiveReloadData,
                 Name = data.Name
             };
             if (tempraryActiveReloads.ContainsKey(self))
             {
                 tempraryActiveReloads[self].Add(reload);
             }
             else
             {
                 tempraryActiveReloads.Add(self, new List <MultiActiveReload> {
                     reload
                 });
             }
         }
     }
 }
コード例 #6
0
 public virtual void OnActiveReloadFailure(MultiActiveReload reload)
 {
     this.damageMult = 1f;
 }