public void UpgradeNullRatity(IUnitData data) { if (data.Stars > 0) { return; } var countShards = GetShardsForUpgrage(data.Id, data.Stars); if (countShards > data.Shards) { return; } var allAbilities = Static.Abilities.Where(x => x.Value.Params.UnitId == data.Id); foreach (var temp in allAbilities) { data.Abilities[temp.Key] = 1; } var allPerks = Static.Perks.Where(x => x.Value.UnitId == data.Id); foreach (var temp in allPerks) { data.PerkStars[temp.Key] = 1; } data.EquipmentStars = 1; data.Stars = 1; data.Level = 1; data.Shards -= countShards; LogicLog.UpgradeRarityUnit(data.Id, data.Stars); }
public void UpgradeRarity(int unitId) { var(data, unit) = GetUnit(unitId); if (Static.Units[unitId].Rarities.Count == data.Stars) { throw new Exception($"Maximum rarity level reached. unit_id = {unitId}"); } var countShards = GetShardsForUpgrage(unitId, data.Stars); if (data.Shards < countShards) { throw new Exception($"Not enough shards to level up rarity. unit_id = {unitId} countStards = {countShards} neededStards = {data.Shards}"); } data.Stars++; LogicLog.UpgradeRarityUnit(unitId, data.Stars); data.Shards -= countShards; }