Index: binaries/data/mods/public/globalscripts/Templates.js
===================================================================
--- binaries/data/mods/public/globalscripts/Templates.js
+++ binaries/data/mods/public/globalscripts/Templates.js
@@ -232,7 +232,7 @@
{
ret.cost = {};
for (let resCode in template.Cost.Resources)
- ret.cost[resCode] = getEntityValue("Cost/Resources/" + resCode);
+ ret.cost[resCode] = getEntityValue("Cost/Resources/" + resCode).toFixed(2);
if (template.Cost.Population)
ret.cost.population = getEntityValue("Cost/Population");
Index: binaries/data/mods/public/gui/common/tooltips.js
===================================================================
--- binaries/data/mods/public/gui/common/tooltips.js
+++ binaries/data/mods/public/gui/common/tooltips.js
@@ -345,7 +345,7 @@
{
let totalCosts = {};
for (let r in template.cost)
- totalCosts[r] = Math.floor(template.cost[r] * trainNum);
+ totalCosts[r] = Number(template.cost[r] * trainNum);
return totalCosts;
}
Index: binaries/data/mods/public/simulation/ai/common-api/entity.js
===================================================================
--- binaries/data/mods/public/simulation/ai/common-api/entity.js
+++ binaries/data/mods/public/simulation/ai/common-api/entity.js
@@ -109,7 +109,7 @@
let ret = {};
for (let type in this.get("Cost/Resources"))
- ret[type] = +this.get("Cost/Resources/" + type);
+ ret[type] = Math.round(+this.get("Cost/Resources/" + type));
return ret;
},
Index: binaries/data/mods/public/simulation/components/Builder.js
===================================================================
--- binaries/data/mods/public/simulation/components/Builder.js
+++ binaries/data/mods/public/simulation/components/Builder.js
@@ -61,7 +61,7 @@
*/
Builder.prototype.PerformBuilding = function(target)
{
- let rate = ApplyValueModificationsToEntity("Builder/Rate", +this.template.Rate, this.entity);
+ let rate = Math.floor(ApplyValueModificationsToEntity("Builder/Rate", +this.template.Rate, this.entity));
let cmpFoundation = Engine.QueryInterface(target, IID_Foundation);
if (cmpFoundation)
Index: binaries/data/mods/public/simulation/components/Cost.js
===================================================================
--- binaries/data/mods/public/simulation/components/Cost.js
+++ binaries/data/mods/public/simulation/components/Cost.js
@@ -23,7 +23,7 @@
"" +
"" +
"" +
- Resources.BuildSchema("nonNegativeDecimal") +
+ Resources.BuildSchema("nonNegativeInteger") +
"";
Cost.prototype.Init = function()
@@ -46,7 +46,7 @@
{
var cmpPlayer = QueryOwnerInterface(this.entity);
var buildTime = (+this.template.BuildTime) * cmpPlayer.cheatTimeMultiplier;
- return ApplyValueModificationsToEntity("Cost/BuildTime", buildTime, this.entity);
+ return Math.floor(ApplyValueModificationsToEntity("Cost/BuildTime", buildTime, this.entity));
};
Cost.prototype.GetResourceCosts = function(owner)
@@ -66,7 +66,7 @@
let costs = {};
for (let res in this.template.Resources)
- costs[res] = ApplyValueModificationsToTemplate("Cost/Resources/"+res, +this.template.Resources[res], owner, entityTemplate);
+ costs[res] = Math.floor(ApplyValueModificationsToTemplate("Cost/Resources/"+res, +this.template.Resources[res], owner, entityTemplate));
return costs;
};
Index: binaries/data/mods/public/simulation/components/Health.js
===================================================================
--- binaries/data/mods/public/simulation/components/Health.js
+++ binaries/data/mods/public/simulation/components/Health.js
@@ -96,7 +96,7 @@
cmpFogging.Activate();
var old = this.hitpoints;
- this.hitpoints = Math.max(1, Math.min(this.GetMaxHitpoints(), value));
+ this.hitpoints = Math.floor(Math.max(1, Math.min(this.GetMaxHitpoints(), value)));
var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
if (cmpRangeManager)
@@ -392,7 +392,7 @@
return;
let oldMaxHitpoints = this.GetMaxHitpoints();
- let newMaxHitpoints = ApplyValueModificationsToEntity("Health/Max", +this.template.Max, this.entity);
+ let newMaxHitpoints = Math.floor(ApplyValueModificationsToEntity("Health/Max", +this.template.Max, this.entity));
if (oldMaxHitpoints != newMaxHitpoints)
{
let newHitpoints = this.GetHitpoints() * newMaxHitpoints/oldMaxHitpoints;
Index: binaries/data/mods/public/simulation/components/Promotion.js
===================================================================
--- binaries/data/mods/public/simulation/components/Promotion.js
+++ binaries/data/mods/public/simulation/components/Promotion.js
@@ -59,7 +59,7 @@
// change promoted unit health to the same percent of hitpoints as unit had before promotion
var cmpPromotedUnitHealth = Engine.QueryInterface(promotedUnitEntity, IID_Health);
var healthFraction = Math.max(0, Math.min(1, cmpCurrentUnitHealth.GetHitpoints() / cmpCurrentUnitHealth.GetMaxHitpoints()));
- var promotedUnitHitpoints = Math.round(cmpPromotedUnitHealth.GetMaxHitpoints() * healthFraction);
+ var promotedUnitHitpoints = cmpPromotedUnitHealth.GetMaxHitpoints() * healthFraction;
cmpPromotedUnitHealth.SetHitpoints(promotedUnitHitpoints);
var cmpPromotedUnitPromotion = Engine.QueryInterface(promotedUnitEntity, IID_Promotion);