Index: binaries/data/mods/public/simulation/components/AuraManager.js
===================================================================
--- binaries/data/mods/public/simulation/components/AuraManager.js	(révision 17749)
+++ binaries/data/mods/public/simulation/components/AuraManager.js	(copie de travail)
@@ -170,29 +170,25 @@
 	if (!template || !template.Identity)
 		return value;
 	var classes = GetIdentityClasses(template.Identity);
-
 	var usedKeys = new Set();
 	var add = 0;
 	var multiply = 1;
-	for (let c in cache)
+	for (let [className, mods] of cache)
 	{
-		if (!MatchesClassList(classes, c))
+		if (!MatchesClassList(classes, className))
 			continue;
-
-		for (let key in cache.get(c))
+		
+		for (let [key, mod] of mods)
 		{
 			// don't add an aura with the same key twice
 			if (usedKeys.has(key))
 				continue;
-
-			add += cache.get(c).get(key).add;
-			multiply *= cache.get(c).get(key).multiply;
+			add += mod.add;
+			multiply *= mod.multiply;
 			usedKeys.add(key);
 		}
 	}
-	value *= multiply;
-	value += add;
-	return value;
+	return value*multiply + add;
 };
 
 Engine.RegisterSystemComponentType(IID_AuraManager, "AuraManager", AuraManager);
Index: binaries/data/mods/public/simulation/components/Cost.js
===================================================================
--- binaries/data/mods/public/simulation/components/Cost.js	(révision 17749)
+++ binaries/data/mods/public/simulation/components/Cost.js	(copie de travail)
@@ -65,6 +65,25 @@
 	return costs;
 };
 
+Cost.prototype.GetResourceCostsFromTemplate = function(owner)
+{
+	if (owner == undefined)
+	{
+		let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
+     		owner=cmpOwnership.GetOwner(); 
+	}
+	let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
+	let entityTemplateName = cmpTemplateManager.GetCurrentTemplateName(this.entity);
+	let entityTemplate = cmpTemplateManager.GetTemplate(entityTemplateName);
+	let costs = {};
+	for (let r in this.template.Resources)
+	{
+		costs[r] = +this.template.Resources[r];
+		costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, costs[r], owner, entityTemplate);
+	};
+	return costs;
+};
+
 Cost.prototype.OnOwnershipChanged = function(msg)
 {
 	if (msg.from != -1)
Index: binaries/data/mods/public/simulation/components/Foundation.js
===================================================================
--- binaries/data/mods/public/simulation/components/Foundation.js	(révision 17749)
+++ binaries/data/mods/public/simulation/components/Foundation.js	(copie de travail)
@@ -26,12 +26,12 @@
 	// decoupled from its owner, so we need to remember it in here (and assume it won't change)
 	this.owner = owner;
 
-	// Remember our cost here, so if it changes after construction begins (from technologies)
-	//	we will use the correct values to refund partial construction costs
-	var cmpCost = Engine.QueryInterface(this.entity, IID_Cost);
-	this.costs = cmpCost.GetResourceCosts();
+	// Remember our cost here, so if it changes after construction begins (from aura or technologies)
+	// we will use the correct values to refund partial construction costs
+	let cmpCost = Engine.QueryInterface(this.entity, IID_Cost);
+	this.costs = cmpCost.GetResourceCostsFromTemplate(owner);
+
 	this.maxProgress = 0;
-
 	this.initialised = true;
 };
 

Index: binaries/data/mods/public/simulation/helpers/Commands.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/Commands.js	(révision 17749)
+++ binaries/data/mods/public/simulation/helpers/Commands.js	(copie de travail)
@@ -968,18 +968,11 @@
 		cmpPosition.MoveOutOfWorld();
 		Engine.DestroyEntity(ent); 
 	}
-	
-	// We need the cost after tech modifications
+
+	// We need the cost after tech and aura modifications
 	// To calculate this with an entity requires ownership, so use the template instead
-	var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
-	var template = cmpTemplateManager.GetTemplate(foundationTemplate);
-	var costs = {};
-	for (var r in template.Cost.Resources)
-	{
-		costs[r] = +template.Cost.Resources[r];
-		if (cmpTechnologyManager)
-			costs[r] = cmpTechnologyManager.ApplyModificationsTemplate("Cost/Resources/"+r, costs[r], template);
-	}
+	let cmpCost = Engine.QueryInterface(ent, IID_Cost);
+	let costs = cmpCost.GetResourceCostsFromTemplate(player);	
 	
 	if (!cmpPlayer.TrySubtractResources(costs))
 	{
