82 lines
2.2 KiB
C#
82 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class RobotStats
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|