2024-08-17 14:52:31 +00:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using System;
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
|
namespace StarsAssistant.Model;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Primary Racial Trait, only PRTs with relevant rules are currently listed.
|
|
|
|
/// </summary>
|
|
|
|
public enum PRT {
|
|
|
|
Other = 0,
|
|
|
|
HE = 1,
|
|
|
|
JOAT = 2
|
|
|
|
}
|
|
|
|
|
|
|
|
public class Race
|
|
|
|
{
|
2024-08-18 17:21:18 +00:00
|
|
|
#region Persistant and derived properties
|
|
|
|
|
2024-08-17 14:52:31 +00:00
|
|
|
[Key]
|
|
|
|
public required string Name { get; set; }
|
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
public bool PlayerRace { get; set; } = false;
|
|
|
|
|
2024-09-17 18:20:42 +00:00
|
|
|
public int? PlayerFileId { get; set; }
|
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int ColonistsPerResource { get; set; } = 1_000;
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int GrowthRatePercent { get; set; } = 15;
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
private PRT _PRT = PRT.Other;
|
2024-08-17 14:52:31 +00:00
|
|
|
public PRT PRT {
|
|
|
|
get => _PRT;
|
|
|
|
set {
|
|
|
|
_PRT = value;
|
|
|
|
UpdatePopDerivedValues();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
private bool _hasOBRM = false;
|
|
|
|
public bool HasOBRM {
|
2024-08-17 14:52:31 +00:00
|
|
|
get => _hasOBRM;
|
|
|
|
set {
|
|
|
|
_hasOBRM = value;
|
|
|
|
UpdatePopDerivedValues();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
public int MaxPopOnPlanet { get; private set; } = 1_000_000;
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
public int MaxEffectivePopOnRed { get; private set; }
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
public int MaxEffectivePopOnGreen { get; private set; }
|
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
private bool _factoryCost3 = false;
|
|
|
|
public bool FactoryCost3 {
|
2024-08-17 14:52:31 +00:00
|
|
|
get => _factoryCost3;
|
|
|
|
set {
|
|
|
|
_factoryCost3 = value;
|
2024-09-24 18:17:49 +00:00
|
|
|
FactoryGerCost = _factoryCost3 ? 3 : 4;
|
2024-08-17 14:52:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
public int FactoryGerCost { get; private set; }
|
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int FactoryNumberPer10k { get; set; } = 10;
|
2024-08-18 17:21:18 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int FactoryResCost { get; set; } = 10;
|
2024-08-18 17:21:18 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int FactoryResPer10 { get; set; } = 10;
|
2024-08-18 17:21:18 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int MineResCost { get; set; } = 5;
|
2024-08-18 17:21:18 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int MineNumberPer10k { get; set; } = 10;
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-09-24 18:17:49 +00:00
|
|
|
public int MineMineralsPer10 { get; set; } = 10;
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
#endregion
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
#region Relationships
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
public ICollection<Planet> Planets { get; } = new List<Planet>();
|
2024-08-17 14:52:31 +00:00
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Public Helpers
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Internal Helpers
|
2024-08-17 14:52:31 +00:00
|
|
|
|
|
|
|
private void UpdatePopDerivedValues() {
|
|
|
|
const int basePop = 1_000_000;
|
|
|
|
var prtMod = PRT switch
|
|
|
|
{
|
|
|
|
PRT.HE => 0.5,
|
|
|
|
PRT.JOAT => 1.2,
|
|
|
|
_ => 1,
|
|
|
|
};
|
2024-09-24 18:17:49 +00:00
|
|
|
double obrmMod = HasOBRM ? 1.1 : 1.0;
|
2024-08-17 14:52:31 +00:00
|
|
|
MaxPopOnPlanet = Convert.ToInt32(basePop * prtMod * obrmMod);
|
2024-09-24 18:17:49 +00:00
|
|
|
MaxEffectivePopOnRed = MaxPopOnPlanet * Services.GameEngine.MinEffectiveValue / 100 * 3;
|
2024-08-17 14:52:31 +00:00
|
|
|
MaxEffectivePopOnGreen = MaxPopOnPlanet * 3;
|
|
|
|
}
|
|
|
|
|
2024-08-18 17:21:18 +00:00
|
|
|
#endregion
|
|
|
|
}
|