Ticket #3769: aurapatch.2.diff

File aurapatch.2.diff, 3.1 KB (added by fatherbushido, 8 years ago)
  • binaries/data/mods/public/simulation/components/AuraManager.js

     
    170170    if (!template || !template.Identity)
    171171        return value;
    172172    var classes = GetIdentityClasses(template.Identity);
    173 
    174173    var usedKeys = new Set();
    175174    var add = 0;
    176175    var multiply = 1;
    177     for (let c in cache)
     176    for (let [classeName,dataMap] of cache)
    178177    {
    179         if (!MatchesClassList(classes, c))
     178        if (!MatchesClassList(classes, classeName))
    180179            continue;
    181180
    182         for (let key in cache.get(c))
     181        for (let key of dataMap.keys())
    183182        {
    184183            // don't add an aura with the same key twice
    185184            if (usedKeys.has(key))
    186185                continue;
    187 
    188             add += cache.get(c).get(key).add;
    189             multiply *= cache.get(c).get(key).multiply;
     186            add += dataMap.get(key).add;
     187            multiply *= dataMap.get(key).multiply;
    190188            usedKeys.add(key);
    191189        }
    192190    }
  • binaries/data/mods/public/simulation/components/Foundation.js

     
    2828
    2929    // Remember our cost here, so if it changes after construction begins (from technologies)
    3030    //  we will use the correct values to refund partial construction costs
    31     var cmpCost = Engine.QueryInterface(this.entity, IID_Cost);
    32     this.costs = cmpCost.GetResourceCosts();
     31    var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
     32    var templateFull = cmpTemplateManager.GetTemplate(template);
     33    this.costs = {};
     34    for (var r in templateFull.Cost.Resources)
     35    {
     36        this.costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +templateFull.Cost.Resources[r], owner, templateFull);
     37    }
    3338    this.maxProgress = 0;
    3439
    3540    this.initialised = true;
  • binaries/data/mods/public/simulation/helpers/Commands.js

     
    969969        Engine.DestroyEntity(ent);
    970970    }
    971971   
    972     // We need the cost after tech modifications
     972    // We need the cost after tech and aura modifications
    973973    // To calculate this with an entity requires ownership, so use the template instead
    974974    var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
    975     var template = cmpTemplateManager.GetTemplate(foundationTemplate);
    976975    var costs = {};
    977976    for (var r in template.Cost.Resources)
    978977    {
    979         costs[r] = +template.Cost.Resources[r];
    980         if (cmpTechnologyManager)
    981             costs[r] = cmpTechnologyManager.ApplyModificationsTemplate("Cost/Resources/"+r, costs[r], template);
     978        costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +template.Cost.Resources[r], player, template);
    982979    }
    983980   
    984981    if (!cmpPlayer.TrySubtractResources(costs))