mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 01:55:42 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72ba7949f6 | ||
|
|
8d37c07f24 | ||
|
|
44b3467306 | ||
|
|
5d66603e1b | ||
|
|
96798a6ad5 | ||
|
|
9273fb0134 | ||
|
|
a874e973e2 | ||
|
|
46a88d17c1 | ||
|
|
c391ce0a4b |
@@ -244,6 +244,7 @@ cc_library(
|
|||||||
deps = [
|
deps = [
|
||||||
":ai_minimum_distance_and_target",
|
":ai_minimum_distance_and_target",
|
||||||
":ai_water_crossing_calculator",
|
":ai_water_crossing_calculator",
|
||||||
|
"//src/main/cpp/net/eagle0/shardok/library:game_state_w",
|
||||||
"//src/main/cpp/net/eagle0/shardok/library/action_point_distances",
|
"//src/main/cpp/net/eagle0/shardok/library/action_point_distances",
|
||||||
"//src/main/cpp/net/eagle0/shardok/library/action_point_distances:action_point_distances_cache",
|
"//src/main/cpp/net/eagle0/shardok/library/action_point_distances:action_point_distances_cache",
|
||||||
"//src/main/protobuf/net/eagle0/shardok/api:command_descriptor_cc_proto",
|
"//src/main/protobuf/net/eagle0/shardok/api:command_descriptor_cc_proto",
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
<Compile Include="Assets/Eagle/CommandSelectors/HandleRiotGiveCommandSelector.cs" />
|
<Compile Include="Assets/Eagle/CommandSelectors/HandleRiotGiveCommandSelector.cs" />
|
||||||
<Compile Include="Assets/Eagle/ProvinceUtils.cs" />
|
<Compile Include="Assets/Eagle/ProvinceUtils.cs" />
|
||||||
<Compile Include="Assets/Eagle/Notifications/ProvinceConqueredNotificationGenerator.cs" />
|
<Compile Include="Assets/Eagle/Notifications/ProvinceConqueredNotificationGenerator.cs" />
|
||||||
|
<Compile Include="Assets/common/GUIUtils/ProvinceStatUtils.cs" />
|
||||||
<Compile Include="Assets/Eagle/Table Rows/ExchangedHeroRowController.cs" />
|
<Compile Include="Assets/Eagle/Table Rows/ExchangedHeroRowController.cs" />
|
||||||
<Compile Include="Assets/Eagle/Table Rows/ExtraTroopsRowController.cs" />
|
<Compile Include="Assets/Eagle/Table Rows/ExtraTroopsRowController.cs" />
|
||||||
<Compile Include="Assets/Eagle/Notifications/PrisonerEscapedNotificationGenerator.cs" />
|
<Compile Include="Assets/Eagle/Notifications/PrisonerEscapedNotificationGenerator.cs" />
|
||||||
|
|||||||
+13
-13
@@ -25,7 +25,7 @@ namespace eagle {
|
|||||||
private ImprovementType SelectedType =>
|
private ImprovementType SelectedType =>
|
||||||
ImproveAvailableCommand.AvailableTypes[SelectedTypeIndex];
|
ImproveAvailableCommand.AvailableTypes[SelectedTypeIndex];
|
||||||
|
|
||||||
private double OriginalImprovementValueForType(ImprovementType type) {
|
private float OriginalImprovementValueForType(ImprovementType type) {
|
||||||
var province = _model.Provinces[ActingProvinceId];
|
var province = _model.Provinces[ActingProvinceId];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ImprovementType.Agriculture: return province.FullInfo.Agriculture;
|
case ImprovementType.Agriculture: return province.FullInfo.Agriculture;
|
||||||
@@ -39,7 +39,7 @@ namespace eagle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double EffectiveImprovementValueForType(ImprovementType type) {
|
private float EffectiveImprovementValueForType(ImprovementType type) {
|
||||||
var province = _model.Provinces[ActingProvinceId];
|
var province = _model.Provinces[ActingProvinceId];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ImprovementType.Agriculture:
|
case ImprovementType.Agriculture:
|
||||||
@@ -59,10 +59,10 @@ namespace eagle {
|
|||||||
|
|
||||||
private int MinimumImprovementIndex(ProvinceView province) {
|
private int MinimumImprovementIndex(ProvinceView province) {
|
||||||
var minIndex = 0;
|
var minIndex = 0;
|
||||||
double minValue =
|
float minValue =
|
||||||
OriginalImprovementValueForType(ImproveAvailableCommand.AvailableTypes[0]);
|
OriginalImprovementValueForType(ImproveAvailableCommand.AvailableTypes[0]);
|
||||||
for (int i = 1; i < ImproveAvailableCommand.AvailableTypes.Count; i++) {
|
for (int i = 1; i < ImproveAvailableCommand.AvailableTypes.Count; i++) {
|
||||||
double thisVal =
|
float thisVal =
|
||||||
OriginalImprovementValueForType(ImproveAvailableCommand.AvailableTypes[i]);
|
OriginalImprovementValueForType(ImproveAvailableCommand.AvailableTypes[i]);
|
||||||
if (thisVal < minValue) {
|
if (thisVal < minValue) {
|
||||||
minIndex = i;
|
minIndex = i;
|
||||||
@@ -139,21 +139,21 @@ namespace eagle {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private string DropdownStringForType(ImprovementType type) {
|
private string DropdownStringForType(ImprovementType type) {
|
||||||
var originalStat = RoundedNonzeroStat(OriginalImprovementValueForType(type));
|
var originalStat =
|
||||||
|
type == ImprovementType.Devastation
|
||||||
|
? ProvinceStatUtils.RoundedDevastation(
|
||||||
|
OriginalImprovementValueForType(type))
|
||||||
|
: ProvinceStatUtils.RoundedStat(OriginalImprovementValueForType(type));
|
||||||
if (type == ImprovementType.Devastation) {
|
if (type == ImprovementType.Devastation) {
|
||||||
return $"{type} ({GUIUtils.ColoredString(UnityEngine.Color.red, originalStat)})";
|
return $"{type} ({GUIUtils.ColoredString(UnityEngine.Color.red, originalStat.ToString())})";
|
||||||
}
|
}
|
||||||
var devastatedStat = RoundedNonzeroStat(EffectiveImprovementValueForType(type));
|
var devastatedStat =
|
||||||
|
ProvinceStatUtils.RoundedStat(EffectiveImprovementValueForType(type));
|
||||||
if (devastatedStat == originalStat) {
|
if (devastatedStat == originalStat) {
|
||||||
return $"{type} ({devastatedStat})";
|
return $"{type} ({devastatedStat})";
|
||||||
} else {
|
} else {
|
||||||
return $"{type} ({GUIUtils.ColoredString(UnityEngine.Color.red, devastatedStat)} / {originalStat})";
|
return $"{type} ({GUIUtils.ColoredString(UnityEngine.Color.red, devastatedStat.ToString())} / {originalStat})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string RoundedNonzeroStat(double stat) {
|
|
||||||
var rounded = Math.Max(1, Math.Round(stat, MidpointRounding.AwayFromZero));
|
|
||||||
return rounded.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using common;
|
using common;
|
||||||
|
using EagleGUIUtils;
|
||||||
using Net.Eagle0.Eagle.Api;
|
using Net.Eagle0.Eagle.Api;
|
||||||
using Net.Eagle0.Eagle.Common;
|
using Net.Eagle0.Eagle.Common;
|
||||||
using Net.Eagle0.Eagle.Views;
|
using Net.Eagle0.Eagle.Views;
|
||||||
@@ -235,8 +236,8 @@ namespace eagle {
|
|||||||
allowed,
|
allowed,
|
||||||
OrganizeTroopsAvailableCommand.AvailableBattalionTypes.First(
|
OrganizeTroopsAvailableCommand.AvailableBattalionTypes.First(
|
||||||
tp => tp.TypeId == battalionTypeId),
|
tp => tp.TypeId == battalionTypeId),
|
||||||
Province.FullInfo.Agriculture,
|
ProvinceStatUtils.RoundedStat(Province.FullInfo.Agriculture),
|
||||||
Province.FullInfo.Economy);
|
ProvinceStatUtils.RoundedStat(Province.FullInfo.Economy));
|
||||||
|
|
||||||
parent.GetComponentInChildren<Button>().interactable = allowed;
|
parent.GetComponentInChildren<Button>().interactable = allowed;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ namespace eagle {
|
|||||||
|
|
||||||
private readonly Func<ProvinceView, String> _nameSortFunc = p => p.Name;
|
private readonly Func<ProvinceView, String> _nameSortFunc = p => p.Name;
|
||||||
|
|
||||||
private readonly Dictionary<SortKey, Func<ProvinceView, int>> _sortFuncs = new() {
|
private readonly Dictionary<SortKey, Func<ProvinceView, IComparable>> _sortFuncs = new() {
|
||||||
{ SortKey.Support, p => p.FullInfo.Support.Stat },
|
{ SortKey.Support, p => p.FullInfo.Support.Stat },
|
||||||
{ SortKey.Commanders, p => p.FullInfo.RulingFactionHeroIds.Count },
|
{ SortKey.Commanders, p => p.FullInfo.RulingFactionHeroIds.Count },
|
||||||
{ SortKey.Battalions, p => p.FullInfo.Battalions.Count },
|
{ SortKey.Battalions, p => p.FullInfo.Battalions.Count },
|
||||||
|
|||||||
+10
-7
@@ -225,25 +225,27 @@ namespace eagle {
|
|||||||
ConsumedField.text = $"{Province.FullInfo.FoodConsumption}";
|
ConsumedField.text = $"{Province.FullInfo.FoodConsumption}";
|
||||||
priceIndexField.text = $"{Province.FullInfo.PriceIndex,4:F2}";
|
priceIndexField.text = $"{Province.FullInfo.PriceIndex,4:F2}";
|
||||||
|
|
||||||
EconomyField.text = $"{Province.FullInfo.Economy}";
|
EconomyField.text = $"{ProvinceStatUtils.RoundedStat(Province.FullInfo.Economy)}";
|
||||||
if (Province.FullInfo.EconomyDevastation > 0) {
|
if (Province.FullInfo.EconomyDevastation > 0) {
|
||||||
var devastatedEconomy =
|
var devastatedEconomy =
|
||||||
$"{Math.Max(0.0, Province.FullInfo.Economy - Province.FullInfo.EconomyDevastation)}";
|
$"{ProvinceStatUtils.RoundedStat(Math.Max(0.0f, Province.FullInfo.Economy - Province.FullInfo.EconomyDevastation))}";
|
||||||
EconomyField.text += $" ({GUIUtils.ColoredString(Color.red, devastatedEconomy)})";
|
EconomyField.text += $" ({GUIUtils.ColoredString(Color.red, devastatedEconomy)})";
|
||||||
}
|
}
|
||||||
|
|
||||||
AgricultureField.text = $"{Province.FullInfo.Agriculture}";
|
AgricultureField.text =
|
||||||
|
$"{ProvinceStatUtils.RoundedStat(Province.FullInfo.Agriculture)}";
|
||||||
if (Province.FullInfo.AgricultureDevastation > 0) {
|
if (Province.FullInfo.AgricultureDevastation > 0) {
|
||||||
var devastatedAgriculture =
|
var devastatedAgriculture =
|
||||||
$"{Math.Max(0.0, Province.FullInfo.Agriculture - Province.FullInfo.AgricultureDevastation)}";
|
$"{ProvinceStatUtils.RoundedStat(Math.Max(0.0f, Province.FullInfo.Agriculture - Province.FullInfo.AgricultureDevastation))}";
|
||||||
AgricultureField.text +=
|
AgricultureField.text +=
|
||||||
$" ({GUIUtils.ColoredString(Color.red, devastatedAgriculture)})";
|
$" ({GUIUtils.ColoredString(Color.red, devastatedAgriculture)})";
|
||||||
}
|
}
|
||||||
|
|
||||||
InfrastructureField.text = $"{Province.FullInfo.Infrastructure}";
|
InfrastructureField.text =
|
||||||
|
$"{ProvinceStatUtils.RoundedStat(Province.FullInfo.Infrastructure)}";
|
||||||
if (Province.FullInfo.InfrastructureDevastation > 0) {
|
if (Province.FullInfo.InfrastructureDevastation > 0) {
|
||||||
var devastatedInfrastructure =
|
var devastatedInfrastructure =
|
||||||
$"{Math.Max(0.0, Province.FullInfo.Infrastructure - Province.FullInfo.InfrastructureDevastation)}";
|
$"{ProvinceStatUtils.RoundedStat(Math.Max(0.0f, Province.FullInfo.Infrastructure - Province.FullInfo.InfrastructureDevastation))}";
|
||||||
InfrastructureField.text +=
|
InfrastructureField.text +=
|
||||||
$" ({GUIUtils.ColoredString(Color.red, devastatedInfrastructure)})";
|
$" ({GUIUtils.ColoredString(Color.red, devastatedInfrastructure)})";
|
||||||
}
|
}
|
||||||
@@ -251,7 +253,8 @@ namespace eagle {
|
|||||||
var totalDevastation = Province.FullInfo.EconomyDevastation +
|
var totalDevastation = Province.FullInfo.EconomyDevastation +
|
||||||
Province.FullInfo.AgricultureDevastation +
|
Province.FullInfo.AgricultureDevastation +
|
||||||
Province.FullInfo.InfrastructureDevastation;
|
Province.FullInfo.InfrastructureDevastation;
|
||||||
var totalDevastationString = $"{totalDevastation}";
|
var totalDevastationString =
|
||||||
|
$"{ProvinceStatUtils.RoundedDevastation(totalDevastation)}";
|
||||||
if (totalDevastation > 0) {
|
if (totalDevastation > 0) {
|
||||||
DevastationField.text =
|
DevastationField.text =
|
||||||
$"{GUIUtils.ColoredString(Color.red, totalDevastationString)}";
|
$"{GUIUtils.ColoredString(Color.red, totalDevastationString)}";
|
||||||
|
|||||||
+5
-5
@@ -37,14 +37,14 @@ namespace eagle {
|
|||||||
private ProvinceId ProvinceId;
|
private ProvinceId ProvinceId;
|
||||||
private DynamicHeroTextUpdater textUpdater = new DynamicHeroTextUpdater();
|
private DynamicHeroTextUpdater textUpdater = new DynamicHeroTextUpdater();
|
||||||
|
|
||||||
private void SetDevastatedValue(TMP_Text textField, double baseValue, double devastation) {
|
private void SetDevastatedValue(TMP_Text textField, float baseValue, float devastation) {
|
||||||
if (devastation == 0.0) {
|
if (devastation == 0.0f) {
|
||||||
textField.color = Color.black;
|
textField.color = Color.black;
|
||||||
textField.text = baseValue.ToString();
|
textField.text = ProvinceStatUtils.RoundedStat(baseValue).ToString();
|
||||||
} else {
|
} else {
|
||||||
textField.color = Color.red;
|
textField.color = Color.red;
|
||||||
var devastatedValue = Math.Max(0.0, baseValue - devastation);
|
var devastatedValue = Math.Max(0.0f, baseValue - devastation);
|
||||||
textField.text = devastatedValue.ToString();
|
textField.text = ProvinceStatUtils.RoundedStat(devastatedValue).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Utility methods for rounding province statistics for display.
|
||||||
|
/// These methods match the rounding logic from ProvinceViewFilter.scala
|
||||||
|
/// </summary>
|
||||||
|
public static class ProvinceStatUtils {
|
||||||
|
/// <summary>
|
||||||
|
/// Rounds a stat value using the same logic as roundedStat in ProvinceViewFilter.scala:
|
||||||
|
/// - If stat == 0, return 0
|
||||||
|
/// - If stat < 1, return 1
|
||||||
|
/// - Otherwise, return floor of stat
|
||||||
|
/// </summary>
|
||||||
|
public static int RoundedStat(float stat) {
|
||||||
|
if (stat == 0) return 0;
|
||||||
|
else if (stat < 1)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return (int)Math.Floor(stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rounds a devastation value using the same logic as roundedDevastation in
|
||||||
|
/// ProvinceViewFilter.scala:
|
||||||
|
/// - Return ceiling of stat
|
||||||
|
/// </summary>
|
||||||
|
public static int RoundedDevastation(float stat) { return (int)Math.Ceiling(stat); }
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d6672bb4c46b44b10abe885e064119d0
|
||||||
+4
@@ -28,6 +28,10 @@ func main() {
|
|||||||
|
|
||||||
capitalizedSettingType := capitalized(settingType)
|
capitalizedSettingType := capitalized(settingType)
|
||||||
|
|
||||||
|
if capitalizedSettingType == "Float" {
|
||||||
|
settingValue += "f"
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf(`// Generated file, do not edit!
|
fmt.Printf(`// Generated file, do not edit!
|
||||||
|
|
||||||
package net.eagle0.eagle.library.settings
|
package net.eagle0.eagle.library.settings
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ message BeastInfo {
|
|||||||
double likelihood = 4;
|
double likelihood = 4;
|
||||||
double max_count_multiplier = 5;
|
double max_count_multiplier = 5;
|
||||||
double relative_power = 6;
|
double relative_power = 6;
|
||||||
double economy_devastation = 7;
|
float economy_devastation = 7;
|
||||||
double agriculture_devastation = 8;
|
float agriculture_devastation = 8;
|
||||||
double infrastructure_devastation = 9;
|
float infrastructure_devastation = 9;
|
||||||
double average_gold_per = 10;
|
double average_gold_per = 10;
|
||||||
double average_food_per = 11;
|
double average_food_per = 11;
|
||||||
}
|
}
|
||||||
@@ -69,16 +69,16 @@ message ChangedProvince {
|
|||||||
.google.protobuf.Int32Value gold_delta = 14;
|
.google.protobuf.Int32Value gold_delta = 14;
|
||||||
.google.protobuf.Int32Value food_delta = 15;
|
.google.protobuf.Int32Value food_delta = 15;
|
||||||
|
|
||||||
.google.protobuf.DoubleValue new_price_index = 35;
|
.google.protobuf.FloatValue new_price_index = 35;
|
||||||
|
|
||||||
.google.protobuf.DoubleValue economy_delta = 16;
|
.google.protobuf.FloatValue economy_delta = 16;
|
||||||
.google.protobuf.DoubleValue agriculture_delta = 17;
|
.google.protobuf.FloatValue agriculture_delta = 17;
|
||||||
.google.protobuf.DoubleValue infrastructure_delta = 18;
|
.google.protobuf.FloatValue infrastructure_delta = 18;
|
||||||
.google.protobuf.DoubleValue economy_devastation_delta = 44;
|
.google.protobuf.FloatValue economy_devastation_delta = 44;
|
||||||
.google.protobuf.DoubleValue agriculture_devastation_delta = 47;
|
.google.protobuf.FloatValue agriculture_devastation_delta = 47;
|
||||||
.google.protobuf.DoubleValue infrastructure_devastation_delta = 48;
|
.google.protobuf.FloatValue infrastructure_devastation_delta = 48;
|
||||||
|
|
||||||
.google.protobuf.DoubleValue support_delta = 19;
|
.google.protobuf.FloatValue support_delta = 19;
|
||||||
|
|
||||||
.google.protobuf.BoolValue set_has_acted = 20;
|
.google.protobuf.BoolValue set_has_acted = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ option objc_class_prefix = "E0G";
|
|||||||
message ProvinceOverrides {
|
message ProvinceOverrides {
|
||||||
int32 province_id = 1; // can be 0 for a generic
|
int32 province_id = 1; // can be 0 for a generic
|
||||||
|
|
||||||
double economy = 2;
|
float economy = 2;
|
||||||
double agriculture = 3;
|
float agriculture = 3;
|
||||||
double infrastructure = 4;
|
float infrastructure = 4;
|
||||||
|
|
||||||
double support = 5;
|
float support = 5;
|
||||||
|
|
||||||
int32 food = 6;
|
int32 food = 6;
|
||||||
int32 gold = 7;
|
int32 gold = 7;
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ message Province {
|
|||||||
repeated IncomingEndTurnAction incoming_end_turn_actions = 27;
|
repeated IncomingEndTurnAction incoming_end_turn_actions = 27;
|
||||||
Army defending_army = 11;
|
Army defending_army = 11;
|
||||||
|
|
||||||
double economy = 12;
|
float economy = 12;
|
||||||
double agriculture = 13;
|
float agriculture = 13;
|
||||||
double infrastructure = 14;
|
float infrastructure = 14;
|
||||||
double economy_devastation = 34;
|
float economy_devastation = 34;
|
||||||
double agriculture_devastation = 37;
|
float agriculture_devastation = 37;
|
||||||
double infrastructure_devastation = 38;
|
float infrastructure_devastation = 38;
|
||||||
|
|
||||||
// Can be None.
|
// Can be None.
|
||||||
.net.eagle0.eagle.common.ImprovementType locked_improvement_type = 41;
|
.net.eagle0.eagle.common.ImprovementType locked_improvement_type = 41;
|
||||||
@@ -92,9 +92,9 @@ message Province {
|
|||||||
|
|
||||||
// Current price index where 1.0 is "standard". Expected to vary between
|
// Current price index where 1.0 is "standard". Expected to vary between
|
||||||
// 0.5 and 1.5.
|
// 0.5 and 1.5.
|
||||||
double price_index = 29;
|
float price_index = 29;
|
||||||
|
|
||||||
double support = 17;
|
float support = 17;
|
||||||
|
|
||||||
bool has_acted = 18;
|
bool has_acted = 18;
|
||||||
|
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ message FullProvinceInfo {
|
|||||||
|
|
||||||
ArmyView defending_army = 7;
|
ArmyView defending_army = 7;
|
||||||
|
|
||||||
int32 economy = 8;
|
float economy = 8;
|
||||||
int32 agriculture = 9;
|
float agriculture = 9;
|
||||||
int32 infrastructure = 10;
|
float infrastructure = 10;
|
||||||
int32 economy_devastation = 25;
|
float economy_devastation = 25;
|
||||||
int32 agriculture_devastation = 26;
|
float agriculture_devastation = 26;
|
||||||
int32 infrastructure_devastation = 27;
|
float infrastructure_devastation = 27;
|
||||||
|
|
||||||
int32 gold = 11;
|
int32 gold = 11;
|
||||||
int32 food = 12;
|
int32 food = 12;
|
||||||
@@ -130,12 +130,12 @@ message FullProvinceInfoDiff {
|
|||||||
|
|
||||||
.google.protobuf.DoubleValue new_price_index = 36;
|
.google.protobuf.DoubleValue new_price_index = 36;
|
||||||
|
|
||||||
.google.protobuf.Int32Value economy = 16;
|
.google.protobuf.FloatValue economy = 16;
|
||||||
.google.protobuf.Int32Value agriculture = 17;
|
.google.protobuf.FloatValue agriculture = 17;
|
||||||
.google.protobuf.Int32Value infrastructure = 18;
|
.google.protobuf.FloatValue infrastructure = 18;
|
||||||
.google.protobuf.Int32Value economy_devastation = 30;
|
.google.protobuf.FloatValue economy_devastation = 30;
|
||||||
.google.protobuf.Int32Value agriculture_devastation = 31;
|
.google.protobuf.FloatValue agriculture_devastation = 31;
|
||||||
.google.protobuf.Int32Value infrastructure_devastation = 32;
|
.google.protobuf.FloatValue infrastructure_devastation = 32;
|
||||||
|
|
||||||
StatWithCondition support = 19;
|
StatWithCondition support = 19;
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ vassalCommandsMaxFatigueLevelBeforeResting 15 Double
|
|||||||
vassalCommandsMinOddsForRecruitment 50 Double
|
vassalCommandsMinOddsForRecruitment 50 Double
|
||||||
maxCombatUnitCountPerSide 9999 Int
|
maxCombatUnitCountPerSide 9999 Int
|
||||||
maxAlmsFood 1000 Int
|
maxAlmsFood 1000 Int
|
||||||
almsSupportIncreasePerFood 0.01 Double
|
almsSupportIncreasePerFood 0.01 Float
|
||||||
almsPaladinSupportMultiplier 4 Double
|
almsPaladinSupportMultiplier 4 Float
|
||||||
foodPerProvinceHeldBack 1000 Int
|
foodPerProvinceHeldBack 1000 Int
|
||||||
factionBiasFromImprisonment -100 Double
|
factionBiasFromImprisonment -100 Double
|
||||||
factionBiasFromExile -50 Double
|
factionBiasFromExile -50 Double
|
||||||
@@ -80,8 +80,8 @@ riotEventChance 0.02 Double
|
|||||||
minVigorForSuppressBeasts 50 Double
|
minVigorForSuppressBeasts 50 Double
|
||||||
suppressBeastsPrestigeBonus 2 Int
|
suppressBeastsPrestigeBonus 2 Int
|
||||||
beastsDurationMonths 4 Int
|
beastsDurationMonths 4 Int
|
||||||
beastsSupportDamage 3 Double
|
beastsSupportDamage 3 Float
|
||||||
suppressBeastsSupportBonus 5 Double
|
suppressBeastsSupportBonus 5 Float
|
||||||
maxInfrastructureForbeasts 50 Int
|
maxInfrastructureForbeasts 50 Int
|
||||||
failedSuppressBeastsPrestigePenalty 5 Int
|
failedSuppressBeastsPrestigePenalty 5 Int
|
||||||
baseBeastsCount 150 Int
|
baseBeastsCount 150 Int
|
||||||
@@ -165,13 +165,13 @@ minMonthsAfterPleaseRecruitMeRejectionBeforeTryingAgain 12 Int
|
|||||||
exiledHeroFactionBias -500 Double
|
exiledHeroFactionBias -500 Double
|
||||||
minVigorForApprehendOutlaw 50 Double
|
minVigorForApprehendOutlaw 50 Double
|
||||||
apprehendOutlawVigorCost 30 Double
|
apprehendOutlawVigorCost 30 Double
|
||||||
battleEconomyDevastationDelta 10 Double
|
battleEconomyDevastationDelta 10 Float
|
||||||
battleAgricultureDevastationDelta 10 Double
|
battleAgricultureDevastationDelta 10 Float
|
||||||
battleInfrastructureDevastationDelta 10 Double
|
battleInfrastructureDevastationDelta 10 Float
|
||||||
minVigorForCrackDown 50 Double
|
minVigorForCrackDown 50 Double
|
||||||
riotSupportDelta -25 Double
|
riotSupportDelta -25 Float
|
||||||
riotEconomyDevastationDelta 25 Double
|
riotEconomyDevastationDelta 25 Float
|
||||||
riotInfrastructureDevastationDelta 25 Double
|
riotInfrastructureDevastationDelta 25 Float
|
||||||
riotMaxFood 1000 Int
|
riotMaxFood 1000 Int
|
||||||
riotMaxGold 500 Int
|
riotMaxGold 500 Int
|
||||||
riotCharismaFactor 0.1 Double
|
riotCharismaFactor 0.1 Double
|
||||||
@@ -184,9 +184,9 @@ monthsBetweenRiotsSupportMultiplier 0.5 Double
|
|||||||
blizzardEventChance 0.01 Double
|
blizzardEventChance 0.01 Double
|
||||||
maxBlizzardDurationMonths 4 Int
|
maxBlizzardDurationMonths 4 Int
|
||||||
winterSuppliesLoss 0.25 Double
|
winterSuppliesLoss 0.25 Double
|
||||||
blizzardEconomyDevastationDelta 4 Double
|
blizzardEconomyDevastationDelta 4 Float
|
||||||
blizzardInfrastructureDevastationDelta 4 Double
|
blizzardInfrastructureDevastationDelta 4 Float
|
||||||
blizzardAgricultureDevastationDelta 4 Double
|
blizzardAgricultureDevastationDelta 4 Float
|
||||||
festivalEventChance 0.01 Double
|
festivalEventChance 0.01 Double
|
||||||
maxFestivalDurationMonths 3 Int
|
maxFestivalDurationMonths 3 Int
|
||||||
festivalSupportDelta 8 Double
|
festivalSupportDelta 8 Double
|
||||||
@@ -197,12 +197,12 @@ maxDesiredTruceCountForQuest 5 Int
|
|||||||
minDesiredNewTruceCountForQuest 2 Int
|
minDesiredNewTruceCountForQuest 2 Int
|
||||||
floodEventChance 0.01 Double
|
floodEventChance 0.01 Double
|
||||||
floodDurationMonths 1 Int
|
floodDurationMonths 1 Int
|
||||||
maxFloodInfrastructureDevastationDelta 20 Double
|
maxFloodInfrastructureDevastationDelta 20 Float
|
||||||
maxFloodAgricultureDevastationDelta 20 Double
|
maxFloodAgricultureDevastationDelta 20 Float
|
||||||
floodDevastationDeltaReductionPerInfrastructure 0.3 Double
|
floodDevastationDeltaReductionPerInfrastructure 0.3 Float
|
||||||
epidemicBreakoutChance 0.0015 Double
|
epidemicBreakoutChance 0.0015 Double
|
||||||
epidemicSpreadChance 0.03 Double
|
epidemicSpreadChance 0.03 Double
|
||||||
epidemicEconomyDevastationDelta 10 Double
|
epidemicEconomyDevastationDelta 10 Float
|
||||||
epidemicBattalionLossPercentage 0.05 Double
|
epidemicBattalionLossPercentage 0.05 Double
|
||||||
epidemicVigorDelta -10 Double
|
epidemicVigorDelta -10 Double
|
||||||
epidemicEndChance 0.35 Double
|
epidemicEndChance 0.35 Double
|
||||||
@@ -215,9 +215,9 @@ startEpidemicCharismaXp 25 Int
|
|||||||
startEpidemicVigorDelta -30 Double
|
startEpidemicVigorDelta -30 Double
|
||||||
droughtEventChance 0.01 Double
|
droughtEventChance 0.01 Double
|
||||||
droughtDurationMonths 3 Int
|
droughtDurationMonths 3 Int
|
||||||
droughtAgricultureDevastationDelta 10 Double
|
droughtAgricultureDevastationDelta 10 Float
|
||||||
controlWeatherDroughtDurationMonths 3 Int
|
controlWeatherDroughtDurationMonths 3 Int
|
||||||
emptyProvinceMonthlyDevastationDelta -2 Double
|
emptyProvinceMonthlyDevastationDelta -2 Float
|
||||||
vigorToConstitutionXpMultiplier 0.2 Double
|
vigorToConstitutionXpMultiplier 0.2 Double
|
||||||
trustDeltaPerRound 1 Int
|
trustDeltaPerRound 1 Int
|
||||||
trustDeltaForImprisoningOwnHero -150 Int
|
trustDeltaForImprisoningOwnHero -150 Int
|
||||||
@@ -264,9 +264,9 @@ giftProvinceCountExponent 0.5 Double
|
|||||||
minChanceForAIInvite 70 Int
|
minChanceForAIInvite 70 Int
|
||||||
chronicleWordCount 200 Int
|
chronicleWordCount 200 Int
|
||||||
maxDistanceForDefeatFactionQuest 3 Int
|
maxDistanceForDefeatFactionQuest 3 Int
|
||||||
minimumPriceIndex 0.75 Double
|
minimumPriceIndex 0.75 Float
|
||||||
maximumPriceIndex 1.5 Double
|
maximumPriceIndex 1.5 Float
|
||||||
priceIndexReturnRate 0.1 Double
|
priceIndexReturnRate 0.1 Float
|
||||||
priceIndexShiftPerGold 0.0001 Double
|
priceIndexShiftPerGold 0.0001 Float
|
||||||
aiTruceAcceptanceBaseChance 100 Double
|
aiTruceAcceptanceBaseChance 100 Double
|
||||||
aiAllianceAcceptanceBaseChance 100 Double
|
aiAllianceAcceptanceBaseChance 100 Double
|
||||||
|
+13
-13
@@ -185,33 +185,33 @@ class ActionResultProtoApplierImpl(validator: Validator)
|
|||||||
},
|
},
|
||||||
_.priceIndex.setIfDefined(cp.newPriceIndex),
|
_.priceIndex.setIfDefined(cp.newPriceIndex),
|
||||||
_.economy.modify(e =>
|
_.economy.modify(e =>
|
||||||
(e + cp.economyDelta.getOrElse(0.0)).max(0.0).min(100.0)
|
(e + cp.economyDelta.getOrElse(0.0f)).max(0.0f).min(100.0f)
|
||||||
),
|
),
|
||||||
_.agriculture
|
_.agriculture
|
||||||
.modify(a =>
|
.modify(a =>
|
||||||
(a + cp.agricultureDelta.getOrElse(0.0)).max(0.0).min(100.0)
|
(a + cp.agricultureDelta.getOrElse(0.0f)).max(0.0f).min(100.0f)
|
||||||
),
|
),
|
||||||
_.infrastructure
|
_.infrastructure
|
||||||
.modify(i =>
|
.modify(i =>
|
||||||
(i + cp.infrastructureDelta.getOrElse(0.0)).max(0.0).min(100.0)
|
(i + cp.infrastructureDelta.getOrElse(0.0f)).max(0.0f).min(100.0f)
|
||||||
),
|
),
|
||||||
_.economyDevastation.modify(d =>
|
_.economyDevastation.modify(d =>
|
||||||
(d + cp.economyDevastationDelta.getOrElse(0.0))
|
(d + cp.economyDevastationDelta.getOrElse(0.0f))
|
||||||
.max(0.0)
|
.max(0.0f)
|
||||||
.min(provinceBefore.economy)
|
.min(provinceBefore.economy)
|
||||||
),
|
),
|
||||||
_.agricultureDevastation.modify(d =>
|
_.agricultureDevastation.modify(d =>
|
||||||
(d + cp.agricultureDevastationDelta.getOrElse(0.0))
|
(d + cp.agricultureDevastationDelta.getOrElse(0.0f))
|
||||||
.max(0.0)
|
.max(0.0f)
|
||||||
.min(provinceBefore.agriculture)
|
.min(provinceBefore.agriculture)
|
||||||
),
|
),
|
||||||
_.infrastructureDevastation.modify(d =>
|
_.infrastructureDevastation.modify(d =>
|
||||||
(d + cp.infrastructureDevastationDelta.getOrElse(0.0))
|
(d + cp.infrastructureDevastationDelta.getOrElse(0.0f))
|
||||||
.max(0.0)
|
.max(0.0f)
|
||||||
.min(provinceBefore.infrastructure)
|
.min(provinceBefore.infrastructure)
|
||||||
),
|
),
|
||||||
_.support.modify(s =>
|
_.support.modify(s =>
|
||||||
(s + cp.supportDelta.getOrElse(0.0)).max(0.0).min(100.0)
|
(s + cp.supportDelta.getOrElse(0.0f)).max(0.0f).min(100.0f)
|
||||||
),
|
),
|
||||||
_.hasActed.setIfDefined(cp.setHasActed),
|
_.hasActed.setIfDefined(cp.setHasActed),
|
||||||
_.rulerIsTraveling.setIfDefined(cp.setRulerIsTraveling),
|
_.rulerIsTraveling.setIfDefined(cp.setRulerIsTraveling),
|
||||||
@@ -528,7 +528,7 @@ class ActionResultProtoApplierImpl(validator: Validator)
|
|||||||
_.vigor.modify { v =>
|
_.vigor.modify { v =>
|
||||||
ch.vigor match {
|
ch.vigor match {
|
||||||
case Vigor.VigorDelta(d) =>
|
case Vigor.VigorDelta(d) =>
|
||||||
(v + d).max(0.0).min(gameState.heroes(ch.id).constitution)
|
(v + d).max(0.0f).min(gameState.heroes(ch.id).constitution)
|
||||||
|
|
||||||
case Vigor.VigorAbsolute(va) =>
|
case Vigor.VigorAbsolute(va) =>
|
||||||
internalRequire(
|
internalRequire(
|
||||||
@@ -548,7 +548,7 @@ class ActionResultProtoApplierImpl(validator: Validator)
|
|||||||
_.loyalty.modify { l =>
|
_.loyalty.modify { l =>
|
||||||
ch.loyalty match {
|
ch.loyalty match {
|
||||||
case Loyalty.LoyaltyDelta(ld) =>
|
case Loyalty.LoyaltyDelta(ld) =>
|
||||||
val newL = Math.min(100.0, Math.max(0, l + ld))
|
val newL = Math.min(100.0f, Math.max(0, l + ld))
|
||||||
newL
|
newL
|
||||||
|
|
||||||
case Loyalty.LoyaltyAbsolute(la) =>
|
case Loyalty.LoyaltyAbsolute(la) =>
|
||||||
@@ -557,7 +557,7 @@ class ActionResultProtoApplierImpl(validator: Validator)
|
|||||||
s"Got a negative absolute loyalty of $la"
|
s"Got a negative absolute loyalty of $la"
|
||||||
)
|
)
|
||||||
internalRequire(
|
internalRequire(
|
||||||
la <= 100.0,
|
la <= 100.0f,
|
||||||
s"Got an absolute loyalty of $la"
|
s"Got an absolute loyalty of $la"
|
||||||
)
|
)
|
||||||
la
|
la
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ object AvailableArmTroopsCommandFactory
|
|||||||
)
|
)
|
||||||
.map(tp =>
|
.map(tp =>
|
||||||
ArmamentCost(
|
ArmamentCost(
|
||||||
cost = tp.baseArmamentCostPerTroop * province.priceIndex,
|
cost = tp.baseArmamentCostPerTroop.toFloat * province.priceIndex,
|
||||||
`type` = tp.typeId
|
`type` = tp.typeId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ case class NewRoundAction(startingState: GameState, gameHistory: GameHistory)
|
|||||||
Math
|
Math
|
||||||
.max(
|
.max(
|
||||||
-p.economyDevastation,
|
-p.economyDevastation,
|
||||||
EmptyProvinceMonthlyDevastationDelta.doubleValue
|
EmptyProvinceMonthlyDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
agricultureDevastationDelta = Option.when(
|
agricultureDevastationDelta = Option.when(
|
||||||
@@ -196,7 +196,7 @@ case class NewRoundAction(startingState: GameState, gameHistory: GameHistory)
|
|||||||
Math
|
Math
|
||||||
.max(
|
.max(
|
||||||
-p.agricultureDevastation,
|
-p.agricultureDevastation,
|
||||||
EmptyProvinceMonthlyDevastationDelta.doubleValue
|
EmptyProvinceMonthlyDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
infrastructureDevastationDelta = Option.when(
|
infrastructureDevastationDelta = Option.when(
|
||||||
@@ -205,7 +205,7 @@ case class NewRoundAction(startingState: GameState, gameHistory: GameHistory)
|
|||||||
Math
|
Math
|
||||||
.max(
|
.max(
|
||||||
-p.infrastructureDevastation,
|
-p.infrastructureDevastation,
|
||||||
EmptyProvinceMonthlyDevastationDelta.doubleValue
|
EmptyProvinceMonthlyDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -25,9 +25,14 @@ case class NewYearAction(gameState: GameState)
|
|||||||
extends DeterministicSingleResultAction(gameState) {
|
extends DeterministicSingleResultAction(gameState) {
|
||||||
private def degradationMultiplier: Double =
|
private def degradationMultiplier: Double =
|
||||||
PercentDegradationPerYear.doubleValue / 100.0
|
PercentDegradationPerYear.doubleValue / 100.0
|
||||||
|
private def degradationMultiplierF: Float =
|
||||||
|
PercentDegradationPerYear.floatValue / 100.0f
|
||||||
|
|
||||||
private def degradation: Double => Double = -_ * degradationMultiplier
|
private def degradation: Double => Double = -_ * degradationMultiplier
|
||||||
|
|
||||||
|
private def degradationF(value: Float): Float =
|
||||||
|
-value * degradationMultiplierF
|
||||||
|
|
||||||
private def loyaltyDecrease(
|
private def loyaltyDecrease(
|
||||||
vassal: Hero,
|
vassal: Hero,
|
||||||
isProvinceLeader: Boolean,
|
isProvinceLeader: Boolean,
|
||||||
@@ -77,10 +82,11 @@ case class NewYearAction(gameState: GameState)
|
|||||||
.map(p =>
|
.map(p =>
|
||||||
ChangedProvince(
|
ChangedProvince(
|
||||||
id = p.id,
|
id = p.id,
|
||||||
agricultureDevastationDelta = Some(-degradation(p.agriculture)),
|
agricultureDevastationDelta = Some(-degradationF(p.agriculture)),
|
||||||
economyDevastationDelta = Some(-degradation(p.economy)),
|
economyDevastationDelta = Some(-degradationF(p.economy).toFloat),
|
||||||
infrastructureDevastationDelta = Some(-degradation(p.infrastructure)),
|
infrastructureDevastationDelta =
|
||||||
supportDelta = Some(degradation(p.support)),
|
Some(-degradationF(p.infrastructure).toFloat),
|
||||||
|
supportDelta = Some(degradationF(p.support).toFloat),
|
||||||
goldDelta = LegacyProvinceUtils.annualGoldProduction(p.id, gameState),
|
goldDelta = LegacyProvinceUtils.annualGoldProduction(p.id, gameState),
|
||||||
foodDelta = LegacyProvinceUtils.annualFoodProduction(p.id, gameState)
|
foodDelta = LegacyProvinceUtils.annualFoodProduction(p.id, gameState)
|
||||||
)
|
)
|
||||||
|
|||||||
+22
-22
@@ -178,21 +178,21 @@ case class PerformProvinceEventsAction(
|
|||||||
cp.update(
|
cp.update(
|
||||||
_.optionalEconomyDevastationDelta.modify(dd =>
|
_.optionalEconomyDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(0.0) + BlizzardEconomyDevastationDelta.doubleValue
|
dd.getOrElse(0.0f) + BlizzardEconomyDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_.optionalAgricultureDevastationDelta.modify(dd =>
|
_.optionalAgricultureDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(
|
dd.getOrElse(
|
||||||
0.0
|
0.0f
|
||||||
) + BlizzardAgricultureDevastationDelta.doubleValue
|
) + BlizzardAgricultureDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(
|
dd.getOrElse(
|
||||||
0.0
|
0.0f
|
||||||
) + BlizzardInfrastructureDevastationDelta.doubleValue
|
) + BlizzardInfrastructureDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -201,49 +201,49 @@ case class PerformProvinceEventsAction(
|
|||||||
_.optionalAgricultureDevastationDelta.modify(dd =>
|
_.optionalAgricultureDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(
|
dd.getOrElse(
|
||||||
0.0
|
0.0f
|
||||||
) + (MaxFloodAgricultureDevastationDelta.doubleValue - p.infrastructure * FloodDevastationDeltaReductionPerInfrastructure.doubleValue)
|
) + (MaxFloodAgricultureDevastationDelta.floatValue - p.infrastructure * FloodDevastationDeltaReductionPerInfrastructure.floatValue)
|
||||||
.max(0.0)
|
.max(0.0f)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(
|
dd.getOrElse(
|
||||||
0.0
|
0.0f
|
||||||
) + (MaxFloodInfrastructureDevastationDelta.doubleValue - p.infrastructure * FloodDevastationDeltaReductionPerInfrastructure.doubleValue)
|
) + (MaxFloodInfrastructureDevastationDelta.floatValue - p.infrastructure * FloodDevastationDeltaReductionPerInfrastructure.floatValue)
|
||||||
.max(0.0)
|
.max(0.0f)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case BeastsEvent(_, _, _, beastInfo, _ /* unknownFieldSet */ ) =>
|
case BeastsEvent(_, _, _, beastInfo, _ /* unknownFieldSet */ ) =>
|
||||||
cp.update(
|
cp.update(
|
||||||
_.optionalEconomyDevastationDelta.modify(dd =>
|
_.optionalEconomyDevastationDelta.modify(dd =>
|
||||||
Some(dd.getOrElse(0.0) + beastInfo.economyDevastation)
|
Some(dd.getOrElse(0.0f) + beastInfo.economyDevastation)
|
||||||
.filterNot(_ == 0.0)
|
.filterNot(_ == 0.0f)
|
||||||
),
|
),
|
||||||
_.optionalAgricultureDevastationDelta.modify(dd =>
|
_.optionalAgricultureDevastationDelta.modify(dd =>
|
||||||
Some(dd.getOrElse(0.0) + beastInfo.agricultureDevastation)
|
Some(dd.getOrElse(0.0f) + beastInfo.agricultureDevastation)
|
||||||
.filterNot(_ == 0.0)
|
.filterNot(_ == 0.0f)
|
||||||
),
|
),
|
||||||
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
_.optionalInfrastructureDevastationDelta.modify(dd =>
|
||||||
Some(dd.getOrElse(0.0) + beastInfo.infrastructureDevastation)
|
Some(dd.getOrElse(0.0f) + beastInfo.infrastructureDevastation)
|
||||||
.filterNot(_ == 0.0)
|
.filterNot(_ == 0.0f)
|
||||||
),
|
),
|
||||||
_.optionalSupportDelta.modify(sd =>
|
_.optionalSupportDelta.modify(sd =>
|
||||||
Some(sd.getOrElse(0.0) - BeastsSupportDamage.doubleValue)
|
Some(sd.getOrElse(0.0f) - BeastsSupportDamage.floatValue)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case _: FestivalEvent =>
|
case _: FestivalEvent =>
|
||||||
cp.update(
|
cp.update(
|
||||||
_.optionalSupportDelta.modify(sd =>
|
_.optionalSupportDelta.modify(sd =>
|
||||||
Some(sd.getOrElse(0.0) + FestivalSupportDelta.doubleValue)
|
Some(sd.getOrElse(0.0f) + FestivalSupportDelta.floatValue)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case _: EpidemicEvent =>
|
case _: EpidemicEvent =>
|
||||||
cp.update(
|
cp.update(
|
||||||
_.optionalEconomyDevastationDelta.modify(dd =>
|
_.optionalEconomyDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(0.0) + EpidemicEconomyDevastationDelta.doubleValue
|
dd.getOrElse(0.0f) + EpidemicEconomyDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_.optionalNewProvinceEvents := Option.when(
|
_.optionalNewProvinceEvents := Option.when(
|
||||||
@@ -263,8 +263,8 @@ case class PerformProvinceEventsAction(
|
|||||||
_.optionalAgricultureDevastationDelta.modify(dd =>
|
_.optionalAgricultureDevastationDelta.modify(dd =>
|
||||||
Some(
|
Some(
|
||||||
dd.getOrElse(
|
dd.getOrElse(
|
||||||
0.0
|
0.0f
|
||||||
) + DroughtAgricultureDevastationDelta.doubleValue
|
) + DroughtAgricultureDevastationDelta.floatValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-3
@@ -181,11 +181,11 @@ case class ResolveBattleAction(
|
|||||||
.map(_.getSupplies.food)
|
.map(_.getSupplies.food)
|
||||||
.sum
|
.sum
|
||||||
),
|
),
|
||||||
economyDevastationDelta = Some(BattleEconomyDevastationDelta.doubleValue),
|
economyDevastationDelta = Some(BattleEconomyDevastationDelta.floatValue),
|
||||||
agricultureDevastationDelta =
|
agricultureDevastationDelta =
|
||||||
Some(BattleAgricultureDevastationDelta.doubleValue),
|
Some(BattleAgricultureDevastationDelta.floatValue),
|
||||||
infrastructureDevastationDelta =
|
infrastructureDevastationDelta =
|
||||||
Some(BattleInfrastructureDevastationDelta.doubleValue),
|
Some(BattleInfrastructureDevastationDelta.floatValue),
|
||||||
addedBattleRevelations =
|
addedBattleRevelations =
|
||||||
battle.players.filterNot(_.isDefender).map { sp =>
|
battle.players.filterNot(_.isDefender).map { sp =>
|
||||||
BattleRevelation(
|
BattleRevelation(
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ import net.eagle0.eagle.{FactionId, HeroId}
|
|||||||
|
|
||||||
object AlmsCommand {
|
object AlmsCommand {
|
||||||
|
|
||||||
def supportIncreasePerFood(hero: HeroT): Double =
|
def supportIncreasePerFood(hero: HeroT): Float =
|
||||||
AlmsSupportIncreasePerFood.doubleValue * (if (
|
AlmsSupportIncreasePerFood.floatValue * (if (
|
||||||
hero.profession == Profession.Paladin
|
hero.profession == Profession.Paladin
|
||||||
)
|
)
|
||||||
AlmsPaladinSupportMultiplier.doubleValue
|
AlmsPaladinSupportMultiplier.floatValue
|
||||||
else 1.0)
|
else 1.0f)
|
||||||
|
|
||||||
private def supportIncrease(hero: HeroT, foodAmount: Int): Double =
|
private def supportIncrease(hero: HeroT, foodAmount: Int): Float =
|
||||||
foodAmount * supportIncreasePerFood(hero)
|
foodAmount * supportIncreasePerFood(hero)
|
||||||
|
|
||||||
private case class AlmsCommand(
|
private case class AlmsCommand(
|
||||||
@@ -92,7 +92,7 @@ object AlmsCommand {
|
|||||||
supportDelta = Some(
|
supportDelta = Some(
|
||||||
Math.min(
|
Math.min(
|
||||||
supportIncrease(actingHero, foodAmount),
|
supportIncrease(actingHero, foodAmount),
|
||||||
100.0 - actingProvince.support
|
100.0f - actingProvince.support
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
foodDelta = Some(-foodAmount)
|
foodDelta = Some(-foodAmount)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ object ArmTroopsCommand {
|
|||||||
goldDelta = Some(-goldSpent),
|
goldDelta = Some(-goldSpent),
|
||||||
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
province.priceIndex,
|
province.priceIndex,
|
||||||
goldSpent
|
goldSpent.toFloat
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ object DivineCommand {
|
|||||||
newPriceIndex =
|
newPriceIndex =
|
||||||
PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
actingProvince.priceIndex,
|
actingProvince.priceIndex,
|
||||||
cost
|
cost.toFloat
|
||||||
),
|
),
|
||||||
changedUnaffiliatedHeroes =
|
changedUnaffiliatedHeroes =
|
||||||
updatedUhWithLlmRequestsRs.map(_._1)
|
updatedUhWithLlmRequestsRs.map(_._1)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ object FeastCommand {
|
|||||||
goldDelta = Some(-goldCost),
|
goldDelta = Some(-goldCost),
|
||||||
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
currentPriceIndex = province.priceIndex,
|
currentPriceIndex = province.priceIndex,
|
||||||
goldSpent = goldCost
|
goldSpent = goldCost.toFloat
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ object HandleRiotUtils {
|
|||||||
case event => Some(event)
|
case event => Some(event)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
supportDelta = Some(RiotSupportDelta.doubleValue),
|
supportDelta = Some(RiotSupportDelta.floatValue),
|
||||||
economyDevastationDelta =
|
economyDevastationDelta =
|
||||||
Some(RiotEconomyDevastationDelta.doubleValue),
|
Some(RiotEconomyDevastationDelta.floatValue),
|
||||||
infrastructureDevastationDelta =
|
infrastructureDevastationDelta =
|
||||||
Some(RiotInfrastructureDevastationDelta.doubleValue)
|
Some(RiotInfrastructureDevastationDelta.floatValue)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ object HeroGiftCommand {
|
|||||||
goldDelta = Some(-goldAmount),
|
goldDelta = Some(-goldAmount),
|
||||||
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
recipientProvince.priceIndex,
|
recipientProvince.priceIndex,
|
||||||
goldAmount
|
goldAmount.toFloat
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ object ImproveCommand {
|
|||||||
withProfessionBonus.min(maxImprovement - province.economy)
|
withProfessionBonus.min(maxImprovement - province.economy)
|
||||||
ChangedProvinceC(
|
ChangedProvinceC(
|
||||||
provinceId = provinceId,
|
provinceId = provinceId,
|
||||||
economyDelta = Some(improvement),
|
economyDelta = Some(improvement.toFloat),
|
||||||
supportDelta = Some(supportDelta),
|
supportDelta = Some(supportDelta.toFloat),
|
||||||
newLockedImprovementType = Some(lockedImprovementType)
|
newLockedImprovementType = Some(lockedImprovementType)
|
||||||
)
|
)
|
||||||
case ImprovementType.Agriculture =>
|
case ImprovementType.Agriculture =>
|
||||||
@@ -109,8 +109,8 @@ object ImproveCommand {
|
|||||||
withProfessionBonus.min(maxImprovement - province.agriculture)
|
withProfessionBonus.min(maxImprovement - province.agriculture)
|
||||||
ChangedProvinceC(
|
ChangedProvinceC(
|
||||||
provinceId = provinceId,
|
provinceId = provinceId,
|
||||||
agricultureDelta = Some(improvement),
|
agricultureDelta = Some(improvement.toFloat),
|
||||||
supportDelta = Some(supportDelta),
|
supportDelta = Some(supportDelta.toFloat),
|
||||||
newLockedImprovementType = Some(lockedImprovementType)
|
newLockedImprovementType = Some(lockedImprovementType)
|
||||||
)
|
)
|
||||||
case ImprovementType.Infrastructure =>
|
case ImprovementType.Infrastructure =>
|
||||||
@@ -118,18 +118,18 @@ object ImproveCommand {
|
|||||||
withProfessionBonus.min(maxImprovement - province.infrastructure)
|
withProfessionBonus.min(maxImprovement - province.infrastructure)
|
||||||
ChangedProvinceC(
|
ChangedProvinceC(
|
||||||
provinceId = provinceId,
|
provinceId = provinceId,
|
||||||
infrastructureDelta = Some(improvement),
|
infrastructureDelta = Some(improvement.toFloat),
|
||||||
supportDelta = Some(supportDelta),
|
supportDelta = Some(supportDelta.toFloat),
|
||||||
newLockedImprovementType = Some(lockedImprovementType)
|
newLockedImprovementType = Some(lockedImprovementType)
|
||||||
)
|
)
|
||||||
case ImprovementType.Devastation =>
|
case ImprovementType.Devastation =>
|
||||||
val improvement = withProfessionBonus
|
val improvement = withProfessionBonus
|
||||||
ChangedProvinceC(
|
ChangedProvinceC(
|
||||||
provinceId = provinceId,
|
provinceId = provinceId,
|
||||||
economyDevastationDelta = Some(-improvement),
|
economyDevastationDelta = Some((-improvement).toFloat),
|
||||||
agricultureDevastationDelta = Some(-improvement),
|
agricultureDevastationDelta = Some((-improvement).toFloat),
|
||||||
infrastructureDevastationDelta = Some(-improvement),
|
infrastructureDevastationDelta = Some((-improvement).toFloat),
|
||||||
supportDelta = Some(supportDelta),
|
supportDelta = Some(supportDelta.toFloat),
|
||||||
newLockedImprovementType = Some(lockedImprovementType)
|
newLockedImprovementType = Some(lockedImprovementType)
|
||||||
)
|
)
|
||||||
case _ => throw new IllegalArgumentException("Unknown Improvement type")
|
case _ => throw new IllegalArgumentException("Unknown Improvement type")
|
||||||
|
|||||||
+3
-3
@@ -52,11 +52,11 @@ object LegacyHandleRiotUtils {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
supportDelta = Some(RiotSupportDelta.doubleValue),
|
supportDelta = Some(RiotSupportDelta.floatValue),
|
||||||
economyDevastationDelta =
|
economyDevastationDelta =
|
||||||
Some(RiotEconomyDevastationDelta.doubleValue),
|
Some(RiotEconomyDevastationDelta.floatValue),
|
||||||
infrastructureDevastationDelta =
|
infrastructureDevastationDelta =
|
||||||
Some(RiotInfrastructureDevastationDelta.doubleValue)
|
Some(RiotInfrastructureDevastationDelta.floatValue)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -369,7 +369,7 @@ object OrganizeTroopsCommand {
|
|||||||
goldDelta = Some(-afterAddingForChanged.cost),
|
goldDelta = Some(-afterAddingForChanged.cost),
|
||||||
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
province.priceIndex,
|
province.priceIndex,
|
||||||
afterAddingForChanged.cost
|
afterAddingForChanged.cost.toFloat
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
+2
-1
@@ -297,7 +297,8 @@ object SuppressBeastsCommand
|
|||||||
changedProvinces = Vector(
|
changedProvinces = Vector(
|
||||||
ChangedProvince(
|
ChangedProvince(
|
||||||
id = provinceId,
|
id = provinceId,
|
||||||
supportDelta = Some(SuppressBeastsSupportBonus.doubleValue),
|
supportDelta =
|
||||||
|
Some(SuppressBeastsSupportBonus.doubleValue.toFloat),
|
||||||
removedRulingPlayerHeroIds = removedHero.toVector,
|
removedRulingPlayerHeroIds = removedHero.toVector,
|
||||||
removedBattalionIds = destroyedBattalionId.toVector,
|
removedBattalionIds = destroyedBattalionId.toVector,
|
||||||
newProvinceEvents = Some(
|
newProvinceEvents = Some(
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ object TradeCommand {
|
|||||||
foodDelta = Some(supplyDeltas.food),
|
foodDelta = Some(supplyDeltas.food),
|
||||||
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
newPriceIndex = PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(
|
||||||
actingProvince.priceIndex,
|
actingProvince.priceIndex,
|
||||||
-supplyDeltas.gold
|
(-supplyDeltas.gold).toFloat
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -796,7 +796,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "alms_support_increase_per_food",
|
name = "alms_support_increase_per_food",
|
||||||
setting_name = "AlmsSupportIncreasePerFood",
|
setting_name = "AlmsSupportIncreasePerFood",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "0.01",
|
setting_value = "0.01",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -809,7 +809,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "alms_paladin_support_multiplier",
|
name = "alms_paladin_support_multiplier",
|
||||||
setting_name = "AlmsPaladinSupportMultiplier",
|
setting_name = "AlmsPaladinSupportMultiplier",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "4",
|
setting_value = "4",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -1069,7 +1069,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "beasts_support_damage",
|
name = "beasts_support_damage",
|
||||||
setting_name = "BeastsSupportDamage",
|
setting_name = "BeastsSupportDamage",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "3",
|
setting_value = "3",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -1082,7 +1082,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "suppress_beasts_support_bonus",
|
name = "suppress_beasts_support_bonus",
|
||||||
setting_name = "SuppressBeastsSupportBonus",
|
setting_name = "SuppressBeastsSupportBonus",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "5",
|
setting_value = "5",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2174,7 +2174,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "battle_economy_devastation_delta",
|
name = "battle_economy_devastation_delta",
|
||||||
setting_name = "BattleEconomyDevastationDelta",
|
setting_name = "BattleEconomyDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "10",
|
setting_value = "10",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2187,7 +2187,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "battle_agriculture_devastation_delta",
|
name = "battle_agriculture_devastation_delta",
|
||||||
setting_name = "BattleAgricultureDevastationDelta",
|
setting_name = "BattleAgricultureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "10",
|
setting_value = "10",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2200,7 +2200,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "battle_infrastructure_devastation_delta",
|
name = "battle_infrastructure_devastation_delta",
|
||||||
setting_name = "BattleInfrastructureDevastationDelta",
|
setting_name = "BattleInfrastructureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "10",
|
setting_value = "10",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2226,7 +2226,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "riot_support_delta",
|
name = "riot_support_delta",
|
||||||
setting_name = "RiotSupportDelta",
|
setting_name = "RiotSupportDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "-25",
|
setting_value = "-25",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2239,7 +2239,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "riot_economy_devastation_delta",
|
name = "riot_economy_devastation_delta",
|
||||||
setting_name = "RiotEconomyDevastationDelta",
|
setting_name = "RiotEconomyDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "25",
|
setting_value = "25",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2252,7 +2252,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "riot_infrastructure_devastation_delta",
|
name = "riot_infrastructure_devastation_delta",
|
||||||
setting_name = "RiotInfrastructureDevastationDelta",
|
setting_name = "RiotInfrastructureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "25",
|
setting_value = "25",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2421,7 +2421,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "blizzard_economy_devastation_delta",
|
name = "blizzard_economy_devastation_delta",
|
||||||
setting_name = "BlizzardEconomyDevastationDelta",
|
setting_name = "BlizzardEconomyDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "4",
|
setting_value = "4",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2434,7 +2434,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "blizzard_infrastructure_devastation_delta",
|
name = "blizzard_infrastructure_devastation_delta",
|
||||||
setting_name = "BlizzardInfrastructureDevastationDelta",
|
setting_name = "BlizzardInfrastructureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "4",
|
setting_value = "4",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2447,7 +2447,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "blizzard_agriculture_devastation_delta",
|
name = "blizzard_agriculture_devastation_delta",
|
||||||
setting_name = "BlizzardAgricultureDevastationDelta",
|
setting_name = "BlizzardAgricultureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "4",
|
setting_value = "4",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2590,7 +2590,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "max_flood_infrastructure_devastation_delta",
|
name = "max_flood_infrastructure_devastation_delta",
|
||||||
setting_name = "MaxFloodInfrastructureDevastationDelta",
|
setting_name = "MaxFloodInfrastructureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "20",
|
setting_value = "20",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2603,7 +2603,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "max_flood_agriculture_devastation_delta",
|
name = "max_flood_agriculture_devastation_delta",
|
||||||
setting_name = "MaxFloodAgricultureDevastationDelta",
|
setting_name = "MaxFloodAgricultureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "20",
|
setting_value = "20",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2616,7 +2616,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "flood_devastation_delta_reduction_per_infrastructure",
|
name = "flood_devastation_delta_reduction_per_infrastructure",
|
||||||
setting_name = "FloodDevastationDeltaReductionPerInfrastructure",
|
setting_name = "FloodDevastationDeltaReductionPerInfrastructure",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "0.3",
|
setting_value = "0.3",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2655,7 +2655,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "epidemic_economy_devastation_delta",
|
name = "epidemic_economy_devastation_delta",
|
||||||
setting_name = "EpidemicEconomyDevastationDelta",
|
setting_name = "EpidemicEconomyDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "10",
|
setting_value = "10",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2824,7 +2824,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "drought_agriculture_devastation_delta",
|
name = "drought_agriculture_devastation_delta",
|
||||||
setting_name = "DroughtAgricultureDevastationDelta",
|
setting_name = "DroughtAgricultureDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "10",
|
setting_value = "10",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -2850,7 +2850,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "empty_province_monthly_devastation_delta",
|
name = "empty_province_monthly_devastation_delta",
|
||||||
setting_name = "EmptyProvinceMonthlyDevastationDelta",
|
setting_name = "EmptyProvinceMonthlyDevastationDelta",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "-2",
|
setting_value = "-2",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -3461,7 +3461,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "minimum_price_index",
|
name = "minimum_price_index",
|
||||||
setting_name = "MinimumPriceIndex",
|
setting_name = "MinimumPriceIndex",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "0.75",
|
setting_value = "0.75",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -3474,7 +3474,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "maximum_price_index",
|
name = "maximum_price_index",
|
||||||
setting_name = "MaximumPriceIndex",
|
setting_name = "MaximumPriceIndex",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "1.5",
|
setting_value = "1.5",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -3487,7 +3487,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "price_index_return_rate",
|
name = "price_index_return_rate",
|
||||||
setting_name = "PriceIndexReturnRate",
|
setting_name = "PriceIndexReturnRate",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "0.1",
|
setting_value = "0.1",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
@@ -3500,7 +3500,7 @@ scala_setting_library(
|
|||||||
scala_setting_library(
|
scala_setting_library(
|
||||||
name = "price_index_shift_per_gold",
|
name = "price_index_shift_per_gold",
|
||||||
setting_name = "PriceIndexShiftPerGold",
|
setting_name = "PriceIndexShiftPerGold",
|
||||||
setting_type = "Double",
|
setting_type = "Float",
|
||||||
setting_value = "0.0001",
|
setting_value = "0.0001",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
"//src/main/scala/net/eagle0/eagle:__subpackages__",
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ scala_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
scala_library(
|
||||||
|
name = "float_setting",
|
||||||
|
srcs = ["FloatSetting.scala"],
|
||||||
|
visibility = [
|
||||||
|
"//visibility:public",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
scala_library(
|
scala_library(
|
||||||
name = "int_setting",
|
name = "int_setting",
|
||||||
srcs = ["IntSetting.scala"],
|
srcs = ["IntSetting.scala"],
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package net.eagle0.eagle.library.settings.base
|
||||||
|
|
||||||
|
class FloatSetting(private var _floatValue: Float) {
|
||||||
|
def floatValue: Float = _floatValue
|
||||||
|
def setFloatValue(newValue: Float): Unit = _floatValue = newValue
|
||||||
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
package net.eagle0.eagle.library.settings.loaders
|
package net.eagle0.eagle.library.settings.loaders
|
||||||
|
|
||||||
import net.eagle0.common.TsvUtils
|
import net.eagle0.common.TsvUtils
|
||||||
import net.eagle0.eagle.library.settings.base.{DoubleSetting, IntSetting}
|
import net.eagle0.eagle.library.settings.base.{
|
||||||
|
DoubleSetting,
|
||||||
|
FloatSetting,
|
||||||
|
IntSetting
|
||||||
|
}
|
||||||
|
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import scala.reflect.runtime.universe
|
import scala.reflect.runtime.universe
|
||||||
@@ -42,6 +46,9 @@ object SettingsLoader {
|
|||||||
case "double" =>
|
case "double" =>
|
||||||
obj.asInstanceOf[DoubleSetting].setDoubleValue(setting.value.toDouble)
|
obj.asInstanceOf[DoubleSetting].setDoubleValue(setting.value.toDouble)
|
||||||
true
|
true
|
||||||
|
case "float" =>
|
||||||
|
obj.asInstanceOf[FloatSetting].setFloatValue(setting.value.toFloat)
|
||||||
|
true
|
||||||
case typeName =>
|
case typeName =>
|
||||||
throw new Exception(s"Invalid setting type $typeName")
|
throw new Exception(s"Invalid setting type $typeName")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ object BeastUtils {
|
|||||||
map("maxCountMultiplier").asInstanceOf[String].toDouble,
|
map("maxCountMultiplier").asInstanceOf[String].toDouble,
|
||||||
relativePower = map("relativePower").asInstanceOf[String].toDouble,
|
relativePower = map("relativePower").asInstanceOf[String].toDouble,
|
||||||
economyDevastation =
|
economyDevastation =
|
||||||
map("economyDevastation").asInstanceOf[String].toDouble,
|
map("economyDevastation").asInstanceOf[String].toFloat,
|
||||||
agricultureDevastation =
|
agricultureDevastation =
|
||||||
map("agricultureDevastation").asInstanceOf[String].toDouble,
|
map("agricultureDevastation").asInstanceOf[String].toFloat,
|
||||||
infrastructureDevastation =
|
infrastructureDevastation =
|
||||||
map("infrastructureDevastation").asInstanceOf[String].toDouble,
|
map("infrastructureDevastation").asInstanceOf[String].toFloat,
|
||||||
averageGoldPer = map("averageGoldPer").asInstanceOf[String].toDouble,
|
averageGoldPer = map("averageGoldPer").asInstanceOf[String].toDouble,
|
||||||
averageFoodPer = map("averageFoodPer").asInstanceOf[String].toDouble
|
averageFoodPer = map("averageFoodPer").asInstanceOf[String].toDouble
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,35 +8,34 @@ import net.eagle0.eagle.library.settings.{
|
|||||||
}
|
}
|
||||||
|
|
||||||
object PriceIndexUtils {
|
object PriceIndexUtils {
|
||||||
def clampedIndex(
|
def clampedIndex(value: Float): Float =
|
||||||
value: Double
|
if (value < MinimumPriceIndex.floatValue)
|
||||||
): Double =
|
MinimumPriceIndex.floatValue
|
||||||
if (value < MinimumPriceIndex.doubleValue) MinimumPriceIndex.doubleValue
|
else if (value > MaximumPriceIndex.floatValue)
|
||||||
else if (value > MaximumPriceIndex.doubleValue)
|
MaximumPriceIndex.floatValue
|
||||||
MaximumPriceIndex.doubleValue
|
|
||||||
else value
|
else value
|
||||||
|
|
||||||
def steadyState(
|
def steadyState(
|
||||||
economy: Double,
|
economy: Float,
|
||||||
agriculture: Double,
|
agriculture: Float,
|
||||||
infrastructure: Double,
|
infrastructure: Float,
|
||||||
economyDevastation: Double,
|
economyDevastation: Float,
|
||||||
agricultureDevastation: Double,
|
agricultureDevastation: Float,
|
||||||
infrastructureDevastation: Double
|
infrastructureDevastation: Float
|
||||||
): Double =
|
): Float =
|
||||||
clampedIndex(
|
clampedIndex(
|
||||||
MinimumPriceIndex.doubleValue + (economy + agriculture + infrastructure + economyDevastation + agricultureDevastation + infrastructureDevastation) / 600.0
|
MinimumPriceIndex.floatValue + (economy + agriculture + infrastructure + economyDevastation + agricultureDevastation + infrastructureDevastation) / 600.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
def shiftedTowardSteadyState(
|
def shiftedTowardSteadyState(
|
||||||
currentPriceIndex: Double,
|
currentPriceIndex: Float,
|
||||||
economy: Double,
|
economy: Float,
|
||||||
agriculture: Double,
|
agriculture: Float,
|
||||||
infrastructure: Double,
|
infrastructure: Float,
|
||||||
economyDevastation: Double,
|
economyDevastation: Float,
|
||||||
agricultureDevastation: Double,
|
agricultureDevastation: Float,
|
||||||
infrastructureDevastation: Double
|
infrastructureDevastation: Float
|
||||||
): Double = {
|
): Float = {
|
||||||
val steadyStatePriceIndex =
|
val steadyStatePriceIndex =
|
||||||
steadyState(
|
steadyState(
|
||||||
economy,
|
economy,
|
||||||
@@ -48,20 +47,20 @@ object PriceIndexUtils {
|
|||||||
)
|
)
|
||||||
val difference = steadyStatePriceIndex - currentPriceIndex
|
val difference = steadyStatePriceIndex - currentPriceIndex
|
||||||
val shifted =
|
val shifted =
|
||||||
currentPriceIndex + difference * PriceIndexReturnRate.doubleValue
|
currentPriceIndex + difference * PriceIndexReturnRate.floatValue
|
||||||
if (shifted < MinimumPriceIndex.doubleValue) MinimumPriceIndex.doubleValue
|
if (shifted < MinimumPriceIndex.floatValue) MinimumPriceIndex.floatValue
|
||||||
else if (shifted > MaximumPriceIndex.doubleValue)
|
else if (shifted > MaximumPriceIndex.floatValue)
|
||||||
MaximumPriceIndex.doubleValue
|
MaximumPriceIndex.floatValue
|
||||||
else shifted
|
else shifted
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gold spent can be negative (ie by selling food), which would drive prices down
|
// Gold spent can be negative (ie by selling food), which would drive prices down
|
||||||
def maybeNewPriceIndexFromGoldSpend(
|
def maybeNewPriceIndexFromGoldSpend(
|
||||||
currentPriceIndex: Double,
|
currentPriceIndex: Float,
|
||||||
goldSpent: Double
|
goldSpent: Float
|
||||||
): Option[Double] = {
|
): Option[Float] = {
|
||||||
val newIndex = clampedIndex(
|
val newIndex = clampedIndex(
|
||||||
currentPriceIndex + goldSpent * PriceIndexShiftPerGold.doubleValue
|
currentPriceIndex + goldSpent * PriceIndexShiftPerGold.floatValue
|
||||||
)
|
)
|
||||||
|
|
||||||
Option.when(newIndex != currentPriceIndex)(newIndex)
|
Option.when(newIndex != currentPriceIndex)(newIndex)
|
||||||
|
|||||||
+6
-1
@@ -25,7 +25,12 @@ object AlmsCommandSelector {
|
|||||||
): (Hero, Double) =
|
): (Hero, Double) =
|
||||||
availableHeroes
|
availableHeroes
|
||||||
.map(h =>
|
.map(h =>
|
||||||
(h, AlmsCommand.supportIncreasePerFood(HeroConverter.fromProto(h)))
|
(
|
||||||
|
h,
|
||||||
|
AlmsCommand
|
||||||
|
.supportIncreasePerFood(HeroConverter.fromProto(h))
|
||||||
|
.toDouble
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.maxBy { case (hero, inc) =>
|
.maxBy { case (hero, inc) =>
|
||||||
(inc, -LegacyHeroUtils.fatigue(hero))
|
(inc, -LegacyHeroUtils.fatigue(hero))
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ object LegacyProvinceUtils {
|
|||||||
province
|
province
|
||||||
) + effectiveInfrastructure(province))).toInt
|
) + effectiveInfrastructure(province))).toInt
|
||||||
|
|
||||||
def effectiveEconomy(province: Province): Double =
|
def effectiveEconomy(province: Province): Float =
|
||||||
(province.economy - province.economyDevastation).max(0.0)
|
(province.economy - province.economyDevastation).max(0.0f)
|
||||||
def effectiveAgriculture(province: Province): Double =
|
def effectiveAgriculture(province: Province): Float =
|
||||||
(province.agriculture - province.agricultureDevastation).max(0.0)
|
(province.agriculture - province.agricultureDevastation).max(0.0f)
|
||||||
def effectiveInfrastructure(province: Province): Double =
|
def effectiveInfrastructure(province: Province): Float =
|
||||||
(province.infrastructure - province.infrastructureDevastation).max(0.0)
|
(province.infrastructure - province.infrastructureDevastation).max(0.0f)
|
||||||
|
|
||||||
def goldCap(province: Province): Int =
|
def goldCap(province: Province): Int =
|
||||||
(BaseResourceLimit.intValue + PerDevelopmentResourceLimit.intValue * (effectiveEconomy(
|
(BaseResourceLimit.intValue + PerDevelopmentResourceLimit.intValue * (effectiveEconomy(
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ object ProvinceUtils {
|
|||||||
province
|
province
|
||||||
) + effectiveInfrastructure(province))).toInt
|
) + effectiveInfrastructure(province))).toInt
|
||||||
|
|
||||||
def effectiveEconomy(province: ProvinceT): Double =
|
def effectiveEconomy(province: ProvinceT): Float =
|
||||||
(province.economy - province.economyDevastation).max(0.0)
|
(province.economy - province.economyDevastation).max(0.0f)
|
||||||
def effectiveAgriculture(province: ProvinceT): Double =
|
def effectiveAgriculture(province: ProvinceT): Float =
|
||||||
(province.agriculture - province.agricultureDevastation).max(0.0)
|
(province.agriculture - province.agricultureDevastation).max(0.0f)
|
||||||
def effectiveInfrastructure(province: ProvinceT): Double =
|
def effectiveInfrastructure(province: ProvinceT): Float =
|
||||||
(province.infrastructure - province.infrastructureDevastation).max(0.0)
|
(province.infrastructure - province.infrastructureDevastation).max(0.0f)
|
||||||
|
|
||||||
def goldCap(province: ProvinceT): Int =
|
def goldCap(province: ProvinceT): Int =
|
||||||
(BaseResourceLimit.intValue + PerDevelopmentResourceLimit.intValue * (effectiveEconomy(
|
(BaseResourceLimit.intValue + PerDevelopmentResourceLimit.intValue * (effectiveEconomy(
|
||||||
|
|||||||
@@ -185,14 +185,12 @@ object ProvinceViewFilter {
|
|||||||
.sortBy(_.`type`.index),
|
.sortBy(_.`type`.index),
|
||||||
defendingArmy = province.defendingArmy
|
defendingArmy = province.defendingArmy
|
||||||
.map(ArmyFilter.filterArmy(_, gs.battalions, factionId)),
|
.map(ArmyFilter.filterArmy(_, gs.battalions, factionId)),
|
||||||
economy = roundedStat(province.economy),
|
economy = province.economy,
|
||||||
agriculture = roundedStat(province.agriculture),
|
agriculture = province.agriculture,
|
||||||
infrastructure = roundedStat(province.infrastructure),
|
infrastructure = province.infrastructure,
|
||||||
economyDevastation = roundedDevastation(province.economyDevastation),
|
economyDevastation = province.economyDevastation,
|
||||||
agricultureDevastation =
|
agricultureDevastation = province.agricultureDevastation,
|
||||||
roundedDevastation(province.agricultureDevastation),
|
infrastructureDevastation = province.infrastructureDevastation,
|
||||||
infrastructureDevastation =
|
|
||||||
roundedDevastation(province.infrastructureDevastation),
|
|
||||||
gold = province.gold,
|
gold = province.gold,
|
||||||
food = province.food,
|
food = province.food,
|
||||||
priceIndex = province.priceIndex,
|
priceIndex = province.priceIndex,
|
||||||
@@ -210,14 +208,6 @@ object ProvinceViewFilter {
|
|||||||
rulerIsTraveling = province.rulerIsTraveling
|
rulerIsTraveling = province.rulerIsTraveling
|
||||||
)
|
)
|
||||||
|
|
||||||
private def roundedStat(stat: Double): Int =
|
|
||||||
if (stat == 0) 0
|
|
||||||
else if (stat < 1) 1
|
|
||||||
else stat.floor.toInt
|
|
||||||
|
|
||||||
private def roundedDevastation(stat: Double): Int =
|
|
||||||
stat.ceil.toInt
|
|
||||||
|
|
||||||
private def myIncomingArmies(
|
private def myIncomingArmies(
|
||||||
province: Province,
|
province: Province,
|
||||||
gs: GameState,
|
gs: GameState,
|
||||||
|
|||||||
+16
-16
@@ -43,14 +43,14 @@ case class ChangedProvinceC(
|
|||||||
goldDelta: Option[Int] = None,
|
goldDelta: Option[Int] = None,
|
||||||
foodDelta: Option[Int] = None,
|
foodDelta: Option[Int] = None,
|
||||||
/* stat changes */
|
/* stat changes */
|
||||||
newPriceIndex: Option[Double] = None,
|
newPriceIndex: Option[Float] = None,
|
||||||
economyDelta: Option[Double] = None,
|
economyDelta: Option[Float] = None,
|
||||||
agricultureDelta: Option[Double] = None,
|
agricultureDelta: Option[Float] = None,
|
||||||
infrastructureDelta: Option[Double] = None,
|
infrastructureDelta: Option[Float] = None,
|
||||||
economyDevastationDelta: Option[Double] = None,
|
economyDevastationDelta: Option[Float] = None,
|
||||||
agricultureDevastationDelta: Option[Double] = None,
|
agricultureDevastationDelta: Option[Float] = None,
|
||||||
infrastructureDevastationDelta: Option[Double] = None,
|
infrastructureDevastationDelta: Option[Float] = None,
|
||||||
supportDelta: Option[Double] = None,
|
supportDelta: Option[Float] = None,
|
||||||
/* round properties */
|
/* round properties */
|
||||||
setHasActed: Option[Boolean] = None,
|
setHasActed: Option[Boolean] = None,
|
||||||
setRulerIsTraveling: Option[Boolean] = None,
|
setRulerIsTraveling: Option[Boolean] = None,
|
||||||
@@ -100,15 +100,15 @@ case class ChangedProvinceC(
|
|||||||
def copy(
|
def copy(
|
||||||
goldDelta: Option[Int] = goldDelta,
|
goldDelta: Option[Int] = goldDelta,
|
||||||
foodDelta: Option[Int] = foodDelta,
|
foodDelta: Option[Int] = foodDelta,
|
||||||
newPriceIndex: Option[Double] = newPriceIndex,
|
newPriceIndex: Option[Float] = newPriceIndex,
|
||||||
economyDelta: Option[Double] = economyDelta,
|
economyDelta: Option[Float] = economyDelta,
|
||||||
agricultureDelta: Option[Double] = agricultureDelta,
|
agricultureDelta: Option[Float] = agricultureDelta,
|
||||||
infrastructureDelta: Option[Double] = infrastructureDelta,
|
infrastructureDelta: Option[Float] = infrastructureDelta,
|
||||||
economyDevastationDelta: Option[Double] = economyDevastationDelta,
|
economyDevastationDelta: Option[Float] = economyDevastationDelta,
|
||||||
agricultureDevastationDelta: Option[Double] = agricultureDevastationDelta,
|
agricultureDevastationDelta: Option[Float] = agricultureDevastationDelta,
|
||||||
infrastructureDevastationDelta: Option[Double] =
|
infrastructureDevastationDelta: Option[Float] =
|
||||||
infrastructureDevastationDelta,
|
infrastructureDevastationDelta,
|
||||||
supportDelta: Option[Double] = supportDelta,
|
supportDelta: Option[Float] = supportDelta,
|
||||||
setHasActed: Option[Boolean] = setHasActed,
|
setHasActed: Option[Boolean] = setHasActed,
|
||||||
setRulerIsTraveling: Option[Boolean] = setRulerIsTraveling,
|
setRulerIsTraveling: Option[Boolean] = setRulerIsTraveling,
|
||||||
newUnaffiliatedHeroes: Vector[UnaffiliatedHeroT] = newUnaffiliatedHeroes,
|
newUnaffiliatedHeroes: Vector[UnaffiliatedHeroT] = newUnaffiliatedHeroes,
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ object BeastInfoConverter {
|
|||||||
likelihood = likelihood,
|
likelihood = likelihood,
|
||||||
maxCountMultiplier = maxCountMultiplier,
|
maxCountMultiplier = maxCountMultiplier,
|
||||||
relativePower = relativePower,
|
relativePower = relativePower,
|
||||||
economyDevastation = economyDevastation,
|
economyDevastation = economyDevastation.toFloat,
|
||||||
agricultureDevastation = agricultureDevastation,
|
agricultureDevastation = agricultureDevastation.toFloat,
|
||||||
infrastructureDevastation = infrastructureDevastation,
|
infrastructureDevastation = infrastructureDevastation.toFloat,
|
||||||
averageGoldPer = averageGoldPer,
|
averageGoldPer = averageGoldPer,
|
||||||
averageFoodPer = averageFoodPer
|
averageFoodPer = averageFoodPer
|
||||||
)
|
)
|
||||||
|
|||||||
+8
-8
@@ -51,14 +51,14 @@ object ChangedProvinceConverter {
|
|||||||
provinceId: ProvinceId,
|
provinceId: ProvinceId,
|
||||||
goldDelta: Option[ProvinceId],
|
goldDelta: Option[ProvinceId],
|
||||||
foodDelta: Option[ProvinceId],
|
foodDelta: Option[ProvinceId],
|
||||||
newPriceIndex: Option[Double],
|
newPriceIndex: Option[Float],
|
||||||
economyDelta: Option[Double],
|
economyDelta: Option[Float],
|
||||||
agricultureDelta: Option[Double],
|
agricultureDelta: Option[Float],
|
||||||
infrastructureDelta: Option[Double],
|
infrastructureDelta: Option[Float],
|
||||||
economyDevastationDelta: Option[Double],
|
economyDevastationDelta: Option[Float],
|
||||||
agricultureDevastationDelta: Option[Double],
|
agricultureDevastationDelta: Option[Float],
|
||||||
infrastructureDevastationDelta: Option[Double],
|
infrastructureDevastationDelta: Option[Float],
|
||||||
supportDelta: Option[Double],
|
supportDelta: Option[Float],
|
||||||
setHasActed: Option[Boolean],
|
setHasActed: Option[Boolean],
|
||||||
setRulerIsTraveling: Option[Boolean],
|
setRulerIsTraveling: Option[Boolean],
|
||||||
newUnaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
newUnaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
||||||
|
|||||||
+16
-16
@@ -89,16 +89,16 @@ object ProvinceConverter {
|
|||||||
specialBattalionTypeIds: Vector[BattalionTypeId],
|
specialBattalionTypeIds: Vector[BattalionTypeId],
|
||||||
gold: Int,
|
gold: Int,
|
||||||
food: Int,
|
food: Int,
|
||||||
priceIndex: Double,
|
priceIndex: Float,
|
||||||
hasActed: Boolean,
|
hasActed: Boolean,
|
||||||
rulerIsTraveling: Boolean,
|
rulerIsTraveling: Boolean,
|
||||||
economy: Double,
|
economy: Float,
|
||||||
agriculture: Double,
|
agriculture: Float,
|
||||||
infrastructure: Double,
|
infrastructure: Float,
|
||||||
economyDevastation: Double,
|
economyDevastation: Float,
|
||||||
agricultureDevastation: Double,
|
agricultureDevastation: Float,
|
||||||
infrastructureDevastation: Double,
|
infrastructureDevastation: Float,
|
||||||
support: Double,
|
support: Float,
|
||||||
unaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
unaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
||||||
capturedHeroes: Vector[CapturedHero],
|
capturedHeroes: Vector[CapturedHero],
|
||||||
activeEvents: Vector[ProvinceEvent],
|
activeEvents: Vector[ProvinceEvent],
|
||||||
@@ -190,17 +190,17 @@ object ProvinceConverter {
|
|||||||
incomingShipments: Vector[MovingSuppliesProto],
|
incomingShipments: Vector[MovingSuppliesProto],
|
||||||
incomingEndTurnActions: Vector[IncomingEndTurnActionProto],
|
incomingEndTurnActions: Vector[IncomingEndTurnActionProto],
|
||||||
defendingArmy: Option[ArmyProto],
|
defendingArmy: Option[ArmyProto],
|
||||||
economy: Double,
|
economy: Float,
|
||||||
agriculture: Double,
|
agriculture: Float,
|
||||||
infrastructure: Double,
|
infrastructure: Float,
|
||||||
economyDevastation: Double,
|
economyDevastation: Float,
|
||||||
agricultureDevastation: Double,
|
agricultureDevastation: Float,
|
||||||
infrastructureDevastation: Double,
|
infrastructureDevastation: Float,
|
||||||
lockedImprovementType: ImprovementTypeProto,
|
lockedImprovementType: ImprovementTypeProto,
|
||||||
gold: Int,
|
gold: Int,
|
||||||
food: Int,
|
food: Int,
|
||||||
priceIndex: Double,
|
priceIndex: Float,
|
||||||
support: Double,
|
support: Float,
|
||||||
hasActed: Boolean,
|
hasActed: Boolean,
|
||||||
rulerIsTraveling: Boolean,
|
rulerIsTraveling: Boolean,
|
||||||
unaffiliatedHeroes: Vector[UnaffiliatedHeroProto],
|
unaffiliatedHeroes: Vector[UnaffiliatedHeroProto],
|
||||||
|
|||||||
@@ -45,20 +45,20 @@ trait ProvinceT {
|
|||||||
def gold: Int
|
def gold: Int
|
||||||
def food: Int
|
def food: Int
|
||||||
|
|
||||||
def priceIndex: Double
|
def priceIndex: Float
|
||||||
|
|
||||||
def hasActed: Boolean
|
def hasActed: Boolean
|
||||||
def rulerIsTraveling: Boolean
|
def rulerIsTraveling: Boolean
|
||||||
|
|
||||||
def economy: Double
|
def economy: Float
|
||||||
def agriculture: Double
|
def agriculture: Float
|
||||||
def infrastructure: Double
|
def infrastructure: Float
|
||||||
|
|
||||||
def economyDevastation: Double
|
def economyDevastation: Float
|
||||||
def agricultureDevastation: Double
|
def agricultureDevastation: Float
|
||||||
def infrastructureDevastation: Double
|
def infrastructureDevastation: Float
|
||||||
|
|
||||||
def support: Double
|
def support: Float
|
||||||
|
|
||||||
def unaffiliatedHeroes: Vector[UnaffiliatedHeroT]
|
def unaffiliatedHeroes: Vector[UnaffiliatedHeroT]
|
||||||
def capturedHeroes: Vector[CapturedHero]
|
def capturedHeroes: Vector[CapturedHero]
|
||||||
@@ -97,16 +97,16 @@ trait ProvinceT {
|
|||||||
specialBattalionTypeIds,
|
specialBattalionTypeIds,
|
||||||
gold: Int = gold,
|
gold: Int = gold,
|
||||||
food: Int = food,
|
food: Int = food,
|
||||||
priceIndex: Double = priceIndex,
|
priceIndex: Float = priceIndex,
|
||||||
hasActed: Boolean = hasActed,
|
hasActed: Boolean = hasActed,
|
||||||
rulerIsTraveling: Boolean = rulerIsTraveling,
|
rulerIsTraveling: Boolean = rulerIsTraveling,
|
||||||
economy: Double = economy,
|
economy: Float = economy,
|
||||||
agriculture: Double = agriculture,
|
agriculture: Float = agriculture,
|
||||||
infrastructure: Double = infrastructure,
|
infrastructure: Float = infrastructure,
|
||||||
economyDevastation: Double = economyDevastation,
|
economyDevastation: Float = economyDevastation,
|
||||||
agricultureDevastation: Double = agricultureDevastation,
|
agricultureDevastation: Float = agricultureDevastation,
|
||||||
infrastructureDevastation: Double = infrastructureDevastation,
|
infrastructureDevastation: Float = infrastructureDevastation,
|
||||||
support: Double = support,
|
support: Float = support,
|
||||||
unaffiliatedHeroes: Vector[UnaffiliatedHeroT] = unaffiliatedHeroes,
|
unaffiliatedHeroes: Vector[UnaffiliatedHeroT] = unaffiliatedHeroes,
|
||||||
capturedHeroes: Vector[CapturedHero] = capturedHeroes,
|
capturedHeroes: Vector[CapturedHero] = capturedHeroes,
|
||||||
activeEvents: Vector[ProvinceEvent] = activeEvents,
|
activeEvents: Vector[ProvinceEvent] = activeEvents,
|
||||||
@@ -140,24 +140,24 @@ trait ProvinceT {
|
|||||||
def withRulerIsTraveling(rulerIsTraveling: Boolean): ProvinceT =
|
def withRulerIsTraveling(rulerIsTraveling: Boolean): ProvinceT =
|
||||||
copy(rulerIsTraveling = rulerIsTraveling)
|
copy(rulerIsTraveling = rulerIsTraveling)
|
||||||
|
|
||||||
def withEconomy(economy: Double): ProvinceT =
|
def withEconomy(economy: Float): ProvinceT =
|
||||||
copy(economy = economy)
|
copy(economy = economy)
|
||||||
def withAgriculture(agriculture: Double): ProvinceT = copy(
|
def withAgriculture(agriculture: Float): ProvinceT = copy(
|
||||||
agriculture = agriculture
|
agriculture = agriculture
|
||||||
)
|
)
|
||||||
def withInfrastructure(infrastructure: Double): ProvinceT =
|
def withInfrastructure(infrastructure: Float): ProvinceT =
|
||||||
copy(infrastructure = infrastructure)
|
copy(infrastructure = infrastructure)
|
||||||
|
|
||||||
def withEconomyDevastation(economyDevastation: Double): ProvinceT =
|
def withEconomyDevastation(economyDevastation: Float): ProvinceT =
|
||||||
copy(economyDevastation = economyDevastation)
|
copy(economyDevastation = economyDevastation)
|
||||||
|
|
||||||
def withAgricultureDevastation(
|
def withAgricultureDevastation(
|
||||||
agricultureDevastation: Double
|
agricultureDevastation: Float
|
||||||
): ProvinceT =
|
): ProvinceT =
|
||||||
copy(agricultureDevastation = agricultureDevastation)
|
copy(agricultureDevastation = agricultureDevastation)
|
||||||
|
|
||||||
def withInfrastructureDevastation(
|
def withInfrastructureDevastation(
|
||||||
infrastructureDevastation: Double
|
infrastructureDevastation: Float
|
||||||
): ProvinceT =
|
): ProvinceT =
|
||||||
copy(infrastructureDevastation = infrastructureDevastation)
|
copy(infrastructureDevastation = infrastructureDevastation)
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ trait ProvinceT {
|
|||||||
def withFood(food: Int): ProvinceT =
|
def withFood(food: Int): ProvinceT =
|
||||||
copy(food = food)
|
copy(food = food)
|
||||||
|
|
||||||
def withPriceIndex(priceIndex: Double): ProvinceT =
|
def withPriceIndex(priceIndex: Float): ProvinceT =
|
||||||
copy(priceIndex = priceIndex)
|
copy(priceIndex = priceIndex)
|
||||||
|
|
||||||
def withDeferredChanges(deferredChanges: Vector[DeferredChangeT]): ProvinceT =
|
def withDeferredChanges(deferredChanges: Vector[DeferredChangeT]): ProvinceT =
|
||||||
|
|||||||
@@ -34,16 +34,16 @@ case class ProvinceC(
|
|||||||
specialBattalionTypeIds: Vector[BattalionTypeId] = Vector(),
|
specialBattalionTypeIds: Vector[BattalionTypeId] = Vector(),
|
||||||
gold: Int = 0,
|
gold: Int = 0,
|
||||||
food: Int = 0,
|
food: Int = 0,
|
||||||
priceIndex: Double = 0.0,
|
priceIndex: Float = 0.0f,
|
||||||
hasActed: Boolean = false,
|
hasActed: Boolean = false,
|
||||||
rulerIsTraveling: Boolean = false,
|
rulerIsTraveling: Boolean = false,
|
||||||
economy: Double = 0.0,
|
economy: Float = 0.0f,
|
||||||
agriculture: Double = 0.0,
|
agriculture: Float = 0.0f,
|
||||||
infrastructure: Double = 0.0,
|
infrastructure: Float = 0.0f,
|
||||||
economyDevastation: Double = 0.0,
|
economyDevastation: Float = 0.0f,
|
||||||
agricultureDevastation: Double = 0.0,
|
agricultureDevastation: Float = 0.0f,
|
||||||
infrastructureDevastation: Double = 0.0,
|
infrastructureDevastation: Float = 0.0f,
|
||||||
support: Double = 0.0,
|
support: Float = 0.0f,
|
||||||
unaffiliatedHeroes: Vector[UnaffiliatedHeroT] = Vector(),
|
unaffiliatedHeroes: Vector[UnaffiliatedHeroT] = Vector(),
|
||||||
capturedHeroes: Vector[CapturedHero] = Vector(),
|
capturedHeroes: Vector[CapturedHero] = Vector(),
|
||||||
activeEvents: Vector[ProvinceEvent] = Vector(),
|
activeEvents: Vector[ProvinceEvent] = Vector(),
|
||||||
@@ -76,16 +76,16 @@ case class ProvinceC(
|
|||||||
specialBattalionTypeIds: Vector[BattalionTypeId],
|
specialBattalionTypeIds: Vector[BattalionTypeId],
|
||||||
gold: BattalionId,
|
gold: BattalionId,
|
||||||
food: BattalionId,
|
food: BattalionId,
|
||||||
priceIndex: Double,
|
priceIndex: Float,
|
||||||
hasActed: Boolean,
|
hasActed: Boolean,
|
||||||
rulerIsTraveling: Boolean,
|
rulerIsTraveling: Boolean,
|
||||||
economy: Double,
|
economy: Float,
|
||||||
agriculture: Double,
|
agriculture: Float,
|
||||||
infrastructure: Double,
|
infrastructure: Float,
|
||||||
economyDevastation: Double,
|
economyDevastation: Float,
|
||||||
agricultureDevastation: Double,
|
agricultureDevastation: Float,
|
||||||
infrastructureDevastation: Double,
|
infrastructureDevastation: Float,
|
||||||
support: Double,
|
support: Float,
|
||||||
unaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
unaffiliatedHeroes: Vector[UnaffiliatedHeroT],
|
||||||
capturedHeroes: Vector[CapturedHero],
|
capturedHeroes: Vector[CapturedHero],
|
||||||
activeEvents: Vector[ProvinceEvent],
|
activeEvents: Vector[ProvinceEvent],
|
||||||
|
|||||||
+10
-10
@@ -508,7 +508,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
"a result with a changed province with an added deferred event" should "add the deferred event" in {
|
"a result with a changed province with an added deferred event" should "add the deferred event" in {
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
currentDate = Date(year = 123, month = 4),
|
currentDate = Date(year = 123, month = 4),
|
||||||
provinces = Map(7 -> Province(id = 7, priceIndex = 1.0))
|
provinces = Map(7 -> Province(id = 7, priceIndex = 1.0f))
|
||||||
)
|
)
|
||||||
|
|
||||||
val actionResult = ActionResult(changedProvinces =
|
val actionResult = ActionResult(changedProvinces =
|
||||||
@@ -540,7 +540,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
BlizzardStarted(durationMonths = 2),
|
BlizzardStarted(durationMonths = 2),
|
||||||
BlizzardStarted(durationMonths = 3)
|
BlizzardStarted(durationMonths = 3)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -572,7 +572,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
rulingFactionId = Some(5),
|
rulingFactionId = Some(5),
|
||||||
rulingHeroId = Some(6),
|
rulingHeroId = Some(6),
|
||||||
provinceOrders = ProvinceOrderType.DEVELOP,
|
provinceOrders = ProvinceOrderType.DEVELOP,
|
||||||
@@ -623,7 +623,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -833,14 +833,14 @@ class ActionResultProtoApplierImplTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
"A result with changed orders" should "change the province orders" in {
|
"A result with changed orders" should "change the province orders" in {
|
||||||
val province1 = Province(id = 1, priceIndex = 1.0)
|
val province1 = Province(id = 1, priceIndex = 1.0f)
|
||||||
val province2 = Province(
|
val province2 = Province(
|
||||||
id = 2,
|
id = 2,
|
||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingHeroId = Some(7),
|
rulingHeroId = Some(7),
|
||||||
rulingFactionHeroIds = Vector(7),
|
rulingFactionHeroIds = Vector(7),
|
||||||
provinceOrders = MOBILIZE,
|
provinceOrders = MOBILIZE,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
@@ -875,7 +875,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(4, 9, 11, 5),
|
rulingFactionHeroIds = Vector(4, 9, 11, 5),
|
||||||
provinceOrders = ProvinceOrderType.DEVELOP,
|
provinceOrders = ProvinceOrderType.DEVELOP,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
@@ -945,7 +945,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
rulingFactionHeroIds = Vector(4, 9, 11, 5),
|
rulingFactionHeroIds = Vector(4, 9, 11, 5),
|
||||||
provinceOrders = ProvinceOrderType.DEVELOP,
|
provinceOrders = ProvinceOrderType.DEVELOP,
|
||||||
activeEvents = Vector(BeastsEvent(count = 100), BeastsEvent(count = 250)),
|
activeEvents = Vector(BeastsEvent(count = 100), BeastsEvent(count = 250)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
@@ -1013,7 +1013,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
provinceOrders = ProvinceOrderType.DEVELOP,
|
provinceOrders = ProvinceOrderType.DEVELOP,
|
||||||
activeEvents = Vector(),
|
activeEvents = Vector(),
|
||||||
lastBeastsDate = Some(Date(month = 4, year = 222)),
|
lastBeastsDate = Some(Date(month = 4, year = 222)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
@@ -1087,7 +1087,7 @@ class ActionResultProtoApplierImplTest
|
|||||||
provinceOrders = ProvinceOrderType.DEVELOP,
|
provinceOrders = ProvinceOrderType.DEVELOP,
|
||||||
activeEvents = Vector(),
|
activeEvents = Vector(),
|
||||||
lastRiotDate = None,
|
lastRiotDate = None,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
val startingState = GameState(
|
val startingState = GameState(
|
||||||
|
|||||||
+23
-13
@@ -21,7 +21,7 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
val rulingFactionId = 5
|
val rulingFactionId = 5
|
||||||
|
|
||||||
private val lowArmamentBattalion =
|
private val lowArmamentBattalion =
|
||||||
Battalion(`type` = LIGHT_INFANTRY, size = 300, armament = 25.0, id = 7)
|
Battalion(`type` = LIGHT_INFANTRY, size = 300, armament = 25.0f, id = 7)
|
||||||
|
|
||||||
private val highArmamentBattalion =
|
private val highArmamentBattalion =
|
||||||
Battalion(`type` = LONGBOWMEN, size = 600, armament = 87, id = 9)
|
Battalion(`type` = LONGBOWMEN, size = 600, armament = 87, id = 9)
|
||||||
@@ -29,15 +29,15 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
private val province = Province(
|
private val province = Province(
|
||||||
id = 122,
|
id = 122,
|
||||||
rulingFactionId = Some(rulingFactionId),
|
rulingFactionId = Some(rulingFactionId),
|
||||||
infrastructure = 55.0,
|
infrastructure = 55.0f,
|
||||||
battalionIds = Vector(lowArmamentBattalion.id, highArmamentBattalion.id),
|
battalionIds = Vector(lowArmamentBattalion.id, highArmamentBattalion.id),
|
||||||
rulerIsTraveling = true,
|
rulerIsTraveling = true,
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val lightInfantryBaseCost = 0.01
|
private val lightInfantryBaseCost = 0.01f
|
||||||
private val longbowmenBaseCost = 0.03
|
private val longbowmenBaseCost = 0.03f
|
||||||
|
|
||||||
private val battalionTypes = Vector(
|
private val battalionTypes = Vector(
|
||||||
BattalionType(
|
BattalionType(
|
||||||
@@ -85,7 +85,7 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
it should "return nothing if armament is all at or above infrastructure level" in {
|
it should "return nothing if armament is all at or above infrastructure level" in {
|
||||||
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
||||||
gameState = startingState
|
gameState = startingState
|
||||||
.withProvinces(Map(province.id -> province.withInfrastructure(24.5))),
|
.withProvinces(Map(province.id -> province.withInfrastructure(24.5f))),
|
||||||
factionId = rulingFactionId,
|
factionId = rulingFactionId,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
)
|
)
|
||||||
@@ -153,7 +153,7 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
it should "include all battalions if all under infrastructure" in {
|
it should "include all battalions if all under infrastructure" in {
|
||||||
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
||||||
gameState = startingState
|
gameState = startingState
|
||||||
.withProvinces(Map(province.id -> province.withInfrastructure(99.0))),
|
.withProvinces(Map(province.id -> province.withInfrastructure(99.0f))),
|
||||||
factionId = rulingFactionId,
|
factionId = rulingFactionId,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
)
|
)
|
||||||
@@ -167,7 +167,7 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
it should "include a costs message for the available battalion types" in {
|
it should "include a costs message for the available battalion types" in {
|
||||||
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
val command = AvailableArmTroopsCommandFactory.availableCommand(
|
||||||
gameState = startingState
|
gameState = startingState
|
||||||
.withProvinces(Map(province.id -> province.withInfrastructure(99.0))),
|
.withProvinces(Map(province.id -> province.withInfrastructure(99.0f))),
|
||||||
factionId = rulingFactionId,
|
factionId = rulingFactionId,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
)
|
)
|
||||||
@@ -183,16 +183,26 @@ class AvailableArmTroopsCommandFactoryTest
|
|||||||
gameState = startingState
|
gameState = startingState
|
||||||
.withProvinces(
|
.withProvinces(
|
||||||
Map(
|
Map(
|
||||||
province.id -> province.withInfrastructure(99.0).withPriceIndex(1.2)
|
province.id -> province
|
||||||
|
.withInfrastructure(99.0f)
|
||||||
|
.withPriceIndex(1.2f)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
factionId = rulingFactionId,
|
factionId = rulingFactionId,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
)
|
)
|
||||||
|
|
||||||
command.get.armamentCosts should contain.allOf(
|
val expectedLightInfantryCost = lightInfantryBaseCost * 1.2f
|
||||||
ArmamentCost(`type` = LIGHT_INFANTRY, cost = lightInfantryBaseCost * 1.2),
|
val expectedLongbowmenCost = longbowmenBaseCost * 1.2f
|
||||||
ArmamentCost(`type` = LONGBOWMEN, cost = longbowmenBaseCost * 1.2)
|
|
||||||
)
|
command.get.armamentCosts should have size 2
|
||||||
|
command.get.armamentCosts
|
||||||
|
.find(_.`type` == LIGHT_INFANTRY)
|
||||||
|
.get
|
||||||
|
.cost shouldBe expectedLightInfantryCost
|
||||||
|
command.get.armamentCosts
|
||||||
|
.find(_.`type` == LONGBOWMEN)
|
||||||
|
.get
|
||||||
|
.cost shouldBe expectedLongbowmenCost
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -84,7 +84,7 @@ class AvailableDivineCommandsFactoryTest
|
|||||||
),
|
),
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
food = 2400,
|
food = 2400,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
@@ -296,7 +296,7 @@ class AvailableDivineCommandsFactoryTest
|
|||||||
it should "adjust the gold cost based on price index" in {
|
it should "adjust the gold cost based on price index" in {
|
||||||
AvailableDivineCommandsFactory
|
AvailableDivineCommandsFactory
|
||||||
.availableCommand(
|
.availableCommand(
|
||||||
gameState = gameState.update(_.provinces(actingPid).priceIndex := 1.1),
|
gameState = gameState.update(_.provinces(actingPid).priceIndex := 1.1f),
|
||||||
factionId = actingFid,
|
factionId = actingFid,
|
||||||
provinceId = actingPid
|
provinceId = actingPid
|
||||||
)
|
)
|
||||||
|
|||||||
+6
-6
@@ -30,7 +30,7 @@ class AvailableFeastCommandFactoryTest
|
|||||||
5 -> Province(
|
5 -> Province(
|
||||||
rulingFactionHeroIds = Vector(15, 25, 35),
|
rulingFactionHeroIds = Vector(15, 25, 35),
|
||||||
gold = 12,
|
gold = 12,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -53,7 +53,7 @@ class AvailableFeastCommandFactoryTest
|
|||||||
5 -> Province(
|
5 -> Province(
|
||||||
rulingFactionHeroIds = Vector(15, 25, 35),
|
rulingFactionHeroIds = Vector(15, 25, 35),
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -76,7 +76,7 @@ class AvailableFeastCommandFactoryTest
|
|||||||
5 -> Province(
|
5 -> Province(
|
||||||
rulingFactionHeroIds = Vector(15, 25, 35),
|
rulingFactionHeroIds = Vector(15, 25, 35),
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -102,7 +102,7 @@ class AvailableFeastCommandFactoryTest
|
|||||||
5 -> Province(
|
5 -> Province(
|
||||||
rulingFactionHeroIds = Vector(15, 25, 35),
|
rulingFactionHeroIds = Vector(15, 25, 35),
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -128,13 +128,13 @@ class AvailableFeastCommandFactoryTest
|
|||||||
5 -> Province(
|
5 -> Province(
|
||||||
rulingFactionHeroIds = Vector(15, 25, 35),
|
rulingFactionHeroIds = Vector(15, 25, 35),
|
||||||
gold = 1200,
|
gold = 1200,
|
||||||
priceIndex = 1.2
|
priceIndex = 1.2f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val cmd = AvailableFeastCommandFactory.availableCommand(gameState, 9, 5).get
|
val cmd = AvailableFeastCommandFactory.availableCommand(gameState, 9, 5).get
|
||||||
|
|
||||||
cmd.goldCost shouldBe 72
|
cmd.goldCost shouldBe 73
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -202,7 +202,7 @@ class AvailableImproveCommandsFactoryTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "include DEVASTATION option if there is economy devastation" in {
|
it should "include DEVASTATION option if there is economy devastation" in {
|
||||||
val provinceWithDevastation = province.withEconomyDevastation(25.0)
|
val provinceWithDevastation = province.withEconomyDevastation(25.0f)
|
||||||
|
|
||||||
val command = AvailableImproveCommandsFactory
|
val command = AvailableImproveCommandsFactory
|
||||||
.availableCommand(
|
.availableCommand(
|
||||||
@@ -217,7 +217,7 @@ class AvailableImproveCommandsFactoryTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "include DEVASTATION option if there is agriculture devastation" in {
|
it should "include DEVASTATION option if there is agriculture devastation" in {
|
||||||
val provinceWithDevastation = province.withEconomyDevastation(25.0)
|
val provinceWithDevastation = province.withEconomyDevastation(25.0f)
|
||||||
|
|
||||||
val command = AvailableImproveCommandsFactory
|
val command = AvailableImproveCommandsFactory
|
||||||
.availableCommand(
|
.availableCommand(
|
||||||
@@ -232,7 +232,7 @@ class AvailableImproveCommandsFactoryTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "include DEVASTATION option if there is infrastructure devastation" in {
|
it should "include DEVASTATION option if there is infrastructure devastation" in {
|
||||||
val provinceWithDevastation = province.withInfrastructureDevastation(25.0)
|
val provinceWithDevastation = province.withInfrastructureDevastation(25.0f)
|
||||||
|
|
||||||
val command = AvailableImproveCommandsFactory
|
val command = AvailableImproveCommandsFactory
|
||||||
.availableCommand(
|
.availableCommand(
|
||||||
|
|||||||
+5
-5
@@ -39,7 +39,7 @@ class AvailableOrganizeTroopsCommandsFactoryTest
|
|||||||
battalionIds = fullAndNotFullBattalions.map(_.id),
|
battalionIds = fullAndNotFullBattalions.map(_.id),
|
||||||
specialBattalionTypes = Vector(LIGHT_INFANTRY, HEAVY_CAVALRY),
|
specialBattalionTypes = Vector(LIGHT_INFANTRY, HEAVY_CAVALRY),
|
||||||
gold = 2000,
|
gold = 2000,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val battalionTypes = Vector(
|
private val battalionTypes = Vector(
|
||||||
@@ -105,7 +105,7 @@ class AvailableOrganizeTroopsCommandsFactoryTest
|
|||||||
7 -> actingProvince
|
7 -> actingProvince
|
||||||
.withEconomy(70)
|
.withEconomy(70)
|
||||||
.withAgriculture(70)
|
.withAgriculture(70)
|
||||||
.withPriceIndex(1.0),
|
.withPriceIndex(1.0f),
|
||||||
4 -> Province(id = 4, rulingFactionId = Some(5)),
|
4 -> Province(id = 4, rulingFactionId = Some(5)),
|
||||||
8 -> Province(id = 8, rulingFactionId = Some(6)),
|
8 -> Province(id = 8, rulingFactionId = Some(6)),
|
||||||
12 -> Province(id = 12, rulingFactionId = Some(9))
|
12 -> Province(id = 12, rulingFactionId = Some(9))
|
||||||
@@ -128,9 +128,9 @@ class AvailableOrganizeTroopsCommandsFactoryTest
|
|||||||
val gameState = GameState(
|
val gameState = GameState(
|
||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> actingProvince
|
7 -> actingProvince
|
||||||
.withEconomy(70)
|
.withEconomy(70f)
|
||||||
.withAgriculture(70)
|
.withAgriculture(70f)
|
||||||
.withPriceIndex(0.9),
|
.withPriceIndex(0.9f),
|
||||||
4 -> Province(id = 4, rulingFactionId = Some(5)),
|
4 -> Province(id = 4, rulingFactionId = Some(5)),
|
||||||
8 -> Province(id = 8, rulingFactionId = Some(6)),
|
8 -> Province(id = 8, rulingFactionId = Some(6)),
|
||||||
12 -> Province(id = 12, rulingFactionId = Some(9))
|
12 -> Province(id = 12, rulingFactionId = Some(9))
|
||||||
|
|||||||
+3
-3
@@ -21,7 +21,7 @@ class AvailableTradeCommandFactoryTest
|
|||||||
gold = 2000,
|
gold = 2000,
|
||||||
food = 2500,
|
food = 2500,
|
||||||
rulerIsTraveling = true,
|
rulerIsTraveling = true,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val gameState = GameState(
|
private val gameState = GameState(
|
||||||
@@ -105,7 +105,7 @@ class AvailableTradeCommandFactoryTest
|
|||||||
it should "adjust the buy food price based on the price index" in {
|
it should "adjust the buy food price based on the price index" in {
|
||||||
val command = AvailableTradeCommandFactory.availableCommand(
|
val command = AvailableTradeCommandFactory.availableCommand(
|
||||||
gameState = gameState.withProvinces(
|
gameState = gameState.withProvinces(
|
||||||
Map(province.id -> province.withPriceIndex(1.5))
|
Map(province.id -> province.withPriceIndex(1.5f))
|
||||||
),
|
),
|
||||||
factionId = province.rulingFactionId.get,
|
factionId = province.rulingFactionId.get,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
@@ -127,7 +127,7 @@ class AvailableTradeCommandFactoryTest
|
|||||||
it should "adjust the sell food price based on the price index" in {
|
it should "adjust the sell food price based on the price index" in {
|
||||||
val command = AvailableTradeCommandFactory.availableCommand(
|
val command = AvailableTradeCommandFactory.availableCommand(
|
||||||
gameState = gameState.withProvinces(
|
gameState = gameState.withProvinces(
|
||||||
Map(province.id -> province.withPriceIndex(1.5))
|
Map(province.id -> province.withPriceIndex(1.5f))
|
||||||
),
|
),
|
||||||
factionId = province.rulingFactionId.get,
|
factionId = province.rulingFactionId.get,
|
||||||
provinceId = province.id
|
provinceId = province.id
|
||||||
|
|||||||
+10
-10
@@ -127,9 +127,9 @@ class NewRoundActionTest
|
|||||||
Map(
|
Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economyDevastation = 14.3,
|
economyDevastation = 14.3f,
|
||||||
agricultureDevastation = 2.1,
|
agricultureDevastation = 2.1f,
|
||||||
infrastructureDevastation = 19.1
|
infrastructureDevastation = 19.1f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -151,9 +151,9 @@ class NewRoundActionTest
|
|||||||
Map(
|
Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economyDevastation = 0.3,
|
economyDevastation = 0.3f,
|
||||||
agricultureDevastation = 1.9,
|
agricultureDevastation = 1.9f,
|
||||||
infrastructureDevastation = 0.0
|
infrastructureDevastation = 0.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -164,8 +164,8 @@ class NewRoundActionTest
|
|||||||
inside(results.head.changedProvinces.head) { case cp: ChangedProvince =>
|
inside(results.head.changedProvinces.head) { case cp: ChangedProvince =>
|
||||||
cp.id shouldBe 7
|
cp.id shouldBe 7
|
||||||
cp.setHasActed shouldBe Some(false)
|
cp.setHasActed shouldBe Some(false)
|
||||||
cp.economyDevastationDelta shouldBe Some(-0.3)
|
cp.economyDevastationDelta shouldBe Some(-0.3f)
|
||||||
cp.agricultureDevastationDelta shouldBe Some(-1.9)
|
cp.agricultureDevastationDelta shouldBe Some(-1.9f)
|
||||||
cp.infrastructureDevastationDelta shouldBe None
|
cp.infrastructureDevastationDelta shouldBe None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -898,7 +898,7 @@ class NewRoundActionTest
|
|||||||
economy = 100,
|
economy = 100,
|
||||||
agriculture = 100,
|
agriculture = 100,
|
||||||
infrastructure = 100,
|
infrastructure = 100,
|
||||||
priceIndex = 0.75
|
priceIndex = 0.75f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -907,7 +907,7 @@ class NewRoundActionTest
|
|||||||
|
|
||||||
forExactly(1, results) { result =>
|
forExactly(1, results) { result =>
|
||||||
result.changedProvinces.head.newPriceIndex shouldBe Some(
|
result.changedProvinces.head.newPriceIndex shouldBe Some(
|
||||||
0.75 + 0.1 * 0.5
|
0.75f + 0.1f * 0.5f
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class NewYearActionTest
|
|||||||
MinSupportForTaxes.setDoubleValue(45)
|
MinSupportForTaxes.setDoubleValue(45)
|
||||||
FoodIncreasePerAgriculture.setDoubleValue(60)
|
FoodIncreasePerAgriculture.setDoubleValue(60)
|
||||||
GoldIncreasePerEconomy.setDoubleValue(40)
|
GoldIncreasePerEconomy.setDoubleValue(40)
|
||||||
PercentDegradationPerYear.setDoubleValue(15)
|
PercentDegradationPerYear.setDoubleValue(15f)
|
||||||
LoyaltyDiscordanceThreshold.setDoubleValue(10)
|
LoyaltyDiscordanceThreshold.setDoubleValue(10)
|
||||||
LoyaltyDecreasePerDiscordance.setDoubleValue(0.3)
|
LoyaltyDecreasePerDiscordance.setDoubleValue(0.3)
|
||||||
AmbitionFactorForLoyaltyDegradation.setDoubleValue(0.2)
|
AmbitionFactorForLoyaltyDegradation.setDoubleValue(0.2)
|
||||||
@@ -162,7 +162,7 @@ class NewYearActionTest
|
|||||||
|
|
||||||
for ((oldProv, newProv) <- oldAndNew) {
|
for ((oldProv, newProv) <- oldAndNew) {
|
||||||
newProv.economyDelta shouldBe empty
|
newProv.economyDelta shouldBe empty
|
||||||
newProv.economyDevastationDelta should contain(0.15 * oldProv.economy)
|
newProv.economyDevastationDelta should contain(0.15f * oldProv.economy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ class NewYearActionTest
|
|||||||
for ((oldProv, newProv) <- oldAndNew) {
|
for ((oldProv, newProv) <- oldAndNew) {
|
||||||
newProv.agricultureDelta shouldBe empty
|
newProv.agricultureDelta shouldBe empty
|
||||||
newProv.agricultureDevastationDelta should contain(
|
newProv.agricultureDevastationDelta should contain(
|
||||||
0.15 * oldProv.agriculture
|
0.15f * oldProv.agriculture
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ class NewYearActionTest
|
|||||||
for ((oldProv, newProv) <- oldAndNew) {
|
for ((oldProv, newProv) <- oldAndNew) {
|
||||||
newProv.infrastructureDelta shouldBe empty
|
newProv.infrastructureDelta shouldBe empty
|
||||||
newProv.infrastructureDevastationDelta should contain(
|
newProv.infrastructureDevastationDelta should contain(
|
||||||
0.15 * oldProv.infrastructure
|
0.15f * oldProv.infrastructure
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ class NewYearActionTest
|
|||||||
)
|
)
|
||||||
|
|
||||||
for ((oldProv, newProv) <- oldAndNew) {
|
for ((oldProv, newProv) <- oldAndNew) {
|
||||||
newProv.supportDelta should contain(-0.15 * oldProv.support)
|
newProv.supportDelta should contain(-0.15f * oldProv.support)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+35
-35
@@ -289,7 +289,7 @@ class PerformProvinceEventsActionTest
|
|||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
activeEvents = Vector.empty,
|
activeEvents = Vector.empty,
|
||||||
infrastructure = 65.0,
|
infrastructure = 65.0f,
|
||||||
lastBeastsDate = Some(Date(year = 1500, month = 8))
|
lastBeastsDate = Some(Date(year = 1500, month = 8))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -310,7 +310,7 @@ class PerformProvinceEventsActionTest
|
|||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
activeEvents = Vector.empty,
|
activeEvents = Vector.empty,
|
||||||
infrastructure = 65.0,
|
infrastructure = 65.0f,
|
||||||
lastBeastsDate = Some(Date(year = 1500, month = 5))
|
lastBeastsDate = Some(Date(year = 1500, month = 5))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -332,7 +332,7 @@ class PerformProvinceEventsActionTest
|
|||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
BeastsEvent(
|
BeastsEvent(
|
||||||
count = 150,
|
count = 150,
|
||||||
@@ -365,7 +365,7 @@ class PerformProvinceEventsActionTest
|
|||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
BeastsEvent(
|
BeastsEvent(
|
||||||
count = 150,
|
count = 150,
|
||||||
@@ -398,7 +398,7 @@ class PerformProvinceEventsActionTest
|
|||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
BeastsEvent(
|
BeastsEvent(
|
||||||
count = 150,
|
count = 150,
|
||||||
@@ -431,7 +431,7 @@ class PerformProvinceEventsActionTest
|
|||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(fid),
|
rulingFactionId = Some(fid),
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
BeastsEvent(
|
BeastsEvent(
|
||||||
count = 150,
|
count = 150,
|
||||||
@@ -898,7 +898,7 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
FestivalEvent(
|
FestivalEvent(
|
||||||
startDate = Date(year = 1501, month = 3),
|
startDate = Date(year = 1501, month = 3),
|
||||||
@@ -928,7 +928,7 @@ class PerformProvinceEventsActionTest
|
|||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(4),
|
rulingFactionId = Some(4),
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
FestivalEvent(
|
FestivalEvent(
|
||||||
startDate = Date(year = 1501, month = 3),
|
startDate = Date(year = 1501, month = 3),
|
||||||
@@ -964,7 +964,7 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
economyDevastation = 3,
|
economyDevastation = 3,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
BlizzardEvent(
|
BlizzardEvent(
|
||||||
@@ -995,9 +995,9 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
agricultureDevastation = 3,
|
agricultureDevastation = 3,
|
||||||
infrastructure = 0.0,
|
infrastructure = 0.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
FloodEvent(
|
FloodEvent(
|
||||||
startDate = Date(year = 1501, month = 7),
|
startDate = Date(year = 1501, month = 7),
|
||||||
@@ -1027,9 +1027,9 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
agricultureDevastation = 3,
|
agricultureDevastation = 3,
|
||||||
infrastructure = 0.0,
|
infrastructure = 0.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
DroughtEvent(
|
DroughtEvent(
|
||||||
startDate = Date(year = 1501, month = 7),
|
startDate = Date(year = 1501, month = 7),
|
||||||
@@ -1058,9 +1058,9 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructureDevastation = 3,
|
infrastructureDevastation = 3,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents = Vector(
|
activeEvents = Vector(
|
||||||
FloodEvent(
|
FloodEvent(
|
||||||
startDate = Date(year = 1501, month = 7),
|
startDate = Date(year = 1501, month = 7),
|
||||||
@@ -1094,9 +1094,9 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
economyDevastation = 3,
|
economyDevastation = 3,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents = Vector()
|
activeEvents = Vector()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1124,8 +1124,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents = Vector()
|
activeEvents = Vector()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1144,8 +1144,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents = Vector()
|
activeEvents = Vector()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1164,8 +1164,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents =
|
activeEvents =
|
||||||
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
||||||
)
|
)
|
||||||
@@ -1190,8 +1190,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents =
|
activeEvents =
|
||||||
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
||||||
)
|
)
|
||||||
@@ -1216,8 +1216,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents =
|
activeEvents =
|
||||||
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
||||||
)
|
)
|
||||||
@@ -1238,8 +1238,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
neighbors =
|
neighbors =
|
||||||
Vector(Neighbor(provinceId = 8, startingPositionIndex = 3))
|
Vector(Neighbor(provinceId = 8, startingPositionIndex = 3))
|
||||||
),
|
),
|
||||||
@@ -1272,8 +1272,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
activeEvents =
|
activeEvents =
|
||||||
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
||||||
)
|
)
|
||||||
@@ -1302,8 +1302,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
battalionIds = Vector(19, 25),
|
battalionIds = Vector(19, 25),
|
||||||
activeEvents =
|
activeEvents =
|
||||||
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
Vector(EpidemicEvent(startDate = Date(year = 1501, month = 6)))
|
||||||
@@ -1333,8 +1333,8 @@ class PerformProvinceEventsActionTest
|
|||||||
provinces = Map(
|
provinces = Map(
|
||||||
7 -> Province(
|
7 -> Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
economy = 51.0,
|
economy = 51.0f,
|
||||||
infrastructure = 40.0,
|
infrastructure = 40.0f,
|
||||||
rulingFactionHeroIds = Vector(19, 25),
|
rulingFactionHeroIds = Vector(19, 25),
|
||||||
rulingFactionId = Some(12),
|
rulingFactionId = Some(12),
|
||||||
rulingHeroId = Some(25),
|
rulingHeroId = Some(25),
|
||||||
|
|||||||
+1
-1
@@ -263,7 +263,7 @@ class PerformUncontestedConquestActionTest extends AnyFlatSpec with Matchers {
|
|||||||
newBattalionIds = Vector(34, 99),
|
newBattalionIds = Vector(34, 99),
|
||||||
newRulingFactionId = Some(attackerId),
|
newRulingFactionId = Some(attackerId),
|
||||||
removedHostileArmyFactionIds = Vector(attackerId),
|
removedHostileArmyFactionIds = Vector(attackerId),
|
||||||
supportDelta = Some(-0.0),
|
supportDelta = Some(-0.0f),
|
||||||
newProvinceOrders = Some(Entrust),
|
newProvinceOrders = Some(Entrust),
|
||||||
clearDefendingArmy = true
|
clearDefendingArmy = true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class AlmsCommandTest
|
|||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
MaxAlmsFood.setIntValue(1000)
|
MaxAlmsFood.setIntValue(1000)
|
||||||
AlmsMaxCharismaXp.setIntValue(10)
|
AlmsMaxCharismaXp.setIntValue(10)
|
||||||
AlmsSupportIncreasePerFood.setDoubleValue(0.01)
|
AlmsSupportIncreasePerFood.setFloatValue(0.01f)
|
||||||
AlmsPaladinSupportMultiplier.setDoubleValue(4)
|
AlmsPaladinSupportMultiplier.setFloatValue(4f)
|
||||||
ActionVigorCost.setIntValue(actionVigorCost)
|
ActionVigorCost.setIntValue(actionVigorCost)
|
||||||
VigorToConstitutionXpMultiplier.setDoubleValue(0.2)
|
VigorToConstitutionXpMultiplier.setDoubleValue(0.2)
|
||||||
XpForStatBump.setIntValue(100)
|
XpForStatBump.setIntValue(100)
|
||||||
@@ -180,7 +180,7 @@ class AlmsCommandTest
|
|||||||
|
|
||||||
cp shouldBe ChangedProvinceC(
|
cp shouldBe ChangedProvinceC(
|
||||||
provinceId = actingProvince.id,
|
provinceId = actingProvince.id,
|
||||||
supportDelta = Some(11.11), // 1111 * 0.01
|
supportDelta = Some(11.11f), // 1111 * 0.01
|
||||||
foodDelta = Some(-1111)
|
foodDelta = Some(-1111)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ class AlmsCommandTest
|
|||||||
|
|
||||||
cp shouldBe ChangedProvinceC(
|
cp shouldBe ChangedProvinceC(
|
||||||
provinceId = actingProvince.id,
|
provinceId = actingProvince.id,
|
||||||
supportDelta = Some(44.44), // 1111 * 4
|
supportDelta = Some(44.44f), // 1111 * 4
|
||||||
foodDelta = Some(-1111)
|
foodDelta = Some(-1111)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -52,7 +52,7 @@ class ArmTroopsCommandTest
|
|||||||
rulerIsTraveling = true,
|
rulerIsTraveling = true,
|
||||||
gold = 9999,
|
gold = 9999,
|
||||||
infrastructure = 100,
|
infrastructure = 100,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val availableBattalions = battalions.map(_.id)
|
private val availableBattalions = battalions.map(_.id)
|
||||||
@@ -271,7 +271,7 @@ class ArmTroopsCommandTest
|
|||||||
val result = command.immediateExecute
|
val result = command.immediateExecute
|
||||||
|
|
||||||
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
||||||
cp.newPriceIndex shouldBe Some(1.0 + expectedCost * 0.0001)
|
cp.newPriceIndex shouldBe Some(1.0f + expectedCost * 0.0001f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -86,7 +86,7 @@ class DivineCommandTest
|
|||||||
private val province = ProvinceC(
|
private val province = ProvinceC(
|
||||||
id = provinceId,
|
id = provinceId,
|
||||||
gold = 2500,
|
gold = 2500,
|
||||||
priceIndex = 1.00,
|
priceIndex = 1.00f,
|
||||||
rulingFactionId = Some(actingFactionId),
|
rulingFactionId = Some(actingFactionId),
|
||||||
rulingHeroId = Some(37),
|
rulingHeroId = Some(37),
|
||||||
rulingFactionHeroIds = Vector(37),
|
rulingFactionHeroIds = Vector(37),
|
||||||
@@ -275,7 +275,7 @@ class DivineCommandTest
|
|||||||
selectedHeroIds = Vector(12, 15),
|
selectedHeroIds = Vector(12, 15),
|
||||||
gameId = gameId,
|
gameId = gameId,
|
||||||
currentRoundId = currentRoundId,
|
currentRoundId = currentRoundId,
|
||||||
allProvinces = Vector(province.withPriceIndex(0.9)),
|
allProvinces = Vector(province.withPriceIndex(0.9f)),
|
||||||
factions = factions,
|
factions = factions,
|
||||||
battalions = Vector()
|
battalions = Vector()
|
||||||
)
|
)
|
||||||
@@ -304,7 +304,7 @@ class DivineCommandTest
|
|||||||
.newValue
|
.newValue
|
||||||
|
|
||||||
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
||||||
cp.newPriceIndex shouldBe Some(1.02)
|
cp.newPriceIndex shouldBe Some(1.02f)
|
||||||
} // 200 gold spent
|
} // 200 gold spent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class FeastCommandTest
|
|||||||
rulingHeroId = Some(7),
|
rulingHeroId = Some(7),
|
||||||
rulingFactionHeroIds = Vector(5, 6, 7, 8),
|
rulingFactionHeroIds = Vector(5, 6, 7, 8),
|
||||||
gold = 900,
|
gold = 900,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val normalHero = HeroC(
|
private val normalHero = HeroC(
|
||||||
@@ -122,7 +122,7 @@ class FeastCommandTest
|
|||||||
|
|
||||||
forExactly(1, result.changedProvinces) { case cp: ChangedProvinceC =>
|
forExactly(1, result.changedProvinces) { case cp: ChangedProvinceC =>
|
||||||
cp.provinceId shouldBe province.id
|
cp.provinceId shouldBe province.id
|
||||||
cp.newPriceIndex shouldBe Some(1.01) // 1.0 + 0.0001 * 100
|
cp.newPriceIndex shouldBe Some(1.01f) // 1.0 + 0.0001 * 100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -67,7 +67,7 @@ class HeroGiftCommandTest
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val anotherOwnedProvince = ProvinceC(
|
private val anotherOwnedProvince = ProvinceC(
|
||||||
@@ -89,7 +89,7 @@ class HeroGiftCommandTest
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val factionProvinces: Vector[ProvinceT] =
|
private val factionProvinces: Vector[ProvinceT] =
|
||||||
@@ -195,7 +195,7 @@ class HeroGiftCommandTest
|
|||||||
|
|
||||||
it should "adjust the loyalty differently based on price index" in {
|
it should "adjust the loyalty differently based on price index" in {
|
||||||
val recipientProvinceWithPriceIndex =
|
val recipientProvinceWithPriceIndex =
|
||||||
recipientProvince.copy(priceIndex = 1.25)
|
recipientProvince.copy(priceIndex = 1.25f)
|
||||||
|
|
||||||
val cmd = HeroGiftCommand.make(
|
val cmd = HeroGiftCommand.make(
|
||||||
actingFactionId = factionId,
|
actingFactionId = factionId,
|
||||||
@@ -507,7 +507,7 @@ class HeroGiftCommandTest
|
|||||||
|
|
||||||
forExactly(1, res.changedProvinces) { case cp: ChangedProvinceC =>
|
forExactly(1, res.changedProvinces) { case cp: ChangedProvinceC =>
|
||||||
cp.provinceId shouldBe provinceId
|
cp.provinceId shouldBe provinceId
|
||||||
cp.newPriceIndex shouldBe Some(1.008)
|
cp.newPriceIndex shouldBe Some(1.008f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-25
@@ -56,7 +56,7 @@ class ImproveCommandTest
|
|||||||
id = 7,
|
id = 7,
|
||||||
rulingFactionId = Some(actingFactionId),
|
rulingFactionId = Some(actingFactionId),
|
||||||
rulingFactionHeroIds = heroes.map(_.id),
|
rulingFactionHeroIds = heroes.map(_.id),
|
||||||
support = 27.0
|
support = 27.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val availableTypes = Vector(
|
private val availableTypes = Vector(
|
||||||
@@ -66,10 +66,10 @@ class ImproveCommandTest
|
|||||||
ImprovementType.Devastation
|
ImprovementType.Devastation
|
||||||
)
|
)
|
||||||
|
|
||||||
private val improvementPerStat = 0.08
|
private val improvementPerStat = 0.08f
|
||||||
private val improvementReductionMax = 0.25
|
private val improvementReductionMax = 0.25f
|
||||||
private val improvementSupportGain = 0.75
|
private val improvementSupportGain = 0.75f
|
||||||
private val engineerImprovementBonus = 1.8
|
private val engineerImprovementBonus = 1.8f
|
||||||
private val xpPerStat = 5
|
private val xpPerStat = 5
|
||||||
|
|
||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
@@ -82,7 +82,7 @@ class ImproveCommandTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val expectedImprovementFromZero =
|
private val expectedImprovementFromZero =
|
||||||
4.08 // improvementPerStat * (40 + 62) / 2.0
|
improvementPerStat * (40f + 62f) / 2.0f
|
||||||
|
|
||||||
"execute" should "throw if the selected improvement is not available" in {
|
"execute" should "throw if the selected improvement is not available" in {
|
||||||
the[EagleCommandException] thrownBy {
|
the[EagleCommandException] thrownBy {
|
||||||
@@ -222,9 +222,9 @@ class ImproveCommandTest
|
|||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.copy(
|
actingProvince = province.copy(
|
||||||
economyDevastation = 25.0,
|
economyDevastation = 25.0f,
|
||||||
agricultureDevastation = 35.0,
|
agricultureDevastation = 35.0f,
|
||||||
infrastructureDevastation = 10.0
|
infrastructureDevastation = 10.0f
|
||||||
),
|
),
|
||||||
improvementType = ImprovementType.Devastation,
|
improvementType = ImprovementType.Devastation,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
@@ -247,14 +247,15 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero.copy(strength = 85, agility = 93),
|
actingHero = actingHero.copy(strength = 85, agility = 93),
|
||||||
actingProvince = province.withEconomyDevastation(25.0),
|
actingProvince = province.withEconomyDevastation(25.0f),
|
||||||
improvementType = ImprovementType.Devastation,
|
improvementType = ImprovementType.Devastation,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
lockImprovementType = false
|
lockImprovementType = false
|
||||||
)
|
)
|
||||||
|
|
||||||
val betterExpectedImprovement = 7.12 // improvementPerStat * (85 + 93) / 2.0
|
val betterExpectedImprovement =
|
||||||
|
improvementPerStat * (85f + 93f) / 2.0f
|
||||||
|
|
||||||
val result = cmd.immediateExecute
|
val result = cmd.immediateExecute
|
||||||
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
||||||
@@ -269,7 +270,7 @@ class ImproveCommandTest
|
|||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero
|
actingHero = actingHero
|
||||||
.withProfession(Profession.Engineer),
|
.withProfession(Profession.Engineer),
|
||||||
actingProvince = province.withInfrastructureDevastation(25.0),
|
actingProvince = province.withInfrastructureDevastation(25.0f),
|
||||||
improvementType = ImprovementType.Devastation,
|
improvementType = ImprovementType.Devastation,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -277,7 +278,7 @@ class ImproveCommandTest
|
|||||||
)
|
)
|
||||||
|
|
||||||
val expectedImprovement =
|
val expectedImprovement =
|
||||||
expectedImprovementFromZero + engineerImprovementBonus
|
5.8799996f // expectedImprovementFromZero + engineerImprovementBonus in Float precision
|
||||||
val result = cmd.immediateExecute
|
val result = cmd.immediateExecute
|
||||||
|
|
||||||
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
||||||
@@ -291,7 +292,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withAgricultureDevastation(25.0),
|
actingProvince = province.withAgricultureDevastation(25.0f),
|
||||||
improvementType = ImprovementType.Devastation,
|
improvementType = ImprovementType.Devastation,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -311,7 +312,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withEconomy(0.0),
|
actingProvince = province.withEconomy(0.0f),
|
||||||
improvementType = ImprovementType.Economy,
|
improvementType = ImprovementType.Economy,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -331,7 +332,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withEconomy(45.0),
|
actingProvince = province.withEconomy(45.0f),
|
||||||
improvementType = ImprovementType.Economy,
|
improvementType = ImprovementType.Economy,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -339,7 +340,7 @@ class ImproveCommandTest
|
|||||||
)
|
)
|
||||||
|
|
||||||
val reducedExpectedImprovement =
|
val reducedExpectedImprovement =
|
||||||
(1.0 - 0.45 * improvementReductionMax) * expectedImprovementFromZero
|
(1.0f - 0.45f * improvementReductionMax) * expectedImprovementFromZero
|
||||||
|
|
||||||
val result = cmd.immediateExecute
|
val result = cmd.immediateExecute
|
||||||
|
|
||||||
@@ -354,14 +355,15 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero.copy(strength = 85, agility = 93),
|
actingHero = actingHero.copy(strength = 85, agility = 93),
|
||||||
actingProvince = province.withEconomy(0.0),
|
actingProvince = province.withEconomy(0.0f),
|
||||||
improvementType = ImprovementType.Economy,
|
improvementType = ImprovementType.Economy,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
lockImprovementType = false
|
lockImprovementType = false
|
||||||
)
|
)
|
||||||
|
|
||||||
val betterExpectedImprovement = 7.12 // improvementPerStat * (85 + 93) / 2.0
|
val betterExpectedImprovement =
|
||||||
|
improvementPerStat * (85f + 93f) / 2.0f
|
||||||
|
|
||||||
val result = cmd.immediateExecute
|
val result = cmd.immediateExecute
|
||||||
|
|
||||||
@@ -377,7 +379,7 @@ class ImproveCommandTest
|
|||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero
|
actingHero = actingHero
|
||||||
.withProfession(Profession.Engineer),
|
.withProfession(Profession.Engineer),
|
||||||
actingProvince = province.withEconomy(0.0),
|
actingProvince = province.withEconomy(0.0f),
|
||||||
improvementType = ImprovementType.Economy,
|
improvementType = ImprovementType.Economy,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -385,7 +387,7 @@ class ImproveCommandTest
|
|||||||
)
|
)
|
||||||
|
|
||||||
val expectedImprovement =
|
val expectedImprovement =
|
||||||
expectedImprovementFromZero + engineerImprovementBonus
|
5.8799996f // expectedImprovementFromZero + engineerImprovementBonus in Float precision
|
||||||
val result = cmd.immediateExecute
|
val result = cmd.immediateExecute
|
||||||
|
|
||||||
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.head) { case cp: ChangedProvinceC =>
|
||||||
@@ -399,7 +401,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withEconomy(0.0),
|
actingProvince = province.withEconomy(0.0f),
|
||||||
improvementType = ImprovementType.Economy,
|
improvementType = ImprovementType.Economy,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -419,7 +421,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withAgriculture(0.0),
|
actingProvince = province.withAgriculture(0.0f),
|
||||||
improvementType = ImprovementType.Agriculture,
|
improvementType = ImprovementType.Agriculture,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -439,7 +441,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withInfrastructure(0.0),
|
actingProvince = province.withInfrastructure(0.0f),
|
||||||
improvementType = ImprovementType.Infrastructure,
|
improvementType = ImprovementType.Infrastructure,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
@@ -459,7 +461,7 @@ class ImproveCommandTest
|
|||||||
val cmd = ImproveCommand.make(
|
val cmd = ImproveCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingHero = actingHero,
|
actingHero = actingHero,
|
||||||
actingProvince = province.withInfrastructure(0.0),
|
actingProvince = province.withInfrastructure(0.0f),
|
||||||
improvementType = ImprovementType.Infrastructure,
|
improvementType = ImprovementType.Infrastructure,
|
||||||
availableHeroIds = heroes.map(_.id),
|
availableHeroIds = heroes.map(_.id),
|
||||||
availableImprovementTypes = availableTypes,
|
availableImprovementTypes = availableTypes,
|
||||||
|
|||||||
+2
-2
@@ -79,7 +79,7 @@ class OrganizeTroopsCommandTest extends AnyFlatSpec with Matchers {
|
|||||||
rulingFactionId = Some(actingFactionId),
|
rulingFactionId = Some(actingFactionId),
|
||||||
battalionIds = Vector(battalion1.id),
|
battalionIds = Vector(battalion1.id),
|
||||||
gold = startingGold,
|
gold = startingGold,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
private val existingBattalions = Vector(battalion1, battalion2, battalion3)
|
private val existingBattalions = Vector(battalion1, battalion2, battalion3)
|
||||||
@@ -810,7 +810,7 @@ class OrganizeTroopsCommandTest extends AnyFlatSpec with Matchers {
|
|||||||
result.changedProvinces should have size 1
|
result.changedProvinces should have size 1
|
||||||
|
|
||||||
inside(result.changedProvinces.head) { case p =>
|
inside(result.changedProvinces.head) { case p =>
|
||||||
p.newPriceIndex shouldBe Some(1.054) // 1.0 + 0.0001 * 450.0 * 1.2
|
p.newPriceIndex shouldBe Some(1.054f) // 1.0 + 0.0001 * 450.0 * 1.2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class TradeCommandTest
|
|||||||
gold = startingGold,
|
gold = startingGold,
|
||||||
food = startingFood,
|
food = startingFood,
|
||||||
rulerIsTraveling = true,
|
rulerIsTraveling = true,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
@@ -159,7 +159,7 @@ class TradeCommandTest
|
|||||||
it should "spend more gold based on the price index" in {
|
it should "spend more gold based on the price index" in {
|
||||||
val command = TradeCommand.make(
|
val command = TradeCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingProvince = province.withPriceIndex(1.5),
|
actingProvince = province.withPriceIndex(1.5f),
|
||||||
tradeType = BuyFood,
|
tradeType = BuyFood,
|
||||||
amount = 1000
|
amount = 1000
|
||||||
)
|
)
|
||||||
@@ -173,7 +173,7 @@ class TradeCommandTest
|
|||||||
it should "not change the food amount based on the price index" in {
|
it should "not change the food amount based on the price index" in {
|
||||||
val command = TradeCommand.make(
|
val command = TradeCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingProvince = province.withPriceIndex(1.5),
|
actingProvince = province.withPriceIndex(1.5f),
|
||||||
tradeType = BuyFood,
|
tradeType = BuyFood,
|
||||||
amount = 1000
|
amount = 1000
|
||||||
)
|
)
|
||||||
@@ -223,7 +223,7 @@ class TradeCommandTest
|
|||||||
|
|
||||||
val result = command.immediateExecute
|
val result = command.immediateExecute
|
||||||
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
||||||
cp.newPriceIndex shouldBe Some(1.06) // spent 600 gold
|
cp.newPriceIndex shouldBe Some(1.06f) // spent 600 gold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ class TradeCommandTest
|
|||||||
it should "gain more gold based on the price index" in {
|
it should "gain more gold based on the price index" in {
|
||||||
val command = TradeCommand.make(
|
val command = TradeCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingProvince = province.withPriceIndex(1.5),
|
actingProvince = province.withPriceIndex(1.5f),
|
||||||
tradeType = SellFood,
|
tradeType = SellFood,
|
||||||
amount = 1000
|
amount = 1000
|
||||||
)
|
)
|
||||||
@@ -258,7 +258,7 @@ class TradeCommandTest
|
|||||||
it should "not adjust the food based on the price index" in {
|
it should "not adjust the food based on the price index" in {
|
||||||
val command = TradeCommand.make(
|
val command = TradeCommand.make(
|
||||||
actingFactionId = actingFactionId,
|
actingFactionId = actingFactionId,
|
||||||
actingProvince = province.withPriceIndex(1.5),
|
actingProvince = province.withPriceIndex(1.5f),
|
||||||
tradeType = SellFood,
|
tradeType = SellFood,
|
||||||
amount = 1000
|
amount = 1000
|
||||||
)
|
)
|
||||||
@@ -308,7 +308,7 @@ class TradeCommandTest
|
|||||||
|
|
||||||
val result = command.immediateExecute
|
val result = command.immediateExecute
|
||||||
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
inside(result.changedProvinces.loneElement) { case cp: ChangedProvinceC =>
|
||||||
cp.newPriceIndex shouldBe Some(0.975) // gained 250 gold
|
cp.newPriceIndex shouldBe Some(0.975f) // gained 250 gold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,24 +15,24 @@ class PriceIndexUtilsTest
|
|||||||
with Matchers
|
with Matchers
|
||||||
with BeforeAndAfterEach {
|
with BeforeAndAfterEach {
|
||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
MinimumPriceIndex.setDoubleValue(0.6)
|
MinimumPriceIndex.setFloatValue(0.6f)
|
||||||
MaximumPriceIndex.setDoubleValue(1.6)
|
MaximumPriceIndex.setFloatValue(1.6f)
|
||||||
PriceIndexReturnRate.setDoubleValue(0.25)
|
PriceIndexReturnRate.setFloatValue(0.25f)
|
||||||
PriceIndexShiftPerGold.setDoubleValue(0.0001)
|
PriceIndexShiftPerGold.setFloatValue(0.0001f)
|
||||||
}
|
}
|
||||||
|
|
||||||
"clampedIndex" should "never be less than the minimum" in {
|
"clampedIndex" should "never be less than the minimum" in {
|
||||||
PriceIndexUtils.clampedIndex(0.52) shouldBe 0.6
|
PriceIndexUtils.clampedIndex(0.52f) shouldBe 0.6f
|
||||||
PriceIndexUtils.clampedIndex(-1) shouldBe 0.6
|
PriceIndexUtils.clampedIndex(-1f) shouldBe 0.6f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "never be more than the maximum" in {
|
it should "never be more than the maximum" in {
|
||||||
PriceIndexUtils.clampedIndex(1.7) shouldBe 1.6
|
PriceIndexUtils.clampedIndex(1.7f) shouldBe 1.6f
|
||||||
PriceIndexUtils.clampedIndex(100) shouldBe 1.6
|
PriceIndexUtils.clampedIndex(100f) shouldBe 1.6f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "return the value if it's within the range" in {
|
it should "return the value if it's within the range" in {
|
||||||
PriceIndexUtils.clampedIndex(0.75) shouldBe 0.75
|
PriceIndexUtils.clampedIndex(0.75f) shouldBe 0.75f
|
||||||
}
|
}
|
||||||
|
|
||||||
"steadyState" should "return minimum when all inputs are 0" in {
|
"steadyState" should "return minimum when all inputs are 0" in {
|
||||||
@@ -43,7 +43,7 @@ class PriceIndexUtilsTest
|
|||||||
economyDevastation = 0,
|
economyDevastation = 0,
|
||||||
agricultureDevastation = 0,
|
agricultureDevastation = 0,
|
||||||
infrastructureDevastation = 0
|
infrastructureDevastation = 0
|
||||||
) shouldBe 0.6
|
) shouldBe 0.6f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "return minimum + 0.5 when all inputs are 100" in {
|
it should "return minimum + 0.5 when all inputs are 100" in {
|
||||||
@@ -54,7 +54,7 @@ class PriceIndexUtilsTest
|
|||||||
economyDevastation = 0,
|
economyDevastation = 0,
|
||||||
agricultureDevastation = 0,
|
agricultureDevastation = 0,
|
||||||
infrastructureDevastation = 0
|
infrastructureDevastation = 0
|
||||||
) shouldBe 1.1
|
) shouldBe 1.1f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "be higher if there is devastation" in {
|
it should "be higher if there is devastation" in {
|
||||||
@@ -65,7 +65,7 @@ class PriceIndexUtilsTest
|
|||||||
economyDevastation = 25,
|
economyDevastation = 25,
|
||||||
agricultureDevastation = 25,
|
agricultureDevastation = 25,
|
||||||
infrastructureDevastation = 25
|
infrastructureDevastation = 25
|
||||||
) shouldBe 1.225
|
) shouldBe 1.225f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "clamp if devastation is excessive" in {
|
it should "clamp if devastation is excessive" in {
|
||||||
@@ -76,30 +76,30 @@ class PriceIndexUtilsTest
|
|||||||
economyDevastation = 100,
|
economyDevastation = 100,
|
||||||
agricultureDevastation = 100,
|
agricultureDevastation = 100,
|
||||||
infrastructureDevastation = 100
|
infrastructureDevastation = 100
|
||||||
) shouldBe 1.6
|
) shouldBe 1.6f
|
||||||
}
|
}
|
||||||
|
|
||||||
"shiftedTowardSteadyState" should "move by 25% of the difference toward steady state" in {
|
"shiftedTowardSteadyState" should "move by 25% of the difference toward steady state" in {
|
||||||
PriceIndexUtils.shiftedTowardSteadyState(
|
PriceIndexUtils.shiftedTowardSteadyState(
|
||||||
currentPriceIndex = 0.75,
|
currentPriceIndex = 0.75f,
|
||||||
economy = 100,
|
economy = 100,
|
||||||
agriculture = 100,
|
agriculture = 100,
|
||||||
infrastructure = 100,
|
infrastructure = 100,
|
||||||
economyDevastation = 0,
|
economyDevastation = 0,
|
||||||
agricultureDevastation = 0,
|
agricultureDevastation = 0,
|
||||||
infrastructureDevastation = 0
|
infrastructureDevastation = 0
|
||||||
) shouldBe 0.75 + 0.25 * 0.35 // 0.75 current, 1.1 destination
|
) shouldBe 0.75f + 0.25f * 0.35f // 0.75 current, 1.1 destination
|
||||||
}
|
}
|
||||||
|
|
||||||
"shiftedByGoldSpend" should "shift by 0.0001 per gold spent" in {
|
"shiftedByGoldSpend" should "shift by 0.0001 per gold spent" in {
|
||||||
PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(0.75, 5000) shouldBe Some(
|
PriceIndexUtils.maybeNewPriceIndexFromGoldSpend(0.75f, 5000) shouldBe Some(
|
||||||
1.25
|
1.25f
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "shift down if the spend is negative" in {
|
it should "shift down if the spend is negative" in {
|
||||||
PriceIndexUtils
|
PriceIndexUtils
|
||||||
.maybeNewPriceIndexFromGoldSpend(1.4, -5000)
|
.maybeNewPriceIndexFromGoldSpend(1.4f, -5000)
|
||||||
.get shouldBe (0.9 +- 0.0001)
|
.get shouldBe (0.9f +- 0.0001f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -34,8 +34,8 @@ class AlmsCommandSelectorTest
|
|||||||
|
|
||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
MinSupportForTaxes.setDoubleValue(40)
|
MinSupportForTaxes.setDoubleValue(40)
|
||||||
AlmsSupportIncreasePerFood.setDoubleValue(0.01)
|
AlmsSupportIncreasePerFood.setDoubleValue(0.01f)
|
||||||
AlmsPaladinSupportMultiplier.setDoubleValue(4.0)
|
AlmsPaladinSupportMultiplier.setDoubleValue(4.0f)
|
||||||
}
|
}
|
||||||
|
|
||||||
"chosenAlmsCommand" should "give 1000 food if we need 10 support in December" in {
|
"chosenAlmsCommand" should "give 1000 food if we need 10 support in December" in {
|
||||||
|
|||||||
+34
-34
@@ -103,7 +103,7 @@ class CommandChoiceHelpersTest
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalionTypes = BattalionTypesTestData.battalionTypes
|
battalionTypes = BattalionTypesTestData.battalionTypes
|
||||||
@@ -170,7 +170,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(10),
|
rulingFactionHeroIds = Vector(10),
|
||||||
battalionIds = Vector(85),
|
battalionIds = Vector(85),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
@@ -221,7 +221,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(10),
|
rulingFactionHeroIds = Vector(10),
|
||||||
battalionIds = Vector(85),
|
battalionIds = Vector(85),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
@@ -272,7 +272,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(10),
|
rulingFactionHeroIds = Vector(10),
|
||||||
battalionIds = Vector(85),
|
battalionIds = Vector(85),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
@@ -312,7 +312,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(3),
|
rulingFactionId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(10),
|
rulingFactionHeroIds = Vector(10),
|
||||||
battalionIds = Vector(85),
|
battalionIds = Vector(85),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
@@ -343,7 +343,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
gold = 3500,
|
gold = 3500,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -373,7 +373,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
gold = 3500,
|
gold = 3500,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -403,7 +403,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
gold = 3500,
|
gold = 3500,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -428,7 +428,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
gold = 3500,
|
gold = 3500,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -458,7 +458,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
gold = 10000,
|
gold = 10000,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -488,7 +488,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
food = 5000,
|
food = 5000,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -518,7 +518,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
food = 5000,
|
food = 5000,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -548,7 +548,7 @@ class CommandChoiceHelpersTest
|
|||||||
battalionIds = Vector(11, 12),
|
battalionIds = Vector(11, 12),
|
||||||
food = 5000,
|
food = 5000,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -579,7 +579,7 @@ class CommandChoiceHelpersTest
|
|||||||
gold = 1000,
|
gold = 1000,
|
||||||
food = 2000,
|
food = 2000,
|
||||||
support = 40,
|
support = 40,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -610,7 +610,7 @@ class CommandChoiceHelpersTest
|
|||||||
gold = 10000,
|
gold = 10000,
|
||||||
food = 20000,
|
food = 20000,
|
||||||
support = 30,
|
support = 30,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -645,13 +645,13 @@ class CommandChoiceHelpersTest
|
|||||||
Neighbor(provinceId = 6),
|
Neighbor(provinceId = 6),
|
||||||
Neighbor(provinceId = 7)
|
Neighbor(provinceId = 7)
|
||||||
),
|
),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 3,
|
id = 3,
|
||||||
rulingFactionId = Some(15),
|
rulingFactionId = Some(15),
|
||||||
heroCap = 5,
|
heroCap = 5,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 4,
|
id = 4,
|
||||||
@@ -659,7 +659,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionHeroIds = (31 to 34).toVector,
|
rulingFactionHeroIds = (31 to 34).toVector,
|
||||||
neighbors = Vector(Neighbor(provinceId = 5)),
|
neighbors = Vector(Neighbor(provinceId = 5)),
|
||||||
heroCap = 5,
|
heroCap = 5,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 6,
|
id = 6,
|
||||||
@@ -667,7 +667,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionHeroIds = (41 to 44).toVector,
|
rulingFactionHeroIds = (41 to 44).toVector,
|
||||||
neighbors = Vector(Neighbor(provinceId = 5)),
|
neighbors = Vector(Neighbor(provinceId = 5)),
|
||||||
heroCap = 5,
|
heroCap = 5,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 7,
|
id = 7,
|
||||||
@@ -675,7 +675,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionHeroIds = (51 to 54).toVector,
|
rulingFactionHeroIds = (51 to 54).toVector,
|
||||||
neighbors = Vector(Neighbor(provinceId = 5)),
|
neighbors = Vector(Neighbor(provinceId = 5)),
|
||||||
heroCap = 5,
|
heroCap = 5,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -827,17 +827,17 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(10, 11),
|
rulingFactionHeroIds = Vector(10, 11),
|
||||||
neighbors = Vector(Neighbor(provinceId = 4)),
|
neighbors = Vector(Neighbor(provinceId = 4)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 4,
|
id = 4,
|
||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(1),
|
rulingFactionHeroIds = Vector(1),
|
||||||
neighbors = Vector(Neighbor(provinceId = 3)),
|
neighbors = Vector(Neighbor(provinceId = 3)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(id = 1, priceIndex = 1.0),
|
Province(id = 1, priceIndex = 1.0f),
|
||||||
Province(id = 2, priceIndex = 1.0)
|
Province(id = 2, priceIndex = 1.0f)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
Hero(id = 10, vigor = 90, constitution = 90),
|
Hero(id = 10, vigor = 90, constitution = 90),
|
||||||
@@ -872,17 +872,17 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(10, 11),
|
rulingFactionHeroIds = Vector(10, 11),
|
||||||
neighbors = Vector(Neighbor(provinceId = 4)),
|
neighbors = Vector(Neighbor(provinceId = 4)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 4,
|
id = 4,
|
||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(1),
|
rulingFactionHeroIds = Vector(1),
|
||||||
neighbors = Vector(Neighbor(provinceId = 3)),
|
neighbors = Vector(Neighbor(provinceId = 3)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(id = 1, priceIndex = 1.0),
|
Province(id = 1, priceIndex = 1.0f),
|
||||||
Province(id = 2, priceIndex = 1.0)
|
Province(id = 2, priceIndex = 1.0f)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
Hero(id = 10, vigor = 90, constitution = 90),
|
Hero(id = 10, vigor = 90, constitution = 90),
|
||||||
@@ -934,17 +934,17 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(10, 11),
|
rulingFactionHeroIds = Vector(10, 11),
|
||||||
neighbors = Vector(Neighbor(provinceId = 4)),
|
neighbors = Vector(Neighbor(provinceId = 4)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 4,
|
id = 4,
|
||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(1),
|
rulingFactionHeroIds = Vector(1),
|
||||||
neighbors = Vector(Neighbor(provinceId = 3)),
|
neighbors = Vector(Neighbor(provinceId = 3)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(id = 1, priceIndex = 1.0),
|
Province(id = 1, priceIndex = 1.0f),
|
||||||
Province(id = 2, priceIndex = 1.0)
|
Province(id = 2, priceIndex = 1.0f)
|
||||||
),
|
),
|
||||||
heroes = mapifyHeroes(
|
heroes = mapifyHeroes(
|
||||||
Hero(id = 10, vigor = 90, constitution = 90),
|
Hero(id = 10, vigor = 90, constitution = 90),
|
||||||
@@ -990,7 +990,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(10, 11),
|
rulingFactionHeroIds = Vector(10, 11),
|
||||||
battalionIds = Vector(5, 6),
|
battalionIds = Vector(5, 6),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
@@ -1021,7 +1021,7 @@ class CommandChoiceHelpersTest
|
|||||||
rulingFactionId = Some(17),
|
rulingFactionId = Some(17),
|
||||||
rulingFactionHeroIds = Vector(10, 11),
|
rulingFactionHeroIds = Vector(10, 11),
|
||||||
battalionIds = Vector(5, 6),
|
battalionIds = Vector(5, 6),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
battalions = mapifyBattalions(
|
battalions = mapifyBattalions(
|
||||||
|
|||||||
+11
-11
@@ -129,13 +129,13 @@ class ExpandCommandSelectorTest
|
|||||||
Vector(Neighbor(provinceId = 10, startingPositionIndex = 1)),
|
Vector(Neighbor(provinceId = 10, startingPositionIndex = 1)),
|
||||||
rulingFactionId = Some(33),
|
rulingFactionId = Some(33),
|
||||||
rulingFactionHeroIds = Vector(1, 2, 3),
|
rulingFactionHeroIds = Vector(1, 2, 3),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 10,
|
id = 10,
|
||||||
neighbors =
|
neighbors =
|
||||||
Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
factions = mapifyFactions(
|
factions = mapifyFactions(
|
||||||
@@ -191,13 +191,13 @@ class ExpandCommandSelectorTest
|
|||||||
Vector(Neighbor(provinceId = 10, startingPositionIndex = 1)),
|
Vector(Neighbor(provinceId = 10, startingPositionIndex = 1)),
|
||||||
rulingFactionId = Some(33),
|
rulingFactionId = Some(33),
|
||||||
rulingFactionHeroIds = Vector(1, 2, 3),
|
rulingFactionHeroIds = Vector(1, 2, 3),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
),
|
),
|
||||||
Province(
|
Province(
|
||||||
id = 10,
|
id = 10,
|
||||||
neighbors =
|
neighbors =
|
||||||
Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
factions = mapifyFactions(
|
factions = mapifyFactions(
|
||||||
@@ -238,7 +238,7 @@ class ExpandCommandSelectorTest
|
|||||||
),
|
),
|
||||||
rulingFactionId = Some(33),
|
rulingFactionId = Some(33),
|
||||||
rulingFactionHeroIds = Vector(1, 2, 3),
|
rulingFactionHeroIds = Vector(1, 2, 3),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
heroCap = 10,
|
heroCap = 10,
|
||||||
gold = 2500,
|
gold = 2500,
|
||||||
food = 3500
|
food = 3500
|
||||||
@@ -247,21 +247,21 @@ class ExpandCommandSelectorTest
|
|||||||
private val unownedProvince1 = Province(
|
private val unownedProvince1 = Province(
|
||||||
id = 10,
|
id = 10,
|
||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
heroCap = 10
|
heroCap = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
private val unownedProvince2 = Province(
|
private val unownedProvince2 = Province(
|
||||||
id = 11,
|
id = 11,
|
||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
heroCap = 10
|
heroCap = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
private val unownedProvince3 = Province(
|
private val unownedProvince3 = Province(
|
||||||
id = 12,
|
id = 12,
|
||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
heroCap = 10
|
heroCap = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -270,14 +270,14 @@ class ExpandCommandSelectorTest
|
|||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
rulingFactionId = Some(33),
|
rulingFactionId = Some(33),
|
||||||
rulingFactionHeroIds = Vector(1, 2, 3),
|
rulingFactionHeroIds = Vector(1, 2, 3),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
heroCap = 10
|
heroCap = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
private val enRouteProvince = Province(
|
private val enRouteProvince = Province(
|
||||||
id = 14,
|
id = 14,
|
||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
incomingArmies = Vector(
|
incomingArmies = Vector(
|
||||||
MovingArmy(
|
MovingArmy(
|
||||||
army = Some(Army(factionId = 33))
|
army = Some(Army(factionId = 33))
|
||||||
@@ -289,7 +289,7 @@ class ExpandCommandSelectorTest
|
|||||||
private val hostileProvince = Province(
|
private val hostileProvince = Province(
|
||||||
id = 15,
|
id = 15,
|
||||||
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
neighbors = Vector(Neighbor(provinceId = 9, startingPositionIndex = 8)),
|
||||||
priceIndex = 1.0,
|
priceIndex = 1.0f,
|
||||||
rulingFactionId = Some(34),
|
rulingFactionId = Some(34),
|
||||||
heroCap = 10
|
heroCap = 10
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -31,8 +31,8 @@ class FoodConsumptionUtilsTest
|
|||||||
PrestigePerSupportedProvince.setDoubleValue(15)
|
PrestigePerSupportedProvince.setDoubleValue(15)
|
||||||
MinSupportForTaxes.setDoubleValue(40)
|
MinSupportForTaxes.setDoubleValue(40)
|
||||||
GoldPerHeroHeldBack.setDoubleValue(100)
|
GoldPerHeroHeldBack.setDoubleValue(100)
|
||||||
AlmsSupportIncreasePerFood.setDoubleValue(0.01)
|
AlmsSupportIncreasePerFood.setFloatValue(0.01f)
|
||||||
AlmsPaladinSupportMultiplier.setDoubleValue(4.0)
|
AlmsPaladinSupportMultiplier.setFloatValue(4.0f)
|
||||||
BaseFoodBuyPrice.setDoubleValue(0.25)
|
BaseFoodBuyPrice.setDoubleValue(0.25)
|
||||||
VassalMinimumFoodToSendSupplies.setIntValue(200)
|
VassalMinimumFoodToSendSupplies.setIntValue(200)
|
||||||
VassalMinimumGoldToSendSupplies.setIntValue(100)
|
VassalMinimumGoldToSendSupplies.setIntValue(100)
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ class AlmsToProvinceQuestCommandChooserTest
|
|||||||
|
|
||||||
override def beforeEach(): Unit = {
|
override def beforeEach(): Unit = {
|
||||||
MinSupportForTaxes.setDoubleValue(40)
|
MinSupportForTaxes.setDoubleValue(40)
|
||||||
AlmsSupportIncreasePerFood.setDoubleValue(0.001)
|
AlmsSupportIncreasePerFood.setFloatValue(0.001f)
|
||||||
}
|
}
|
||||||
|
|
||||||
"AlmsToProvinceQuestCommandChooser" should "return an alms command for an unaffiliated hero with that quest" in {
|
"AlmsToProvinceQuestCommandChooser" should "return an alms command for an unaffiliated hero with that quest" in {
|
||||||
|
|||||||
+3
-3
@@ -188,7 +188,7 @@ class QuestCreationUtilsTest
|
|||||||
forAll(
|
forAll(
|
||||||
QuestCreationUtils
|
QuestCreationUtils
|
||||||
.availableQuests(
|
.availableQuests(
|
||||||
province = province.withAgriculture(95.0),
|
province = province.withAgriculture(95.0f),
|
||||||
allProvinces = allProvinces,
|
allProvinces = allProvinces,
|
||||||
factions = factions,
|
factions = factions,
|
||||||
battalions = Vector(),
|
battalions = Vector(),
|
||||||
@@ -223,7 +223,7 @@ class QuestCreationUtilsTest
|
|||||||
forAll(
|
forAll(
|
||||||
QuestCreationUtils
|
QuestCreationUtils
|
||||||
.availableQuests(
|
.availableQuests(
|
||||||
province = province.withEconomy(95.0),
|
province = province.withEconomy(95.0f),
|
||||||
allProvinces = allProvinces,
|
allProvinces = allProvinces,
|
||||||
factions = factions,
|
factions = factions,
|
||||||
battalions = Vector(),
|
battalions = Vector(),
|
||||||
@@ -258,7 +258,7 @@ class QuestCreationUtilsTest
|
|||||||
forAll(
|
forAll(
|
||||||
QuestCreationUtils
|
QuestCreationUtils
|
||||||
.availableQuests(
|
.availableQuests(
|
||||||
province = province.withInfrastructure(95.0),
|
province = province.withInfrastructure(95.0f),
|
||||||
allProvinces = allProvinces,
|
allProvinces = allProvinces,
|
||||||
factions = factions,
|
factions = factions,
|
||||||
battalions = Vector(),
|
battalions = Vector(),
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"validate province" should "throw if the province id is 0" in {
|
"validate province" should "throw if the province id is 0" in {
|
||||||
val province = Province(id = 0, priceIndex = 1.0)
|
val province = Province(id = 0, priceIndex = 1.0f)
|
||||||
|
|
||||||
the[EagleInternalException] thrownBy {
|
the[EagleInternalException] thrownBy {
|
||||||
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
||||||
@@ -113,7 +113,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "throw if the price index is 0.0" in {
|
it should "throw if the price index is 0.0" in {
|
||||||
val province = Province(id = 17, priceIndex = 0.0, name = "Vovimaria")
|
val province = Province(id = 17, priceIndex = 0.0f, name = "Vovimaria")
|
||||||
|
|
||||||
the[EagleInternalException] thrownBy {
|
the[EagleInternalException] thrownBy {
|
||||||
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
||||||
@@ -121,7 +121,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "throw if the price index is negative" in {
|
it should "throw if the price index is negative" in {
|
||||||
val province = Province(id = 17, priceIndex = -0.4, name = "Fluria")
|
val province = Province(id = 17, priceIndex = -0.4f, name = "Fluria")
|
||||||
|
|
||||||
the[EagleInternalException] thrownBy {
|
the[EagleInternalException] thrownBy {
|
||||||
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
||||||
@@ -129,7 +129,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it should "not throw if the province id is valid and the priceIndex is valid" in {
|
it should "not throw if the province id is valid and the priceIndex is valid" in {
|
||||||
val province = Province(id = 17, priceIndex = 1.0)
|
val province = Province(id = 17, priceIndex = 1.0f)
|
||||||
|
|
||||||
noException should be thrownBy {
|
noException should be thrownBy {
|
||||||
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
RuntimeValidator.validate(province, RoundPhase.PLAYER_COMMANDS)
|
||||||
@@ -188,7 +188,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
rulingFactionId = Some(2),
|
rulingFactionId = Some(2),
|
||||||
rulingFactionHeroIds = Vector(3, 7),
|
rulingFactionHeroIds = Vector(3, 7),
|
||||||
provinceOrders = ProvinceOrderType.ENTRUST,
|
provinceOrders = ProvinceOrderType.ENTRUST,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
noException should be thrownBy {
|
noException should be thrownBy {
|
||||||
@@ -202,7 +202,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
rulingHeroId = Some(3),
|
rulingHeroId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(3, 7),
|
rulingFactionHeroIds = Vector(3, 7),
|
||||||
provinceOrders = ProvinceOrderType.ENTRUST,
|
provinceOrders = ProvinceOrderType.ENTRUST,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
the[EagleInternalException] thrownBy {
|
the[EagleInternalException] thrownBy {
|
||||||
@@ -215,7 +215,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
id = 18,
|
id = 18,
|
||||||
rulingHeroId = Some(3),
|
rulingHeroId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(3, 7),
|
rulingFactionHeroIds = Vector(3, 7),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
noException shouldBe thrownBy {
|
noException shouldBe thrownBy {
|
||||||
@@ -229,7 +229,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
rulingFactionId = Some(2),
|
rulingFactionId = Some(2),
|
||||||
rulingHeroId = Some(4),
|
rulingHeroId = Some(4),
|
||||||
rulingFactionHeroIds = Vector(3, 7),
|
rulingFactionHeroIds = Vector(3, 7),
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
the[EagleInternalException] thrownBy {
|
the[EagleInternalException] thrownBy {
|
||||||
@@ -252,7 +252,7 @@ class RuntimeValidatorTest extends AnyFlatSpec with Matchers {
|
|||||||
rulingHeroId = Some(3),
|
rulingHeroId = Some(3),
|
||||||
rulingFactionHeroIds = Vector(3, 7),
|
rulingFactionHeroIds = Vector(3, 7),
|
||||||
provinceOrders = ENTRUST,
|
provinceOrders = ENTRUST,
|
||||||
priceIndex = 1.0
|
priceIndex = 1.0f
|
||||||
)
|
)
|
||||||
|
|
||||||
noException should be thrownBy {
|
noException should be thrownBy {
|
||||||
|
|||||||
+5
-31
@@ -65,22 +65,9 @@ class ProvinceViewFilterTest
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
it should "round up a devastation of 0.1" in {
|
|
||||||
val province =
|
|
||||||
Province(id = 5, rulingFactionId = Some(3), economyDevastation = 0.1)
|
|
||||||
|
|
||||||
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
|
||||||
province = province,
|
|
||||||
gs = GameState(provinces = Map(5 -> province)),
|
|
||||||
factionId = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
provinceView.getFullInfo.economyDevastation shouldBe 1
|
|
||||||
}
|
|
||||||
|
|
||||||
it should "keep a devastation of 0 at 0" in {
|
it should "keep a devastation of 0 at 0" in {
|
||||||
val province =
|
val province =
|
||||||
Province(id = 5, rulingFactionId = Some(3), economyDevastation = 0.0)
|
Province(id = 5, rulingFactionId = Some(3), economyDevastation = 0.0f)
|
||||||
|
|
||||||
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
||||||
province = province,
|
province = province,
|
||||||
@@ -88,12 +75,12 @@ class ProvinceViewFilterTest
|
|||||||
factionId = 3
|
factionId = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
provinceView.getFullInfo.economyDevastation shouldBe 0
|
provinceView.getFullInfo.economyDevastation shouldBe 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "put a devastation of 2.1 at 3" in {
|
it should "put a devastation of 2.1 at 2.1" in {
|
||||||
val province =
|
val province =
|
||||||
Province(id = 5, rulingFactionId = Some(3), economyDevastation = 2.1)
|
Province(id = 5, rulingFactionId = Some(3), economyDevastation = 2.1f)
|
||||||
|
|
||||||
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
||||||
province = province,
|
province = province,
|
||||||
@@ -101,20 +88,7 @@ class ProvinceViewFilterTest
|
|||||||
factionId = 3
|
factionId = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
provinceView.getFullInfo.economyDevastation shouldBe 3
|
provinceView.getFullInfo.economyDevastation shouldBe 2.1f
|
||||||
}
|
|
||||||
|
|
||||||
it should "put an economy of 0.1 at 1" in {
|
|
||||||
val province =
|
|
||||||
Province(id = 5, rulingFactionId = Some(3), economy = 0.1)
|
|
||||||
|
|
||||||
val provinceView = ProvinceViewFilter.filteredProvinceView(
|
|
||||||
province = province,
|
|
||||||
gs = GameState(provinces = Map(5 -> province)),
|
|
||||||
factionId = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
provinceView.getFullInfo.economy shouldBe 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it should "show ruler is traveling if they are" in {
|
it should "show ruler is traveling if they are" in {
|
||||||
|
|||||||
Reference in New Issue
Block a user