Ticket #3930: 3930.diff

File 3930.diff, 9.6 KB (added by fatherbushido, 8 years ago)

wip

  • binaries/data/mods/public/gui/session/selection_panels.js

    g_SelectionPanels.Research = {  
    796796        Engine.GetGUIObjectByName("unitResearchPair["+i+"]").hidden = true;
    797797    },
    798798    "addData": function(data)
    799799    {
    800800        data.entType = data.item.pair ? [data.item.top, data.item.bottom] : [data.item];
    801         data.template = data.entType.map(GetTechnologyData);
     801//      data.template = data.entType.map(GetTechnologyData);
     802        data.template = data.entType.map(t => Engine.GuiInterfaceCall("GetTechnologyData", {
     803            "name": t,
     804            "ent": data.unitEntState.id
     805        }));
     806
    802807        // abort if no template found for any of the techs
    803808        if (data.template.some(v => !v))
    804809            return false;
     810
    805811        // index one row below
    806812        var shiftedIndex = data.i + data.rowLength;
    807813        data.positions = data.item.pair ? [data.i, shiftedIndex] : [shiftedIndex];
    808814        data.positionsToHide = data.item.pair ? [] : [data.i];
    809815
  • binaries/data/mods/public/gui/session/session.js

    function GetTemplateDataWithoutLocalizat  
    192192
    193193function GetTechnologyData(technologyName)
    194194{
    195195    if (!(technologyName in g_TechnologyData))
    196196    {
    197         let template = Engine.GuiInterfaceCall("GetTechnologyData", technologyName);
     197        let template = Engine.GuiInterfaceCall("GetTechnologyData", {name: technologyName, ent: null});
    198198        translateObjectKeys(template, ["specific", "generic", "description", "tooltip", "requirementsTooltip"]);
    199199        g_TechnologyData[technologyName] = template;
    200200    }
    201201
    202202    return g_TechnologyData[technologyName];
  • binaries/data/mods/public/simulation/components/GuiInterface.js

    GuiInterface.prototype.GetTemplateData =  
    606606        aurasTemplate[name].auraDescription = auraTemplate.auraDescription || null;
    607607    }
    608608    return GetTemplateDataHelper(template, player, aurasTemplate);
    609609};
    610610
    611 GuiInterface.prototype.GetTechnologyData = function(player, name)
     611GuiInterface.prototype.GetTechnologyData = function(player, data)
    612612{
    613613    let cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
    614     let template = cmpDataTemplateManager.GetTechnologyTemplate(name);
     614    let template = cmpDataTemplateManager.GetTechnologyTemplate(data.name);
    615615
    616616    if (!template)
    617617    {
    618         warn("Tried to get data for invalid technology: " + name);
     618        warn("Tried to get data for invalid technology: " + data.name);
    619619        return null;
    620620    }
    621621
    622622    let cmpPlayer = QueryPlayerIDInterface(player, IID_Player);
    623     return GetTechnologyDataHelper(template, cmpPlayer.GetCiv());
     623    let techData = GetTechnologyDataHelper(template, cmpPlayer.GetCiv());
     624    if (!data.ent)
     625        return techData;
     626    for (let r of ["food", "wood", "stone", "metal"])
     627        techData.cost[r] = ApplyValueModificationsToEntity("Technology/Resources/"+r, +techData.cost[r], data.ent);
     628    techData.cost.time = ApplyValueModificationsToEntity("Technology/ResearchTime", +techData.cost.time, data.ent);
     629    return techData;
    624630};
    625631
    626632GuiInterface.prototype.IsTechnologyResearched = function(player, data)
    627633{
    628634    if (!data.tech)
  • binaries/data/mods/public/simulation/components/ProductionQueue.js

    ProductionQueue.prototype.AddBatch = fun  
    319319            var cmpDataTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_DataTemplateManager);
    320320            var template = cmpDataTemplateManager.GetTechnologyTemplate(templateName);
    321321            if (!template)
    322322                return;
    323323            var cmpPlayer = QueryOwnerInterface(this.entity);
    324             var time = template.researchTime * cmpPlayer.GetCheatTimeMultiplier();
     324            var time = ApplyValueModificationsToEntity("Technology/ResearchTime", +template.researchTime, this.entity) * cmpPlayer.GetCheatTimeMultiplier();
    325325
    326326            var cost = {};
    327             for each (var r in ["food", "wood", "stone", "metal"])
    328                 cost[r] = Math.floor(template.cost[r]);
     327            for (let r of ["food", "wood", "stone", "metal"])
     328                cost[r] = Math.floor(ApplyValueModificationsToEntity("Technology/Resources/"+r, +template.cost[r], this.entity));
    329329           
    330330            // TrySubtractResources should report error to player (they ran out of resources)
    331331            if (!cmpPlayer.TrySubtractResources(cost))
    332332                return;
    333333           
  • binaries/data/mods/public/simulation/data/auras/maur_hero_ashoka.json

     
     1{
     2    "type": "global",
     3    "affectedPlayers": ["MutualAlly"],
     4    "affects": ["Temple"],
     5    "modifications": [
     6    { "value": "Technology/Resources/wood", "multiply": 0.5 },
     7    { "value": "Technology/Resources/food", "multiply": 0.5 },
     8    { "value": "Technology/Resources/metal", "multiply": 0.5 },
     9    { "value": "Technology/Resources/stone", "multiply": 0.5 },
     10    { "value": "Technology/ResearchTime", "multiply": 0.5 }
     11    ],
     12    "auraDescription": "All allied Temple technologies -50% cost and research time.",
     13    "auraName": "Evangelism Aura",
     14    "overlayIcon": "art/textures/ui/session/auras/build_bonus.png"
     15}
  • binaries/data/mods/public/simulation/data/auras/maur_hero_chanakya.json

     
     1{
     2    "type": "garrison",
     3    "affects": ["Structure"],
     4    "modifications": [
     5    { "value": "Technology/ResearchTime", "multiply": 0.5 }
     6    ],
     7    "auraDescription": "Empower a building with -50% research time.",
     8    "auraName": "Teacher Aura",
     9    "overlayIcon": "art/textures/ui/session/auras/build_bonus.png"
     10}
  • binaries/data/mods/public/simulation/templates/template_structure_military_blacksmith.xml

     
    1515  </Footprint>
    1616  <GarrisonHolder>
    1717    <Max>1</Max>
    1818    <EjectHealth>0.1</EjectHealth>
    1919    <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
    20     <List datatype="tokens">Infantry</List>
     20    <List datatype="tokens">Infantry Healer</List>
    2121    <BuffHeal>0</BuffHeal>
    2222    <LoadingRange>2</LoadingRange>
    2323  </GarrisonHolder>
    2424  <Health>
    2525    <Max>2000</Max>
  • binaries/data/mods/public/simulation/templates/units/maur_hero_ashoka.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_unit_hero_cavalry_archer">
     3  <Auras datatype="tokens">maur_hero_ashoka</Auras>
    34  <Footprint replace="">
    45    <Square width="6.0" depth="12.0"/>
    56    <Height>5.0</Height>
    67  </Footprint>
    78  <Identity>
  • binaries/data/mods/public/simulation/templates/units/maur_hero_chanakya.xml

     
    33  <Armour>
    44    <Hack>4.0</Hack>
    55    <Pierce>8.0</Pierce>
    66    <Crush>4.0</Crush>
    77  </Armour>
    8   <Heal>
    9     <Range>20</Range>
    10     <HP>12</HP>
    11     <Rate>2000</Rate>
    12     <UnhealableClasses datatype="tokens"/>
    13     <HealableClasses datatype="tokens">Human</HealableClasses>
    14   </Heal>
     8  <Auras datatype="tokens">maur_hero_chanakya</Auras>
    159  <Cost>
    1610    <Population>2</Population>
    1711    <BuildTime>60</BuildTime>
    1812    <Resources>
    1913      <food>100</food>
    2014      <metal>250</metal>
    2115    </Resources>
    2216  </Cost>
     17  <Heal>
     18    <Range>20</Range>
     19    <HP>12</HP>
     20    <Rate>2000</Rate>
     21    <UnhealableClasses datatype="tokens"/>
     22    <HealableClasses datatype="tokens">Human</HealableClasses>
     23  </Heal>
    2324  <Health>
    2425    <Max>600</Max>
    2526  </Health>
    2627  <Identity>
    2728    <Civ>maur</Civ>
    28     <Classes datatype="tokens">Human Organic</Classes>
     29    <Classes datatype="tokens">Human Organic Support</Classes>
    2930    <VisibleClasses datatype="tokens">Hero Healer</VisibleClasses>
    3031    <GenericName>Acharya Chanakya</GenericName>
    3132    <SpecificName>Acharya Chāṇakya</SpecificName>
    3233    <Icon>units/maur_hero_chanakya.png</Icon>
    3334    <Tooltip>Hero Special: "Healer" - Heal units at an accelerated rate.
    34 Hero Special: "Teacher" - Empower a building to research and train +50% faster.
    3535Hero Special: "Philosopher" - Research 4 special technologies only available to Chanakya.</Tooltip>
    3636    <RequiredTechnology>phase_city</RequiredTechnology>
    3737  </Identity>
    3838  <Minimap>
    3939    <Type>hero</Type>