Regardless result of foundationProgress if cooperation < 0.3 continue is called.
Removing not needed "continue" call.
Differential D2001
[AI] Small cleanup in defenseManager Silier on Jun 18 2019, 8:29 PM. Authored by
Details
Regardless result of foundationProgress if cooperation < 0.3 continue is called. Removing not needed "continue" call. :)
Diff Detail
Event TimelineComment 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/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 52| 52| } | 53| 53| } | 54| 54| for (let enemy in attackingArmies) | 55| |- { | | 55|+ | 56| 56| for (let ally in attackingArmies[enemy]) | 57| 57| { | 58| 58| if (this.attackedAllies[ally] === undefined) | 59| 59| this.attackedAllies[ally] = 0; | 60| 60| this.attackedAllies[ally] += 1; | 61| 61| } | 62| |- } | | 62|+ | 63| 63| this.checkEnemyArmies(gameState); | 64| 64| this.checkEnemyUnits(gameState); | 65| 65| this.assignDefenders(gameState); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 70| 70| m.DefenseManager.prototype.makeIntoArmy = function(gameState, entityID, type = "default") | 71| 71| { | 72| 72| if (type == "default") | 73| |- { | | 73|+ | 74| 74| // Try to add it to an existing army. | 75| 75| for (let army of this.armies) | 76| 76| if (army.getType() == type && army.addFoe(gameState, entityID)) | 77| 77| return; // over | 78| |- } | | 78|+ | 79| 79| | 80| 80| // Create a new army for it. | 81| 81| let army = new m.DefenseArmy(gameState, [entityID], type); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 179| 179| if (territoryOwner != PlayerID && this.attackedAllies[territoryOwner] && | 180| 180| this.attackedAllies[territoryOwner] > 1 && | 181| 181| this.GetCooperationLevel(territoryOwner) > 0.7) | 182| |- { | | 182|+ | 183| 183| for (let building of gameState.getAllyStructures(territoryOwner).values()) | 184| 184| { | 185| 185| if (building.foundationProgress() == 0 || | 188| 188| if (!this.territoryMap.isBlinking(building.position())) | 189| 189| return true; | 190| 190| } | 191| |- } | | 191|+ | 192| 192| | 193| 193| // Update the number of enemies attacking this ally | 194| 194| let enemy = entity.owner(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 211| 211| if (i == PlayerID) | 212| 212| { | 213| 213| if (!this.armies.length) | 214| |- { | | 214|+ | 215| 215| // check if we can recover capture points from any of our notdecaying structures | 216| 216| for (let ent of gameState.getOwnStructures().values()) | 217| 217| { | 229| 229| this.makeIntoArmy(gameState, ent.id(), "capturing"); | 230| 230| break; | 231| 231| } | 232| |- } | | 232|+ | 233| 233| return; | 234| 234| } | 235| 235| else if (!gameState.isPlayerEnemy(i)) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 327| 327| if (!gameState.isPlayerEnemy(owner)) | 328| 328| { | 329| 329| if (gameState.isPlayerMutualAlly(owner)) | 330| |- { | | 330|+ | 331| 331| // update the number of enemies attacking this ally | 332| 332| for (let id of army.foeEntities) | 333| 333| { | 342| 342| this.attackingArmies[enemy][owner] += 1; | 343| 343| break; | 344| 344| } | 345| |- } | | 345|+ | 346| 346| continue; | 347| 347| } | 348| 348| else if (owner != 0) // enemy army back in its territory | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 529| 529| army.checkEvents(gameState, events); | 530| 530| | 531| 531| for (let evt of events.OwnershipChanged) // capture events | 532| |- { | | 532|+ | 533| 533| if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0) | 534| 534| { | 535| 535| let ent = gameState.getEntityById(evt.entity); | 536| 536| if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured | 537| 537| gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 }); | 538| 538| } | 539| |- } | | 539|+ | 540| 540| | 541| 541| let allAttacked = {}; | 542| 542| for (let evt of events.Attacked) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 551| 551| let attacker = gameState.getEntityById(evt.attacker); | 552| 552| if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") && | 553| 553| (!target.hasClass("Structure") || target.attackRange("Ranged"))) | 554| |- { | | 554|+ | 555| 555| // If enemies are in range of one of our defensive structures, garrison it for arrow multiplier | 556| 556| // (enemy non-defensive structure are not considered to stay in sync with garrisonManager) | 557| 557| if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() && | 558| 558| (target.owner() != 0 || !target.hasClass("Unit") || | 559| 559| target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT")) | 560| 560| this.garrisonUnitsInside(gameState, attacker, { "attacker": target }); | 561| |- } | | 561|+ | 562| 562| | 563| 563| if (!gameState.isEntityOwn(target)) | 564| 564| continue; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 755| 755| let typeGarrison = data.type || "protection"; | 756| 756| let allowMelee = gameState.ai.HQ.garrisonManager.allowMelee(target); | 757| 757| if (allowMelee === undefined) | 758| |- { | | 758|+ | 759| 759| // Should be kept in sync with garrisonManager to avoid garrisoning-ungarrisoning some units | 760| 760| if (data.attacker) | 761| 761| allowMelee = data.attacker.hasClass("Structure") ? data.attacker.attackRange("Ranged") : !m.isSiegeUnit(data.attacker); | 762| 762| else | 763| 763| allowMelee = true; | 764| |- } | | 764|+ | 765| 765| let units = gameState.getOwnUnits().filter(ent => { | 766| 766| if (!ent.position()) | 767| 767| return false; binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 956| }(PETRA); | | [MAJOR] ESLintBear (no-use-before-define): | | 'PETRA' was used before it was defined. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1772/display/redirect 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/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 52| 52| } | 53| 53| } | 54| 54| for (let enemy in attackingArmies) | 55| |- { | | 55|+ | 56| 56| for (let ally in attackingArmies[enemy]) | 57| 57| { | 58| 58| if (this.attackedAllies[ally] === undefined) | 59| 59| this.attackedAllies[ally] = 0; | 60| 60| this.attackedAllies[ally] += 1; | 61| 61| } | 62| |- } | | 62|+ | 63| 63| this.checkEnemyArmies(gameState); | 64| 64| this.checkEnemyUnits(gameState); | 65| 65| this.assignDefenders(gameState); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 70| 70| m.DefenseManager.prototype.makeIntoArmy = function(gameState, entityID, type = "default") | 71| 71| { | 72| 72| if (type == "default") | 73| |- { | | 73|+ | 74| 74| // Try to add it to an existing army. | 75| 75| for (let army of this.armies) | 76| 76| if (army.getType() == type && army.addFoe(gameState, entityID)) | 77| 77| return; // over | 78| |- } | | 78|+ | 79| 79| | 80| 80| // Create a new army for it. | 81| 81| let army = new m.DefenseArmy(gameState, [entityID], type); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 177| 177| if (territoryOwner != PlayerID && this.attackedAllies[territoryOwner] && | 178| 178| this.attackedAllies[territoryOwner] > 1 && | 179| 179| this.GetCooperationLevel(territoryOwner) > 0.7) | 180| |- { | | 180|+ | 181| 181| for (let building of gameState.getAllyStructures(territoryOwner).values()) | 182| 182| { | 183| 183| if (building.foundationProgress() == 0 || | 186| 186| if (!this.territoryMap.isBlinking(building.position())) | 187| 187| return true; | 188| 188| } | 189| |- } | | 189|+ | 190| 190| | 191| 191| // Update the number of enemies attacking this ally | 192| 192| let enemy = entity.owner(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 209| 209| if (i == PlayerID) | 210| 210| { | 211| 211| if (!this.armies.length) | 212| |- { | | 212|+ | 213| 213| // check if we can recover capture points from any of our notdecaying structures | 214| 214| for (let ent of gameState.getOwnStructures().values()) | 215| 215| { | 227| 227| this.makeIntoArmy(gameState, ent.id(), "capturing"); | 228| 228| break; | 229| 229| } | 230| |- } | | 230|+ | 231| 231| return; | 232| 232| } | 233| 233| else if (!gameState.isPlayerEnemy(i)) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 325| 325| if (!gameState.isPlayerEnemy(owner)) | 326| 326| { | 327| 327| if (gameState.isPlayerMutualAlly(owner)) | 328| |- { | | 328|+ | 329| 329| // update the number of enemies attacking this ally | 330| 330| for (let id of army.foeEntities) | 331| 331| { | 340| 340| this.attackingArmies[enemy][owner] += 1; | 341| 341| break; | 342| 342| } | 343| |- } | | 343|+ | 344| 344| continue; | 345| 345| } | 346| 346| else if (owner != 0) // enemy army back in its territory | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 527| 527| army.checkEvents(gameState, events); | 528| 528| | 529| 529| for (let evt of events.OwnershipChanged) // capture events | 530| |- { | | 530|+ | 531| 531| if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0) | 532| 532| { | 533| 533| let ent = gameState.getEntityById(evt.entity); | 534| 534| if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured | 535| 535| gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 }); | 536| 536| } | 537| |- } | | 537|+ | 538| 538| | 539| 539| let allAttacked = {}; | 540| 540| for (let evt of events.Attacked) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 549| 549| let attacker = gameState.getEntityById(evt.attacker); | 550| 550| if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") && | 551| 551| (!target.hasClass("Structure") || target.attackRange("Ranged"))) | 552| |- { | | 552|+ | 553| 553| // If enemies are in range of one of our defensive structures, garrison it for arrow multiplier | 554| 554| // (enemy non-defensive structure are not considered to stay in sync with garrisonManager) | 555| 555| if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() && | 556| 556| (target.owner() != 0 || !target.hasClass("Unit") || | 557| 557| target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT")) | 558| 558| this.garrisonUnitsInside(gameState, attacker, { "attacker": target }); | 559| |- } | | 559|+ | 560| 560| | 561| 561| if (!gameState.isEntityOwn(target)) | 562| 562| continue; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 753| 753| let typeGarrison = data.type || "protection"; | 754| 754| let allowMelee = gameState.ai.HQ.garrisonManager.allowMelee(target); | 755| 755| if (allowMelee === undefined) | 756| |- { | | 756|+ | 757| 757| // Should be kept in sync with garrisonManager to avoid garrisoning-ungarrisoning some units | 758| 758| if (data.attacker) | 759| 759| allowMelee = data.attacker.hasClass("Structure") ? data.attacker.attackRange("Ranged") : !m.isSiegeUnit(data.attacker); | 760| 760| else | 761| 761| allowMelee = true; | 762| |- } | | 762|+ | 763| 763| let units = gameState.getOwnUnits().filter(ent => { | 764| 764| if (!ent.position()) | 765| 765| return false; binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 954| }(PETRA); | | [MAJOR] ESLintBear (no-use-before-define): | | 'PETRA' was used before it was defined. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1781/display/redirect
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/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 52| 52| } | 53| 53| } | 54| 54| for (let enemy in attackingArmies) | 55| |- { | | 55|+ | 56| 56| for (let ally in attackingArmies[enemy]) | 57| 57| { | 58| 58| if (this.attackedAllies[ally] === undefined) | 59| 59| this.attackedAllies[ally] = 0; | 60| 60| this.attackedAllies[ally] += 1; | 61| 61| } | 62| |- } | | 62|+ | 63| 63| this.checkEnemyArmies(gameState); | 64| 64| this.checkEnemyUnits(gameState); | 65| 65| this.assignDefenders(gameState); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 70| 70| m.DefenseManager.prototype.makeIntoArmy = function(gameState, entityID, type = "default") | 71| 71| { | 72| 72| if (type == "default") | 73| |- { | | 73|+ | 74| 74| // Try to add it to an existing army. | 75| 75| for (let army of this.armies) | 76| 76| if (army.getType() == type && army.addFoe(gameState, entityID)) | 77| 77| return; // over | 78| |- } | | 78|+ | 79| 79| | 80| 80| // Create a new army for it. | 81| 81| let army = new m.DefenseArmy(gameState, [entityID], type); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 178| 178| if (territoryOwner != PlayerID && this.attackedAllies[territoryOwner] && | 179| 179| this.attackedAllies[territoryOwner] > 1 && | 180| 180| this.GetCooperationLevel(territoryOwner) > 0.7) | 181| |- { | | 181|+ | 182| 182| for (let building of gameState.getAllyStructures(territoryOwner).values()) | 183| 183| { | 184| 184| if (building.foundationProgress() == 0 || | 187| 187| if (!this.territoryMap.isBlinking(building.position())) | 188| 188| return true; | 189| 189| } | 190| |- } | | 190|+ | 191| 191| | 192| 192| // Update the number of enemies attacking this ally. | 193| 193| let enemy = entity.owner(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 210| 210| if (i == PlayerID) | 211| 211| { | 212| 212| if (!this.armies.length) | 213| |- { | | 213|+ | 214| 214| // Check if we can recover capture points from any of our notdecaying structures. | 215| 215| for (let ent of gameState.getOwnStructures().values()) | 216| 216| { | 228| 228| this.makeIntoArmy(gameState, ent.id(), "capturing"); | 229| 229| break; | 230| 230| } | 231| |- } | | 231|+ | 232| 232| return; | 233| 233| } | 234| 234| else if (!gameState.isPlayerEnemy(i)) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 325| 325| if (!gameState.isPlayerEnemy(owner)) | 326| 326| { | 327| 327| if (gameState.isPlayerMutualAlly(owner)) | 328| |- { | | 328|+ | 329| 329| // Update the number of enemies attacking this ally. | 330| 330| for (let id of army.foeEntities) | 331| 331| { | 340| 340| this.attackingArmies[enemy][owner] += 1; | 341| 341| break; | 342| 342| } | 343| |- } | | 343|+ | 344| 344| continue; | 345| 345| } | 346| 346| else if (owner != 0) // Enemy army back in its territory. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 528| 528| | 529| 529| // Capture events | 530| 530| for (let evt of events.OwnershipChanged) | 531| |- { | | 531|+ | 532| 532| if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0) | 533| 533| { | 534| 534| let ent = gameState.getEntityById(evt.entity); | 536| 536| if (ent && ent.hasClass("CivCentre")) | 537| 537| gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 }); | 538| 538| } | 539| |- } | | 539|+ | 540| 540| | 541| 541| let allAttacked = {}; | 542| 542| for (let evt of events.Attacked) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 551| 551| let attacker = gameState.getEntityById(evt.attacker); | 552| 552| if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") && | 553| 553| (!target.hasClass("Structure") || target.attackRange("Ranged"))) | 554| |- { | | 554|+ | 555| 555| // If enemies are in range of one of our defensive structures, garrison it for arrow multiplier. | 556| 556| // (enemy non-defensive structure are not considered to stay in sync with garrisonManager) | 557| 557| if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() && | 558| 558| (target.owner() != 0 || !target.hasClass("Unit") || | 559| 559| target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT")) | 560| 560| this.garrisonUnitsInside(gameState, attacker, { "attacker": target }); | 561| |- } | | 561|+ | 562| 562| | 563| 563| if (!gameState.isEntityOwn(target)) | 564| 564| continue; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 756| 756| let typeGarrison = data.type || "protection"; | 757| 757| let allowMelee = gameState.ai.HQ.garrisonManager.allowMelee(target); | 758| 758| if (allowMelee === undefined) | 759| |- { | | 759|+ | 760| 760| // Should be kept in sync with garrisonManager to avoid garrisoning-ungarrisoning some units. | 761| 761| if (data.attacker) | 762| 762| allowMelee = data.attacker.hasClass("Structure") ? data.attacker.attackRange("Ranged") : !m.isSiegeUnit(data.attacker); | 763| 763| else | 764| 764| allowMelee = true; | 765| |- } | | 765|+ | 766| 766| let units = gameState.getOwnUnits().filter(ent => { | 767| 767| if (!ent.position()) | 768| 768| return false; binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 958| }(PETRA); | | [MAJOR] ESLintBear (no-use-before-define): | | 'PETRA' was used before it was defined. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1783/display/redirect Comment Actions This patch looks alright just make sure that the following code works as expected. if (cooperation < 0.3 || (cooperation < 0.6 && !!cc.foundationProgress())) Comment Actions Successful build - Chance fights ever on the side of the prudent. Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/893/display/redirect Comment Actions Successful build - Chance fights ever on the side of the prudent. Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/ai/petra/defenseManager.js | 580| 580| } | 581| 581| continue; | 582| 582| } | 583| |- | | 583|+ | 584| 584| // TODO integrate other ships later, need to be sure it is accessible. | 585| 585| if (target.hasClass("Ship")) | 586| 586| continue; Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1409/display/redirect |