private void AddStat(PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { foreach (var m in passiveStatModifiers) { if (m.statToBoost == statType) { return; } } StatModifier modifier = new StatModifier { amount = amount, statToBoost = statType, modifyType = method }; if (this.passiveStatModifiers == null) { this.passiveStatModifiers = new StatModifier[] { modifier } } ; else { this.passiveStatModifiers = this.passiveStatModifiers.Concat(new StatModifier[] { modifier }).ToArray(); } }
private void AddStat(PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier statModifier = new StatModifier { amount = amount, statToBoost = statType, modifyType = method }; foreach (StatModifier statModifier2 in this.passiveStatModifiers) { bool flag = statModifier2.statToBoost == statType; bool flag2 = flag; if (flag2) { return; } } bool flag3 = this.passiveStatModifiers == null; bool flag4 = flag3; if (flag4) { this.passiveStatModifiers = new StatModifier[] { statModifier }; return; } this.passiveStatModifiers = this.passiveStatModifiers.Concat(new StatModifier[] { statModifier }).ToArray <StatModifier>(); }
private void AddStat(PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier modifier = new StatModifier(); modifier.amount = amount; modifier.statToBoost = statType; modifier.modifyType = method; foreach (var m in passiveStatModifiers) { if (m.statToBoost == statType) { return; //don't add duplicates } } if (this.passiveStatModifiers == null) { this.passiveStatModifiers = new StatModifier[] { modifier } } ; else { this.passiveStatModifiers = this.passiveStatModifiers.Concat(new StatModifier[] { modifier }).ToArray(); } }
// Token: 0x06000356 RID: 854 RVA: 0x0001F684 File Offset: 0x0001D884 private void AddStat(PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier statModifier = new StatModifier { amount = amount, statToBoost = statType, modifyType = method }; bool flag = this.passiveStatModifiers == null; if (flag) { this.passiveStatModifiers = new StatModifier[] { statModifier }; } else { this.passiveStatModifiers = this.passiveStatModifiers.Concat(new StatModifier[] { statModifier }).ToArray <StatModifier>(); } }
private void StatModifierStuff(PlayerStats.StatType stat, float amount, StatModifier.ModifyMethod modifyType) { if (modifyType == StatModifier.ModifyMethod.MULTIPLICATIVE) { StatModifier statModifier = new StatModifier(); statModifier.amount = amount; statModifier.modifyType = modifyType; statModifier.statToBoost = stat; LastOwner.ownerlessStatModifiers.Add(statModifier); LastOwner.stats.RecalculateStats(LastOwner, false, false); } else { if (amount < 0) { if ((amount * amount) <= LastOwner.stats.GetStatValue(stat)) { StatModifier statModifier = new StatModifier(); statModifier.amount = amount; statModifier.modifyType = modifyType; statModifier.statToBoost = stat; LastOwner.ownerlessStatModifiers.Add(statModifier); LastOwner.stats.RecalculateStats(LastOwner, false, false); } } else { StatModifier statModifier = new StatModifier(); statModifier.amount = amount; statModifier.modifyType = modifyType; statModifier.statToBoost = stat; LastOwner.ownerlessStatModifiers.Add(statModifier); LastOwner.stats.RecalculateStats(LastOwner, false, false); } } }
private void ApplyStat(PlayerController player, PlayerStats.StatType statType, float amountToApply, StatModifier.ModifyMethod modifyMethod) { player.ownerlessStatModifiers.Add(Toolbox.SetupStatModifier(PlayerStats.StatType.Damage, 0.1f, StatModifier.ModifyMethod.ADDITIVE, false)); player.stats.RecalculateStats(player, false, false); }
public static void AddPassiveStatModifier(this Gun gun, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod modifyMethod) { gun.passiveStatModifiers = gun.passiveStatModifiers.Concat(new StatModifier[] { new StatModifier { statToBoost = statType, amount = amount, modifyType = modifyMethod } }).ToArray <StatModifier>(); }
/// <summary> /// Adds a passive player stat modifier to a PlayerItem or PassiveItem /// </summary> public static void AddPassiveStatModifier(PickupObject po, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier modifier = new StatModifier(); modifier.amount = amount; modifier.statToBoost = statType; modifier.modifyType = method; if (po is PlayerItem) { var item = (po as PlayerItem); if (item.passiveStatModifiers == null) { item.passiveStatModifiers = new StatModifier[] { modifier } } ; else { item.passiveStatModifiers = item.passiveStatModifiers.Concat(new StatModifier[] { modifier }).ToArray(); } } else if (po is PassiveItem) { var item = (po as PassiveItem); if (item.passiveStatModifiers == null) { item.passiveStatModifiers = new StatModifier[] { modifier } } ; else { item.passiveStatModifiers = item.passiveStatModifiers.Concat(new StatModifier[] { modifier }).ToArray(); } } else { throw new NotSupportedException("Object must be of type PlayerItem or PassiveItem"); } }
/// <summary> /// Adds a passive player stat modifier to a PlayerItem or PassiveItem /// </summary> public static StatModifier AddPassiveStatModifier(this PickupObject po, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier modifier = new StatModifier(); modifier.amount = amount; modifier.statToBoost = statType; modifier.modifyType = method; po.AddPassiveStatModifier(modifier); return(modifier); }
public static StatModifier SetupStatModifier(PlayerStats.StatType statType, float modificationAmount, StatModifier.ModifyMethod modifyMethod = StatModifier.ModifyMethod.ADDITIVE, bool breaksOnDamage = false) { return(new StatModifier { statToBoost = statType, amount = modificationAmount, modifyType = modifyMethod, isMeatBunBuff = breaksOnDamage }); }
public static void AddStat(this PassiveItem item, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier statModifier = new StatModifier { amount = amount, statToBoost = statType, modifyType = method }; foreach (StatModifier statModifier2 in item.passiveStatModifiers) { bool flag = statModifier2.statToBoost == statType; if (flag) { return; } } bool flag2 = item.passiveStatModifiers == null; if (flag2) { item.passiveStatModifiers = new StatModifier[] { statModifier }; return; } item.passiveStatModifiers = item.passiveStatModifiers.Concat(new StatModifier[] { statModifier }).ToArray <StatModifier>(); }
public static void AddStatToGun(this Gun item, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = StatModifier.ModifyMethod.ADDITIVE) { StatModifier modifier = new StatModifier { amount = amount, statToBoost = statType, modifyType = method }; if (item.passiveStatModifiers == null) { item.passiveStatModifiers = new StatModifier[] { modifier } } ; else { item.passiveStatModifiers = item.passiveStatModifiers.Concat(new StatModifier[] { modifier }).ToArray(); } }
private void ChangeStatPermanent(PlayerController target, PlayerStats.StatType statToChance, float amount, StatModifier.ModifyMethod modifyMethod) { StatModifier statModifier = new StatModifier(); statModifier.amount = amount; statModifier.modifyType = modifyMethod; statModifier.statToBoost = statToChance; target.ownerlessStatModifiers.Add(statModifier); target.stats.RecalculateStats(target, false, false); }
private IEnumerator HandleTimedStatModifier(PlayerStats.StatType statToBoost, float amount, float dur, StatModifier.ModifyMethod method) { StatModifier timedMod = new StatModifier() { amount = amount, statToBoost = statToBoost, modifyType = method, }; m_attachedPlayer.ownerlessStatModifiers.Add(timedMod); m_attachedPlayer.stats.RecalculateStats(m_attachedPlayer); yield return(new WaitForSeconds(dur)); m_attachedPlayer.ownerlessStatModifiers.Remove(timedMod); m_attachedPlayer.stats.RecalculateStats(m_attachedPlayer); yield break; }
public void DoTimedStatModifier(PlayerStats.StatType statToBoost, float amount, float time, StatModifier.ModifyMethod modifyMethod = StatModifier.ModifyMethod.MULTIPLICATIVE) { m_attachedPlayer.StartCoroutine(HandleTimedStatModifier(statToBoost, amount, time, modifyMethod)); }
public static void AddPassiveStatModifier(PickupObject po, PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod method = 0) { StatModifier statModifier = new StatModifier(); statModifier.amount = amount; statModifier.statToBoost = statType; statModifier.modifyType = method; bool flag = po is PlayerItem; if (flag) { PlayerItem playerItem = po as PlayerItem; bool flag2 = playerItem.passiveStatModifiers == null; if (flag2) { playerItem.passiveStatModifiers = new StatModifier[] { statModifier }; } else { playerItem.passiveStatModifiers = playerItem.passiveStatModifiers.Concat(new StatModifier[] { statModifier }).ToArray(); } } else { bool flag3 = po is PassiveItem; if (!flag3) { throw new NotSupportedException("Object must be of type PlayerItem or PassiveItem"); } PassiveItem passiveItem = po as PassiveItem; bool flag4 = passiveItem.passiveStatModifiers == null; if (flag4) { passiveItem.passiveStatModifiers = new StatModifier[] { statModifier }; } else { passiveItem.passiveStatModifiers = passiveItem.passiveStatModifiers.Concat(new StatModifier[] { statModifier }).ToArray(); } } }
private static void ApplyStat(PlayerController player, PlayerStats.StatType statType, float amountToApply, StatModifier.ModifyMethod modifyMethod) { player.stats.RecalculateStats(player, false, false); StatModifier statModifier = new StatModifier() { statToBoost = statType, amount = amountToApply, modifyType = modifyMethod }; player.ownerlessStatModifiers.Add(statModifier); player.stats.RecalculateStats(player, false, false); }
public void AddCurrentGunStatModifier(PlayerStats.StatType statType, float amount, StatModifier.ModifyMethod modifyMethod) { gun.currentGunStatModifiers = gun.currentGunStatModifiers.Concat(new StatModifier[] { new StatModifier { statToBoost = statType, amount = amount, modifyType = modifyMethod } }).ToArray(); }