Changeset 25047

Timestamp:
Mar 14, 2021, 1:43:19 PM (3 years ago)
Author:
Silier
Message:

Let Petra to build apartments

Teach her to build advanced houses available for cart players as they provide more population.

Reviewed by: @Freagarach
Differential revision: D3654

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/simulation/ai/petra/headquarters.js

    r25043 r25047  
    16861686PETRA.HQ.prototype.buildMoreHouses = function(gameState, queues)
    16871687{
    1688     if (!gameState.isTemplateAvailable(gameState.applyCiv("structures/{civ}/house")) ||
    1689         gameState.getPopulationMax() <= gameState.getPopulationLimit())
     1688    let houseTemplateString = "structures/{civ}/apartment";
     1689    if (!gameState.isTemplateAvailable(gameState.applyCiv(houseTemplateString)) ||
     1690        !this.canBuild(gameState, houseTemplateString))
     1691    {
     1692        houseTemplateString = "structures/{civ}/house";
     1693        if (!gameState.isTemplateAvailable(gameState.applyCiv(houseTemplateString)))
     1694            return;
     1695    }
     1696    if (gameState.getPopulationMax() <= gameState.getPopulationLimit())
    16901697        return;
    16911698
     
    16931700    if (numPlanned < 3 || numPlanned < 5 && gameState.getPopulation() > 80)
    16941701    {
    1695         let plan = new PETRA.ConstructionPlan(gameState, "structures/{civ}/house");
     1702        let plan = new PETRA.ConstructionPlan(gameState, );
    16961703        // change the starting condition according to the situation.
    16971704        plan.goRequirement = "houseNeeded";
     
    17011708    if (numPlanned > 0 && this.phasing && gameState.getPhaseEntityRequirements(this.phasing).length)
    17021709    {
    1703         let houseTemplateName = gameState.applyCiv("structures/{civ}/house");
     1710        let houseTemplateName = gameState.applyCiv();
    17041711        let houseTemplate = gameState.getTemplate(houseTemplateName);
    17051712
     
    17341741    if (this.requireHouses)
    17351742    {
    1736         let houseTemplate = gameState.getTemplate(gameState.applyCiv("structures/{civ}/house"));
     1743        let houseTemplate = gameState.getTemplate(gameState.applyCiv());
    17371744        if (!this.phasing || gameState.getPhaseEntityRequirements(this.phasing).every(req =>
    17381745            !houseTemplate.hasClass(req.class) || gameState.getOwnStructures().filter(API3.Filters.byClass(req.class)).length >= req.count))
     
    17431750    //    - if no room to build, try to improve with technology
    17441751    //    - otherwise increase temporarily the priority of houses
    1745     let house = gameState.applyCiv("structures/{civ}/house");
     1752    let house = gameState.applyCiv();
    17461753    let HouseNb = gameState.getOwnFoundations().filter(API3.Filters.byClass("House")).length;
    17471754    let popBonus = gameState.getTemplate(house).getPopulationBonus();
Note: See TracChangeset for help on using the changeset viewer.