Ticket #3930: 3930.4.diff

File 3930.4.diff, 8.2 KB (added by fatherbushido, 8 years ago)
  • binaries/data/mods/public/gui/session/selection_panels.js

    g_SelectionPanels.Research = {  
    800800        data.entType = data.item.pair ? [data.item.top, data.item.bottom] : [data.item];
    801801        data.template = data.entType.map(GetTechnologyData);
    802802        // abort if no template found for any of the techs
    803803        if (data.template.some(v => !v))
    804804            return false;
     805        data.template = data.template.map(t => Engine.GuiInterfaceCall("GetModifiedTechnologyCosts", {
     806            "template": t,
     807            "ent": data.unitEntState.id
     808        }));
    805809        // index one row below
    806810        var shiftedIndex = data.i + data.rowLength;
    807811        data.positions = data.item.pair ? [data.i, shiftedIndex] : [shiftedIndex];
    808812        data.positionsToHide = data.item.pair ? [] : [data.i];
    809813
  • binaries/data/mods/public/simulation/components/GuiInterface.js

    GuiInterface.prototype.GetTechnologyData  
    621621
    622622    let cmpPlayer = QueryPlayerIDInterface(player, IID_Player);
    623623    return GetTechnologyDataHelper(template, cmpPlayer.GetCiv());
    624624};
    625625
     626GuiInterface.prototype.GetModifiedTechnologyCosts = function(player, data)
     627{
     628    for (let c in data.template.cost)
     629        data.template.cost[c] = ApplyValueModificationsToEntity("Technology/Cost/"+c, +data.template.cost[c], data.ent);
     630    return data.template;
     631};
     632
    626633GuiInterface.prototype.IsTechnologyResearched = function(player, data)
    627634{
    628635    if (!data.tech)
    629636        return true;
    630637
    let exposedFunctions = {  
    19291936    "GetEntityState": 1,
    19301937    "GetExtendedEntityState": 1,
    19311938    "GetAverageRangeForBuildings": 1,
    19321939    "GetTemplateData": 1,
    19331940    "GetTechnologyData": 1,
     1941    "GetModifiedTechnologyCosts": 1,
    19341942    "IsTechnologyResearched": 1,
    19351943    "CheckTechnologyRequirements": 1,
    19361944    "GetStartedResearch": 1,
    19371945    "GetBattleState": 1,
    19381946    "GetIncomingAttacks": 1,
  • 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/Cost/time", +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 res in template.cost)
     328                cost[res] = Math.floor(ApplyValueModificationsToEntity("Technology/Cost/"+res, +template.cost[res], 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/Cost/wood", "multiply": 0.5 },
     7        { "value": "Technology/Cost/food", "multiply": 0.5 },
     8        { "value": "Technology/Cost/metal", "multiply": 0.5 },
     9        { "value": "Technology/Cost/stone", "multiply": 0.5 },
     10        { "value": "Technology/Cost/time", "multiply": 0.5 }
     11    ],
     12    "auraDescription": "All allied Temple technologies -50% cost and -50% 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/Cost/time", "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>