Math.max(1000, 100 * "ally" === "ally" ? 10 : 5) = 1000
Because = 100 * "ally" === "ally" ? 10 : 5 = 10
Math.max(1000, 100 * "alldy" === "ally" ? 10 : 5) = 1000
Because = 100 * "ally" === "ally" ? 10 : 5 = 5
Details
Details
- Reviewers
bb - Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP22192: Add missing parenthesis in the Petra diplomacyManager. Else the requested…
Check that the fix is correct
Diff Detail
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Lint Skipped - Unit
Unit Tests Skipped - Build Status
Buildable 7196 Build 11726: Vulcan Build Jenkins
Event Timeline
Comment Actions
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | 79| 79| let tribute = {}; | 80| 80| let toSend = false; | 81| 81| for (let res in allyResources) | 82| |- { | | 82|+ | 83| 83| if (donor && availableResources[res] > 200 && allyResources[res] < 0.2 * availableResources[res]) | 84| 84| { | 85| 85| tribute[res] = Math.floor(0.3*availableResources[res] - allyResources[res]); | 111| 111| } | 112| 112| } | 113| 113| } | 114| |- } | | 114|+ | 115| 115| if (!toSend) | 116| 116| continue; | 117| 117| if (this.Config.debug > 1) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | 99| 99| if (!mostNeeded) | 100| 100| mostNeeded = gameState.ai.HQ.pickMostNeededResources(gameState); | 101| 101| for (let k = 0; k < 2; ++k) | 102| |- { | | 102|+ | 103| 103| if (mostNeeded[k].type == res && mostNeeded[k].wanted > 0) | 104| 104| { | 105| 105| this.nextTributeRequest.set("all", gameState.ai.elapsedTime + 90); | 109| 109| API3.warn("Tribute on " + res + " requested to player " + i); | 110| 110| break; | 111| 111| } | 112| |- } | | 112|+ | 113| 113| } | 114| 114| } | 115| 115| if (!toSend) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | 156| 156| continue; | 157| 157| let tributes = 0; | 158| 158| for (let key in evt.amounts) | 159| |- { | | 159|+ | 160| 160| if (key === "food") | 161| 161| tributes += evt.amounts[key]; | 162| 162| else | 163| 163| tributes += 2*evt.amounts[key]; | 164| |- } | | 164|+ | 165| 165| this.Config.personality.cooperative = Math.min(1, this.Config.personality.cooperative + 0.0001 * tributes); | 166| 166| } | 167| 167| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | 235| 235| | 236| 236| // Our diplomacy will have changed already if the response was "accept" | 237| 237| if (request.status === "waitingForTribute") | 238| |- { | | 238|+ | 239| 239| Engine.PostCommand(PlayerID, { | 240| 240| "type": "tribute-request", | 241| 241| "source": PlayerID, | 243| 243| "resourceWanted": request.wanted, | 244| 244| "resourceType": request.type | 245| 245| }); | 246| |- } | | 246|+ | 247| 247| } | 248| 248| | 249| 249| // An AI player we sent a diplomacy request to demanded we send them a tribute | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js | 432| 432| { | 433| 433| for (let [player, data] of this.receivedDiplomacyRequests) | 434| 434| if (data.status === "waitingForTribute" && gameState.ai.elapsedTime > data.warnTime) | 435| |- { | | 435|+ | 436| 436| if (data.sentWarning) | 437| 437| { | 438| 438| this.receivedDiplomacyRequests.delete(player); | 447| 447| "type": data.type | 448| 448| }); | 449| 449| } | 450| |- } | | 450|+ | 451| 451| }; | 452| 452| | 453| 453| /** Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/differential/1219/display/redirect