93 lines
2.9 KiB
C#
93 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class RobotStats
|
|
{
|
|
public readonly Dictionary<string, RobotTypeStats> RobotTypes = new Dictionary<string, RobotTypeStats>
|
|
{
|
|
{ "stone_robot", new RobotTypeStats(0.75f, 0.60f, 0.80f, 0.80f, 1.40f, -0.10f) },
|
|
{ "copper_robot", new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f) },
|
|
{ "tin_robot", new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f) },
|
|
{ "bronze_robot", new RobotTypeStats(1.15f, 1.10f, 0.90f, 1.10f, 0.80f, 0.05f) },
|
|
{ "iron_robot", new RobotTypeStats(1.35f, 1.25f, 1.15f, 1.20f, 0.65f, 0.10f) }
|
|
};
|
|
private const float BaseMinimumEfficiency = 0.35f;
|
|
|
|
private float speedBonus = 0f;
|
|
private float energyUseReduction = 0f;
|
|
private float heatGainReduction = 0f;
|
|
private float coolingBonus = 0f;
|
|
private float maintenanceLossReduction = 0f;
|
|
private float minimumEfficiencyBonus = 0f;
|
|
|
|
public float GetMovementSpeed(float baseSpeed)
|
|
{
|
|
return baseSpeed * (1f + speedBonus);
|
|
}
|
|
|
|
public float GetEnergyUse(float baseEnergyUse)
|
|
{
|
|
return baseEnergyUse * (1f - Math.Clamp(energyUseReduction, 0f, 0.8f));
|
|
}
|
|
|
|
public float GetHeatGain(float baseHeatGain)
|
|
{
|
|
return baseHeatGain * (1f - Math.Clamp(heatGainReduction, 0f, 0.8f));
|
|
}
|
|
|
|
public float GetCoolingRate(float baseCoolingRate)
|
|
{
|
|
return baseCoolingRate * (1f + coolingBonus);
|
|
}
|
|
|
|
public float GetMaintenanceLoss(float baseMaintenanceLoss)
|
|
{
|
|
return baseMaintenanceLoss * (1f - Math.Clamp(maintenanceLossReduction, 0f, 0.8f));
|
|
}
|
|
|
|
public float GetMinimumEfficiency()
|
|
{
|
|
return Math.Clamp(BaseMinimumEfficiency + minimumEfficiencyBonus, BaseMinimumEfficiency, 0.85f);
|
|
}
|
|
|
|
public void Apply(List<ResearchEffect> effects)
|
|
{
|
|
if (effects == null) return;
|
|
|
|
foreach (ResearchEffect effect in effects)
|
|
{
|
|
Apply(effect);
|
|
}
|
|
}
|
|
|
|
private void Apply(ResearchEffect effect)
|
|
{
|
|
if (effect == null) return;
|
|
|
|
switch (effect.Stat)
|
|
{
|
|
case "robot_speed_bonus":
|
|
speedBonus += effect.Value;
|
|
break;
|
|
case "robot_energy_use_reduction":
|
|
energyUseReduction += effect.Value;
|
|
break;
|
|
case "robot_heat_gain_reduction":
|
|
heatGainReduction += effect.Value;
|
|
break;
|
|
case "robot_cooling_bonus":
|
|
coolingBonus += effect.Value;
|
|
break;
|
|
case "robot_maintenance_loss_reduction":
|
|
maintenanceLossReduction += effect.Value;
|
|
break;
|
|
case "robot_minimum_efficiency_bonus":
|
|
minimumEfficiencyBonus += effect.Value;
|
|
break;
|
|
case "robot_count_increase":
|
|
GameData.maxRobotCount += (int)effect.Value;
|
|
break;
|
|
}
|
|
}
|
|
}
|