Ticket #2757: 2757.5.patch
File 2757.5.patch, 3.3 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/ai/petra/chatHelper.js
106 106 Engine.PostCommand(PlayerID, chat); 107 107 }; 108 108 109 m.chatNewPhase = function(gameState, phase, started) 110 { 111 if (started) 112 var message = "/allies " + markForTranslation("I am advancing to the %(phase)s."); 113 else 114 var message = "/allies " + markForTranslation("I have reached the %(phase)s."); 115 116 var chat = { 117 "type": "aichat", 118 "message": message, 119 "translateMessage": true, 120 "translateParameters": ["phase"], 121 "parameters": { "phase": phase } 122 }; 123 Engine.PostCommand(PlayerID, chat); 124 }; 125 126 109 127 return m; 110 128 }(PETRA); -
binaries/data/mods/public/simulation/ai/petra/headquarters.js
19 19 this.Config = Config; 20 20 21 21 this.econState = "growth"; // existing values: growth, townPhasing. 22 this. phaseStarted= undefined;22 this.currentPhase = undefined; 23 23 24 24 // cache the rates. 25 25 this.wantedRates = { "food": 0, "wood": 0, "stone":0, "metal": 0 }; … … 71 71 return false; 72 72 }); 73 73 this.treasures.registerUpdates(); 74 this.currentPhase = gameState.currentPhase(); 74 75 }; 75 76 76 77 /** … … 279 280 { 280 281 if (this.Config.difficulty > 2 && this.femaleRatio > 0.4) 281 282 this.femaleRatio = 0.4; 282 283 this.phaseStarted = 2; 283 284 var phaseName = gameState.getTemplate(gameState.townPhase()).name(); 285 m.chatNewPhase(gameState, phaseName, true); 284 286 }; 285 287 286 288 // Called by the "city phase" research plan once it's started … … 291 293 292 294 // increase the priority of defense buildings to free this queue for our first fortress 293 295 gameState.ai.queueManager.changePriority("defenseBuilding", 2*this.Config.priorities.defenseBuilding); 294 295 this.phaseStarted = 3; 296 297 var phaseName = gameState.getTemplate(gameState.cityPhase()).name(); 298 m.chatNewPhase(gameState, phaseName, true); 296 299 }; 297 300 298 301 // This code trains females and citizen workers, trying to keep close to a ratio of females/CS … … 1739 1742 this.researchManager.checkPhase(gameState, queues); 1740 1743 1741 1744 // TODO find a better way to update 1742 if (this. phaseStarted && gameState.currentPhase() == this.phaseStarted)1745 if (this.currentPhase != gameState.currentPhase()) 1743 1746 { 1744 this.phaseStarted = undefined; 1747 this.currentPhase = gameState.currentPhase(); 1748 if (this.currentPhase == 2) 1749 var phaseName = gameState.getTemplate(gameState.townPhase()).name(); 1750 else if (this.currentPhase == 3) 1751 var phaseName = gameState.getTemplate(gameState.cityPhase()).name(); 1752 1753 m.chatNewPhase(gameState, phaseName, false); 1745 1754 this.updateTerritories(gameState); 1746 1755 } 1747 1756 else if (gameState.ai.playedTurn - this.lastTerritoryUpdate > 100) … … 1812 1821 { 1813 1822 let properties = { 1814 1823 "econState": this.econState, 1815 " phaseStarted": this.phaseStarted,1824 "currentPhase": this.currentPhase, 1816 1825 "wantedRates": this.wantedRates, 1817 1826 "currentRates": this.currentRates, 1818 1827 "lastFailedGather": this.lastFailedGather,