Ticket #3522: 3522.3.3.diff

File 3522.3.3.diff, 5.9 KB (added by fatherbushido, 4 years ago)

merging things as suggested by elexis

  • binaries/data/mods/public/simulation/components/Player.js

    Player.prototype.SetMaxPopulation = func 
    142142    this.maxPop = max;
    143143};
    144144
    145145Player.prototype.GetMaxPopulation = function()
    146146{
    147     return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity));
     147    return Math.round(ApplyValueModificationsToPlayer("Player/MaxPopulation", this.maxPop, this.entity, this.playerID));
    148148};
    149149
    150150Player.prototype.SetGatherRateMultiplier = function(value)
    151151{
    152152    this.gatherRateMultiplier = value;
  • binaries/data/mods/public/simulation/helpers/ValueModification.js

     
    1 // Little helper functions to make applying technology more convenient
     1// Little helper functions to make applying technology and auras more convenient
    22
    33function ApplyValueModificationsToEntity(tech_type, current_value, entity)
    44{
    55    let value = current_value;
    66    let cmpTechnologyManager = QueryOwnerInterface(entity, IID_TechnologyManager);
    function ApplyValueModificationsToEntity 
    1111    if (!cmpAuraManager)
    1212        return value;
    1313    return cmpAuraManager.ApplyModifications(tech_type, value, entity);
    1414}
    1515
    16 function ApplyValueModificationsToPlayer(tech_type, current_value, player_entity)
     16function ApplyValueModificationsToPlayer(tech_type, current_value, playerEntity, playerID)
    1717{
    18     let cmpTechnologyManager = Engine.QueryInterface(player_entity, IID_TechnologyManager);
    19 
    20     if (!cmpTechnologyManager)
    21         return current_value;
    22 
    23     return cmpTechnologyManager.ApplyModifications(tech_type, current_value, player_entity);
     18    let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
     19    let entityTemplateName = cmpTemplateManager.GetCurrentTemplateName(playerEntity);
     20    let entityTemplate = cmpTemplateManager.GetTemplate(entityTemplateName);
     21    return ApplyValueModificationsToTemplate(tech_type, current_value, playerID, entityTemplate)
    2422}
    2523
    2624function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template)
    2725{
    2826    let value = current_value;
  • binaries/data/mods/public/simulation/templates/special/player.xml

     
    4646      <CivilCentre>
    4747        <RequiredTechs datatype="tokens">phase_town</RequiredTechs>
    4848      </CivilCentre>
    4949    </LimitRemovers>
    5050  </EntityLimits>
     51  <Identity>
     52    <Civ></Civ>
     53    <GenericName>Player</GenericName>
     54    <Classes datatype="tokens">Player</Classes>
     55  </Identity>
    5156  <Player>
    52     <SharedLosTech>unlock_shared_los</SharedLosTech>
     57    <SharedLosTech>unlock_shared_los</SharedLosTech>
    5358  </Player>
    5459  <StatisticsTracker/>
    5560  <TechnologyManager/>
    5661</Entity>
  • binaries/data/mods/public/simulation/templates/template_structure_wonder.xml

     
    88      <Hack>2</Hack>
    99      <Pierce>10</Pierce>
    1010      <Crush>2</Crush>
    1111    </Foundation>
    1212  </Armour>
     13  <Auras>
     14    <Aura1>
     15      <Type>global</Type>
     16      <Affects>Player</Affects>
     17      <Modifications>
     18        <Player.MaxPopulation> <Add>50</Add> </Player.MaxPopulation>
     19      </Modifications>
     20      <AuraName>Glorious Expansion</AuraName>
     21      <AuraDescription>+50 maximum population cap.</AuraDescription>
     22    </Aura1>
     23  </Auras>
    1324  <BuildRestrictions>
    1425    <Category>Wonder</Category>
    1526  </BuildRestrictions>
    1627  <Capturable>
    17     <CapturePoints>1500</CapturePoints>
     28    <CapturePoints>2000</CapturePoints>
    1829    <RegenRate>5.0</RegenRate>
    1930  </Capturable>
    2031  <Cost>
    2132    <BuildTime>1000</BuildTime>
    2233    <Resources>
    23       <food>0</food>
    24       <wood>1000</wood>
    25       <stone>1000</stone>
    26       <metal>1000</metal>
     34      <food>3000</food>
     35      <wood>4000</wood>
     36      <stone>1500</stone>
     37      <metal>1500</metal>
    2738    </Resources>
    2839  </Cost>
    2940  <Footprint>
    3041    <Square width="34.0" depth="34.0"/>
    3142    <Height>10.0</Height>
    3243  </Footprint>
    33   <GarrisonHolder disable=""/>
     44  <GarrisonHolder>
     45    <Max>20</Max>
     46    <EjectHealth>0.1</EjectHealth>
     47    <EjectClassesOnDestroy datatype="tokens">Unit</EjectClassesOnDestroy>
     48    <List datatype="tokens">Support Infantry Cavalry</List>
     49    <BuffHeal>1</BuffHeal>
     50    <LoadingRange>1</LoadingRange>
     51  </GarrisonHolder>
    3452  <Health>
    3553    <Max>5000</Max>
    3654    <SpawnEntityOnDeath>rubble/rubble_stone_6x6</SpawnEntityOnDeath>
    3755  </Health>
    3856  <Identity>
    3957    <GenericName>Wonder</GenericName>
    4058    <Tooltip>Bring glory to your civilization and add large tracts of land to your empire.</Tooltip>
    4159    <Classes datatype="tokens">
    4260      City
    4361      Wonder
    44     </Classes>
     62    </Classes>
    4563    <Icon>structures/wonder.png</Icon>
    4664    <RequiredTechnology>phase_city</RequiredTechnology>
    4765  </Identity>
    4866  <Loot>
    4967    <xp>200</xp>
     
    5371    <metal>100</metal>
    5472  </Loot>
    5573  <Obstruction>
    5674    <Static width="30.0" depth="30.0"/>
    5775  </Obstruction>
    58   <ProductionQueue>
    59     <BatchTimeModifier>0.7</BatchTimeModifier>
    60     <Technologies datatype="tokens">
    61       pop_wonder
    62     </Technologies>
    63   </ProductionQueue>
    6476  <RallyPoint disable=""/>
    6577  <Sound>
    6678    <SoundGroups>
    6779      <select>interface/select/building/sel_wonder.xml</select>
    6880      <constructed>interface/complete/building/complete_wonder.xml</constructed>