Changeset 25600
- Timestamp:
- May 30, 2021, 11:07:27 AM (3 years ago)
- Location:
- ps/trunk/binaries/data/mods/public/simulation/ai/petra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
r25584 r25600 174 174 if (this.Config.difficulty < 2) 175 175 { 176 priority *= 0. 6;177 variation *= 0. 5;176 priority *= 0.; 177 variation *= 0.; 178 178 } 179 179 else if (this.Config.difficulty < 3) 180 180 { 181 181 priority *= 0.8; 182 variation *= 0.8; 183 } 184 for (let cat in this.unitStat) 185 { 186 this.unitStat[cat].targetSize = Math.round(variation * this.unitStat[cat].targetSize); 187 this.unitStat[cat].minSize = Math.min(this.unitStat[cat].minSize, this.unitStat[cat].targetSize); 182 variation *= 0.6; 183 } 184 185 if (this.Config.difficulty < 2) 186 { 187 for (const cat in this.unitStat) 188 { 189 this.unitStat[cat].targetSize = Math.ceil(variation * this.unitStat[cat].targetSize); 190 this.unitStat[cat].minSize = Math.min(this.unitStat[cat].targetSize, Math.min(this.unitStat[cat].minSize, 2)); 191 this.unitStat[cat].batchSize = this.unitStat[cat].minSize; 192 } 193 } 194 else 195 { 196 for (const cat in this.unitStat) 197 { 198 this.unitStat[cat].targetSize = Math.ceil(variation * this.unitStat[cat].targetSize); 199 this.unitStat[cat].minSize = Math.min(this.unitStat[cat].minSize, this.unitStat[cat].targetSize); 200 } 188 201 } 189 202 … … 192 205 for (let cat in this.unitStat) 193 206 { 194 this.unitStat[cat].targetSize = Math. round(this.Config.popScaling * this.unitStat[cat].targetSize);207 this.unitStat[cat].targetSize = Math.(this.Config.popScaling * this.unitStat[cat].targetSize); 195 208 this.unitStat[cat].minSize = Math.ceil(this.Config.popScaling * this.unitStat[cat].minSize); 196 209 } … … 707 720 } 708 721 709 // Finally add also some workers ,722 // Finally add also some workers, 710 723 // If Rush, assign all kind of workers, keeping only a minimum number of defenders 711 724 // Otherwise, assign only some idle workers if too much of them 725 726 727 712 728 let num = 0; 713 let numbase = {};729 t numbase = {}; 714 730 let keep = this.type != "Rush" ? 715 731 6 + 4 * gameState.getNumPlayerEnemies() + 8 * this.Config.personality.defensive : 8; 716 732 keep = Math.round(this.Config.popScaling * keep); 717 for ( let ent of gameState.getOwnEntitiesByRole("worker", true).values())733 for (t ent of gameState.getOwnEntitiesByRole("worker", true).values()) 718 734 { 719 735 if (!ent.hasClass("CitizenSoldier") || !this.isAvailableUnit(gameState, ent)) 720 736 continue; 721 let baseID = ent.getMetadata(PlayerID, "base");737 t baseID = ent.getMetadata(PlayerID, "base"); 722 738 if (baseID) 723 739 numbase[baseID] = numbase[baseID] ? ++numbase[baseID] : 1; -
ps/trunk/binaries/data/mods/public/simulation/ai/petra/config.js
r24758 r25600 209 209 if (this.difficulty < 2) 210 210 { 211 211 212 this.Economy.supportRatio = 0.5; 212 213 this.Economy.provisionFields = 1; … … 215 216 else if (this.difficulty < 3) 216 217 { 218 217 219 this.Economy.supportRatio = 0.4; 218 220 this.Economy.provisionFields = 1; … … 255 257 256 258 if (maxPop < 300) 257 { 258 this.popScaling = Math.sqrt(maxPop / 300); 259 this.Military.popForBarracks1 = Math.min(Math.max(Math.floor(this.Military.popForBarracks1 * this.popScaling), 12), Math.floor(maxPop/5)); 260 this.Military.popForBarracks2 = Math.min(Math.max(Math.floor(this.Military.popForBarracks2 * this.popScaling), 45), Math.floor(maxPop*2/3)); 261 this.Military.popForForge = Math.min(Math.max(Math.floor(this.Military.popForForge * this.popScaling), 30), Math.floor(maxPop/2)); 262 this.Economy.popPhase2 = Math.min(Math.max(Math.floor(this.Economy.popPhase2 * this.popScaling), 20), Math.floor(maxPop/2)); 263 this.Economy.workPhase3 = Math.min(Math.max(Math.floor(this.Economy.workPhase3 * this.popScaling), 40), Math.floor(maxPop*2/3)); 264 this.Economy.workPhase4 = Math.min(Math.max(Math.floor(this.Economy.workPhase4 * this.popScaling), 45), Math.floor(maxPop*2/3)); 265 this.Economy.targetNumTraders = Math.round(this.Economy.targetNumTraders * this.popScaling); 266 } 259 this.popScaling *= Math.sqrt(maxPop / 300); 260 261 this.Military.popForBarracks1 = Math.min(Math.max(Math.floor(this.Military.popForBarracks1 * this.popScaling), 12), Math.floor(maxPop/5)); 262 this.Military.popForBarracks2 = Math.min(Math.max(Math.floor(this.Military.popForBarracks2 * this.popScaling), 45), Math.floor(maxPop*2/3)); 263 this.Military.popForForge = Math.min(Math.max(Math.floor(this.Military.popForForge * this.popScaling), 30), Math.floor(maxPop/2)); 264 this.Economy.popPhase2 = Math.min(Math.max(Math.floor(this.Economy.popPhase2 * this.popScaling), 20), Math.floor(maxPop/2)); 265 this.Economy.workPhase3 = Math.min(Math.max(Math.floor(this.Economy.workPhase3 * this.popScaling), 40), Math.floor(maxPop*2/3)); 266 this.Economy.workPhase4 = Math.min(Math.max(Math.floor(this.Economy.workPhase4 * this.popScaling), 45), Math.floor(maxPop*2/3)); 267 this.Economy.targetNumTraders = Math.round(this.Economy.targetNumTraders * this.popScaling); 267 268 this.Economy.targetNumWorkers = Math.max(this.Economy.targetNumWorkers, this.Economy.popPhase2); 268 269 this.Economy.workPhase3 = Math.min(this.Economy.workPhase3, this.Economy.targetNumWorkers);
Note:
See TracChangeset
for help on using the changeset viewer.