public override void Pickup(PlayerController player) { BounceProjModifier bounceProj = new BounceProjModifier(); bounceProj.OnBounce += Bounce; base.Pickup(player); player.PostProcessProjectile += this.PostProcessProjectile; player.GunChanged += this.OnGunChanged; var item = this; if (ShellWeapons.Contains(Owner.CurrentGun.PickupObjectId)) { EnableVFX(Owner); if (bounce == false) { float curSpeed = Owner.stats.GetBaseStatValue(PlayerStats.StatType.ProjectileSpeed); float newSpeed = curSpeed + 3f; Owner.stats.SetBaseStatValue(PlayerStats.StatType.ProjectileSpeed, newSpeed, Owner); speedBuff = newSpeed - curSpeed; float curBounce = Owner.stats.GetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces); float newBounce = curBounce + 5f; Owner.stats.SetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces, newBounce, Owner); bounceBuff = newBounce - curBounce; bounce = true; } } else { DisableVFX(Owner); if (bounce == true) { if (bounceBuff <= 0) { return; } float curSpeed = Owner.stats.GetBaseStatValue(PlayerStats.StatType.ProjectileSpeed); float newSpeed = curSpeed - speedBuff; Owner.stats.SetBaseStatValue(PlayerStats.StatType.ProjectileSpeed, newSpeed, Owner); speedBuff = -1; //if (bounceBuff <= 0) return; float curBounce = Owner.stats.GetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces); float newBounce = curBounce - bounceBuff; Owner.stats.SetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces, newBounce, Owner); bounceBuff = -1; bounce = false; } } }
public void OnGunChanged(Gun old, Gun current, bool newGun) { var item = this; if (ShellWeapons.Contains(Owner.CurrentGun.PickupObjectId)) { EnableVFX(Owner); if (bounce == false) { float curSpeed = Owner.stats.GetBaseStatValue(PlayerStats.StatType.ProjectileSpeed); float newSpeed = curSpeed + 5f; Owner.stats.SetBaseStatValue(PlayerStats.StatType.ProjectileSpeed, newSpeed, Owner); speedBuff = newSpeed - curSpeed; float curBounce = Owner.stats.GetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces); float newBounce = curBounce + 5f; Owner.stats.SetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces, newBounce, Owner); bounceBuff = newBounce - curBounce; bounce = true; } } else { DisableVFX(Owner); if (bounce == true) { //if (speedBuff <= 0) return; float curSpeed = Owner.stats.GetBaseStatValue(PlayerStats.StatType.ProjectileSpeed); float newSpeed = curSpeed - speedBuff; Owner.stats.SetBaseStatValue(PlayerStats.StatType.ProjectileSpeed, newSpeed, Owner); speedBuff = -1; //if (bounceBuff <= 0) return; float curBounce = Owner.stats.GetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces); float newBounce = curBounce - bounceBuff; Owner.stats.SetBaseStatValue(PlayerStats.StatType.AdditionalShotBounces, newBounce, Owner); bounceBuff = -1; bounce = false; } } }