public void UpdateBonuses() { if (ModifierData != null) { Bonuses = UpgradeData.BonusModule.Combine(ModifierData.BonusModule); } else { Bonuses = UpgradeData.BonusModule; } Bonuses.CompileDicts(); }
public BonusModule Combine(BonusModule otherModule) { BonusModule newModule = new BonusModule(); newModule.ComfortBonus = ComfortBonus + otherModule.ComfortBonus; newModule.StenchRemovalBonus += StenchRemovalBonus + otherModule.StenchRemovalBonus; newModule.GlobalReloadSpeedBonus += GlobalReloadSpeedBonus + otherModule.GlobalReloadSpeedBonus; newModule.GlobalHitChanceBonus += GlobalHitChanceBonus + otherModule.GlobalHitChanceBonus; newModule.GlobalRandomHitsBonus += GlobalRandomHitsBonus + otherModule.GlobalRandomHitsBonus; newModule.GlobalRandomHits = new List <int>(); newModule.GlobalRandomHits.AddRange(GlobalRandomHits); newModule.GlobalRandomHits.AddRange(otherModule.GlobalRandomHits); newModule.ResistanceBonuses = new List <StatBonus>(); newModule.ResistanceBonuses.AddRange(ResistanceBonuses); newModule.ResistanceBonuses.AddRange(otherModule.ResistanceBonuses); newModule.GlobalDamageBonuses = new List <StatBonus>(); newModule.GlobalDamageBonuses.AddRange(GlobalDamageBonuses); newModule.GlobalDamageBonuses.AddRange(otherModule.GlobalDamageBonuses); return(newModule); }
public void UpdateStats() { MaxCooldown = 0f; Comfort = Type.BaseComfort + WallType.ComfortBonus + Type.Bonuses.ComfortBonus + WallType.Bonuses.ComfortBonus; BaseComfort = Comfort; StenchRemovalBonus = Type.Bonuses.StenchRemovalBonus + WallType.Bonuses.StenchRemovalBonus; GlobalReloadSpeedBonus = Type.Bonuses.GlobalReloadSpeedBonus + WallType.Bonuses.GlobalReloadSpeedBonus; GlobalHitChanceBonus = Type.Bonuses.GlobalHitChanceBonus + WallType.Bonuses.GlobalHitChanceBonus;; GlobalRandomHitsBonus = Type.Bonuses.GlobalRandomHitsBonus + WallType.Bonuses.GlobalRandomHitsBonus;; GlobalRandomHits = new List <int>(); Resistances.Clear(); for (int i = 0; i < 4; i++) { // Loop through every upgrade in the floor HomeUpgrade upgrade = HomeUpgrades[i]; if (upgrade != null) { float time = upgrade.UpgradeData.TargetingModule.ReloadTime; if (upgrade.UpgradeData.IsWeapon) { MaxCooldown = Mathf.Max(time, MaxCooldown); } BonusModule bonusModule = upgrade.UpgradeData.BonusModule; // Comfort Comfort += bonusModule.ComfortBonus; StenchRemovalBonus += bonusModule.StenchRemovalBonus; GlobalReloadSpeedBonus += bonusModule.GlobalReloadSpeedBonus; GlobalHitChanceBonus += bonusModule.GlobalHitChanceBonus; GlobalRandomHitsBonus += bonusModule.GlobalRandomHitsBonus; GlobalRandomHits.AddRange(bonusModule.GlobalRandomHits); // Collect resistance bonuses foreach (StatBonus statBonus in upgrade.UpgradeData.BonusModule.ResistanceBonuses) { DamageTypes type = statBonus.DamageType; int amount = statBonus.Bonus; if (!Resistances.ContainsKey(type)) { Resistances[type] = amount; } else { Resistances[type] += amount; } } // Collect damage bonuses foreach (StatBonus statBonus in upgrade.UpgradeData.BonusModule.GlobalDamageBonuses) { DamageTypes type = statBonus.DamageType; int amount = statBonus.Bonus; if (!DamageBonuses.ContainsKey(type)) { DamageBonuses[type] = amount; } else { DamageBonuses[type] += amount; } } } } StenchLevel = 0; MaxCooldown -= GlobalReloadSpeedBonus; }
public BonusController() { _bonusModule = new BonusModule(); }