Page MenuHomeWildfire Games

reaffect → reassign
ClosedPublic

Authored by Stan on May 26 2018, 8:35 PM.

Details

Reviewers
bb
Gallaecio
Summary

Reported by GunChleoc on Transifex.

@mimo: It seems that (re)affect is a common false friend for French speakers.

Test Plan

None, only affects source comments and user-facing texts.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 6156
Build 10240: Vulcan BuildJenkins

Event Timeline

Gallaecio created this revision.May 26 2018, 8:35 PM
Vulcan added a subscriber: Vulcan.May 26 2018, 10:12 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/tutorials/Introductory_Tutorial.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/tutorials/Introductory_Tutorial.js
| 381| 381| 	let position = Engine.QueryInterface(target, IID_Position).GetPosition2D();
| 382| 382| 
| 383| 383| 	this.attackers = cmpRangeManager.GetEntitiesByPlayer(this.enemyID).filter(e =>
| 384|    |-			Engine.QueryInterface(e, IID_Identity) && Engine.QueryInterface(e, IID_UnitAI) &&
|    | 384|+		Engine.QueryInterface(e, IID_Identity) && Engine.QueryInterface(e, IID_UnitAI) &&
| 385| 385| 			Engine.QueryInterface(e, IID_Identity).HasClass("CitizenSoldier")
| 386| 386| 		);
| 387| 387| 	this.attackers.forEach(e => { Engine.QueryInterface(e, IID_UnitAI).WalkAndFight(position.x, position.y, { "attack": ["Unit"] }, false); });
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/tutorials/Introductory_Tutorial.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/tutorials/Introductory_Tutorial.js
| 383| 383| 	this.attackers = cmpRangeManager.GetEntitiesByPlayer(this.enemyID).filter(e =>
| 384| 384| 			Engine.QueryInterface(e, IID_Identity) && Engine.QueryInterface(e, IID_UnitAI) &&
| 385| 385| 			Engine.QueryInterface(e, IID_Identity).HasClass("CitizenSoldier")
| 386|    |-		);
|    | 386|+	);
| 387| 387| 	this.attackers.forEach(e => { Engine.QueryInterface(e, IID_UnitAI).WalkAndFight(position.x, position.y, { "attack": ["Unit"] }, false); });
| 388| 388| };
| 389| 389| 
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 424| 424| 	let candidate = { "gain": 0 };
| 425| 425| 	let potential = { "gain": 0 };
| 426| 426| 	let bestIndex = { "gain": 0 };
| 427|    |-	let bestLand  = { "gain": 0 };
|    | 427|+	let bestLand = { "gain": 0 };
| 428| 428| 
| 429| 429| 	let mapSize = gameState.sharedScript.mapSize;
| 430| 430| 	let traderTemplatesGains = gameState.getTraderTemplatesGains();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 462| 462| 			if (m1.foundationProgress() === undefined && m2.foundationProgress() === undefined)
| 463| 463| 			{
| 464| 464| 				if (accessIndex)
| 465|    |-				{
|    | 465|+				
| 466| 466| 					if (gameState.ai.accessibility.regionType[accessIndex] == "water" && sea == accessIndex)
| 467| 467| 					{
| 468| 468| 						if (gain < bestIndex.gain)
| 481| 481| 							continue;
| 482| 482| 						bestLand = { "source": m1, "target": m2, "gain": gain, "land": land, "sea": sea };
| 483| 483| 					}
| 484|    |-				}
|    | 484|+				
| 485| 485| 				if (gain < candidate.gain)
| 486| 486| 					continue;
| 487| 487| 				candidate = { "source": m1, "target": m2, "gain": gain, "land": land, "sea": sea };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 601| 601| 		return;	// position found, but not enough gain compared to our present route
| 602| 602| 
| 603| 603| 	if (this.Config.debug > 1)
| 604|    |-	{
|    | 604|+	
| 605| 605| 		if (this.potentialTradeRoute)
| 606| 606| 			API3.warn("turn " + gameState.ai.playedTurn + "we could have a new route with gain " +
| 607| 607| 				marketPos[3] + " instead of the present " + this.potentialTradeRoute.gain);
| 608| 608| 		else
| 609| 609| 			API3.warn("turn " + gameState.ai.playedTurn + "we could have a first route with gain " +
| 610| 610| 				marketPos[3]);
| 611|    |-	}
|    | 611|+	
| 612| 612| 
| 613| 613| 	if (!this.tradeRoute)
| 614| 614| 		gameState.ai.queueManager.changePriority("economicBuilding", 2*this.Config.priorities.economicBuilding);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 664| 664| 
| 665| 665| 	let ret = {};
| 666| 666| 	for (let key in route)
| 667|    |-	{
|    | 667|+	
| 668| 668| 		if (key == "source" || key == "target")
| 669| 669| 		{
| 670| 670| 			if (!route[key])
| 673| 673| 		}
| 674| 674| 		else
| 675| 675| 			ret[key] = route[key];
| 676|    |-	}
|    | 676|+	
| 677| 677| 	return ret;
| 678| 678| };
| 679| 679| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 684| 684| 
| 685| 685| 	let ret = {};
| 686| 686| 	for (let key in route)
| 687|    |-	{
|    | 687|+	
| 688| 688| 		if (key == "source" || key == "target")
| 689| 689| 		{
| 690| 690| 			ret[key] = gameState.getEntityById(route[key]);
| 693| 693| 		}
| 694| 694| 		else
| 695| 695| 			ret[key] = route[key];
| 696|    |-	}
|    | 696|+	
| 697| 697| 	return ret;
| 698| 698| };
| 699| 699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/tradeManager.js
| 711| 711| m.TradeManager.prototype.Deserialize = function(gameState, data)
| 712| 712| {
| 713| 713| 	for (let key in data)
| 714|    |-	{
|    | 714|+	
| 715| 715| 		if (key == "tradeRoute" || key == "potentialTradeRoute")
| 716| 716| 			this[key] = this.routeIdToEnt(gameState, data[key]);
| 717| 717| 		else
| 718| 718| 			this[key] = data[key];
| 719|    |-	}
|    | 719|+	
| 720| 720| };
| 721| 721| 
| 722| 722| return m;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 181| 181| 
| 182| 182| 			let dist = API3.SquareVectorDistance(supply.position(), dropsitePos);
| 183| 183| 			if (dist < maxDistResourceSquare)
| 184|    |-			{
|    | 184|+			
| 185| 185| 				if (dist < maxDistResourceSquare/16)        // distmax/4
| 186| 186| 					nearby.push({ "dropsite": dropsiteId, "id": supply.id(), "ent": supply, "dist": dist });
| 187| 187| 				else if (dist < maxDistResourceSquare/4)    // distmax/2
| 188| 188| 					medium.push({ "dropsite": dropsiteId, "id": supply.id(), "ent": supply, "dist": dist });
| 189| 189| 				else
| 190| 190| 					faraway.push({ "dropsite": dropsiteId, "id": supply.id(), "ent": supply, "dist": dist });
| 191|    |-			}
|    | 191|+			
| 192| 192| 		});
| 193| 193| 
| 194| 194| 		nearby.sort((r1, r2) => r1.dist - r2.dist);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 195| 195| 		medium.sort((r1, r2) => r1.dist - r2.dist);
| 196| 196| 		faraway.sort((r1, r2) => r1.dist - r2.dist);
| 197| 197| 
| 198|    |-/*		let debug = false;
|    | 198|+		/*		let debug = false;
| 199| 199| 		if (debug)
| 200| 200| 		{
| 201| 201| 			faraway.forEach(function(res){
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 227| 227| 
| 228| 228| 	let removeSupply = function(entId, supply){
| 229| 229| 		for (let i = 0; i < supply.length; ++i)
| 230|    |-		{
|    | 230|+		
| 231| 231| 			// exhausted resource, remove it from this list
| 232| 232| 			if (!supply[i].ent || !gameState.getEntityById(supply[i].id))
| 233| 233| 				supply.splice(i--, 1);
| 234| 234| 			// resource assigned to the removed dropsite, remove it
| 235| 235| 			else if (supply[i].dropsite == entId)
| 236| 236| 				supply.splice(i--, 1);
| 237|    |-		}
|    | 237|+		
| 238| 238| 	};
| 239| 239| 
| 240| 240| 	for (let type in this.dropsiteSupplies)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 430| 430| 		if (gameState.ai.playedTurn < this.gatherers[type].nextCheck)
| 431| 431| 			continue;
| 432| 432| 		for (let ent of this.gatherersByType(gameState, type).values())
| 433|    |-		{
|    | 433|+		
| 434| 434| 			if (ent.unitAIState() == "INDIVIDUAL.GATHER.GATHERING")
| 435| 435| 				++this.gatherers[type].used;
| 436| 436| 			else if (ent.unitAIState() == "INDIVIDUAL.RETURNRESOURCE.APPROACHING")
| 437| 437| 				++this.gatherers[type].lost;
| 438|    |-		}
|    | 438|+		
| 439| 439| 		// TODO  add also a test on remaining resources.
| 440| 440| 		let total = this.gatherers[type].used + this.gatherers[type].lost;
| 441| 441| 		if (total > 150 || total > 60 && type != "wood")
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 447| 447| 				if (newDP.quality > 50 && gameState.ai.HQ.canBuild(gameState, "structures/{civ}_storehouse"))
| 448| 448| 					queues.dropsites.addPlan(new m.ConstructionPlan(gameState, "structures/{civ}_storehouse", { "base": this.ID, "type": type }, newDP.pos));
| 449| 449| 				else if (!gameState.getOwnFoundations().filter(API3.Filters.byClass("CivCentre")).hasEntities() && !queues.civilCentre.hasQueuedUnits())
| 450|    |-				{
|    | 450|+				
| 451| 451| 					// No good dropsite, try to build a new base if no base already planned,
| 452| 452| 					// and if not possible, be less strict on dropsite quality.
| 453| 453| 					if ((!gameState.ai.HQ.canExpand || !gameState.ai.HQ.buildNewBase(gameState, queues, type)) &&
| 454| 454| 					    newDP.quality > Math.min(25, 50*0.15/ratio) &&
| 455| 455| 					    gameState.ai.HQ.canBuild(gameState, "structures/{civ}_storehouse"))
| 456| 456| 						queues.dropsites.addPlan(new m.ConstructionPlan(gameState, "structures/{civ}_storehouse", { "base": this.ID, "type": type }, newDP.pos));
| 457|    |-				}
|    | 457|+				
| 458| 458| 			}
| 459| 459| 			this.gatherers[type].nextCheck = gameState.ai.playedTurn + 20;
| 460| 460| 			this.gatherers[type].used = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 510| 510| 		roleless = this.units.filter(API3.Filters.not(API3.Filters.byHasMetadata(PlayerID, "role"))).values();
| 511| 511| 
| 512| 512| 	for (let ent of roleless)
| 513|    |-	{
|    | 513|+	
| 514| 514| 		if (ent.hasClass("Worker") || ent.hasClass("CitizenSoldier") || ent.hasClass("FishingBoat"))
| 515| 515| 			ent.setMetadata(PlayerID, "role", "worker");
| 516| 516| 		else if (ent.hasClass("Support") && ent.hasClass("Elephant"))
| 517| 517| 			ent.setMetadata(PlayerID, "role", "worker");
| 518|    |-	}
|    | 518|+	
| 519| 519| };
| 520| 520| 
| 521| 521| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/baseManager.js
| 766| 766| 	let availableResources = gameState.ai.queueManager.getAvailableResources(gameState);
| 767| 767| 	let builderRatio = 1;
| 768| 768| 	for (let res of Resources.GetCodes())
| 769|    |-	{
|    | 769|+	
| 770| 770| 		if (availableResources[res] < 200)
| 771| 771| 		{
| 772| 772| 			builderRatio = 0.2;
| 774| 774| 		}
| 775| 775| 		else if (availableResources[res] < 1000)
| 776| 776| 			builderRatio = Math.min(builderRatio, availableResources[res] / 1000);
| 777|    |-	}
|    | 777|+	
| 778| 778| 
| 779| 779| 	for (let target of foundations.values())
| 780| 780| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|  69|  69| 	this.rallyPoint = rallyPoint;
|  70|  70| 	this.overseas = 0;
|  71|  71| 	if (gameState.ai.HQ.navalMap)
|  72|    |-	{
|    |  72|+	
|  73|  73| 		for (let structure of gameState.getEnemyStructures().values())
|  74|  74| 		{
|  75|  75| 			if (this.target && structure.id() != this.target.id())
| 101| 101| 				gameState.ai.HQ.navalManager.setMinimalTransportShips(gameState, sea, 1);
| 102| 102| 			}
| 103| 103| 		}
| 104|    |-	}
|    | 104|+	
| 105| 105| 	this.paused = false;
| 106| 106| 	this.maxCompletingTime = 0;
| 107| 107| 
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 139| 139| 	{
| 140| 140| 		priority = 90;
| 141| 141| 		// basically we want a mix of citizen soldiers so our barracks have a purpose, and champion units.
| 142|    |-		this.unitStat.RangedInfantry    = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Ranged", "CitizenSoldier"],
|    | 142|+		this.unitStat.RangedInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Ranged", "CitizenSoldier"],
| 143| 143| 			"interests": [["strength", 3]] };
| 144| 144| 		this.unitStat.MeleeInfantry     = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Melee", "CitizenSoldier"],
| 145| 145| 			"interests": [["strength", 3]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 141| 141| 		// basically we want a mix of citizen soldiers so our barracks have a purpose, and champion units.
| 142| 142| 		this.unitStat.RangedInfantry    = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Ranged", "CitizenSoldier"],
| 143| 143| 			"interests": [["strength", 3]] };
| 144|    |-		this.unitStat.MeleeInfantry     = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Melee", "CitizenSoldier"],
|    | 144|+		this.unitStat.MeleeInfantry = { "priority": 0.7, "minSize": 5, "targetSize": 20, "batchSize": 5, "classes": ["Infantry", "Melee", "CitizenSoldier"],
| 145| 145| 			"interests": [["strength", 3]] };
| 146| 146| 		this.unitStat.ChampRangedInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Ranged", "Champion"],
| 147| 147| 			"interests": [["strength", 3]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 145| 145| 			"interests": [["strength", 3]] };
| 146| 146| 		this.unitStat.ChampRangedInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Ranged", "Champion"],
| 147| 147| 			"interests": [["strength", 3]] };
| 148|    |-		this.unitStat.ChampMeleeInfantry  = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Melee", "Champion"],
|    | 148|+		this.unitStat.ChampMeleeInfantry = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Melee", "Champion"],
| 149| 149| 			"interests": [["strength", 3]] };
| 150| 150| 		this.unitStat.RangedCavalry     = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
| 151| 151| 			"interests": [["strength", 2]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 147| 147| 			"interests": [["strength", 3]] };
| 148| 148| 		this.unitStat.ChampMeleeInfantry  = { "priority": 1, "minSize": 3, "targetSize": 18, "batchSize": 3, "classes": ["Infantry", "Melee", "Champion"],
| 149| 149| 			"interests": [["strength", 3]] };
| 150|    |-		this.unitStat.RangedCavalry     = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
|    | 150|+		this.unitStat.RangedCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
| 151| 151| 			"interests": [["strength", 2]] };
| 152| 152| 		this.unitStat.MeleeCavalry      = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
| 153| 153| 			"interests": [["strength", 2]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 149| 149| 			"interests": [["strength", 3]] };
| 150| 150| 		this.unitStat.RangedCavalry     = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Ranged", "CitizenSoldier"],
| 151| 151| 			"interests": [["strength", 2]] };
| 152|    |-		this.unitStat.MeleeCavalry      = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
|    | 152|+		this.unitStat.MeleeCavalry = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
| 153| 153| 			"interests": [["strength", 2]] };
| 154| 154| 		this.unitStat.ChampRangedCavalry  = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
| 155| 155| 			"interests": [["strength", 3]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 151| 151| 			"interests": [["strength", 2]] };
| 152| 152| 		this.unitStat.MeleeCavalry      = { "priority": 0.7, "minSize": 4, "targetSize": 20, "batchSize": 4, "classes": ["Cavalry", "Melee", "CitizenSoldier"],
| 153| 153| 			"interests": [["strength", 2]] };
| 154|    |-		this.unitStat.ChampRangedCavalry  = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
|    | 154|+		this.unitStat.ChampRangedCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
| 155| 155| 			"interests": [["strength", 3]] };
| 156| 156| 		this.unitStat.ChampMeleeCavalry   = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
| 157| 157| 			"interests": [["strength", 2]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 153| 153| 			"interests": [["strength", 2]] };
| 154| 154| 		this.unitStat.ChampRangedCavalry  = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Ranged", "Champion"],
| 155| 155| 			"interests": [["strength", 3]] };
| 156|    |-		this.unitStat.ChampMeleeCavalry   = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
|    | 156|+		this.unitStat.ChampMeleeCavalry = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
| 157| 157| 			"interests": [["strength", 2]] };
| 158| 158| 		this.unitStat.Hero                = { "priority": 1, "minSize": 0, "targetSize":  1, "batchSize": 1, "classes": ["Hero"],
| 159| 159| 			"interests": [["strength", 2]] };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 155| 155| 			"interests": [["strength", 3]] };
| 156| 156| 		this.unitStat.ChampMeleeCavalry   = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
| 157| 157| 			"interests": [["strength", 2]] };
| 158|    |-		this.unitStat.Hero                = { "priority": 1, "minSize": 0, "targetSize":  1, "batchSize": 1, "classes": ["Hero"],
|    | 158|+		this.unitStat.Hero = { "priority": 1, "minSize": 0, "targetSize":  1, "batchSize": 1, "classes": ["Hero"],
| 159| 159| 			"interests": [["strength", 2]] };
| 160| 160| 		this.neededShips = 5;
| 161| 161| 	}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'targetSize'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 155| 155| 			"interests": [["strength", 3]] };
| 156| 156| 		this.unitStat.ChampMeleeCavalry   = { "priority": 1, "minSize": 3, "targetSize": 15, "batchSize": 3, "classes": ["Cavalry", "Melee", "Champion"],
| 157| 157| 			"interests": [["strength", 2]] };
| 158|    |-		this.unitStat.Hero                = { "priority": 1, "minSize": 0, "targetSize":  1, "batchSize": 1, "classes": ["Hero"],
|    | 158|+		this.unitStat.Hero                = { "priority": 1, "minSize": 0, "targetSize": 1, "batchSize": 1, "classes": ["Hero"],
| 159| 159| 			"interests": [["strength", 2]] };
| 160| 160| 		this.neededShips = 5;
| 161| 161| 	}
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '='.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 164| 164| 		priority = 70;
| 165| 165| 		this.unitStat.RangedInfantry = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Ranged"],
| 166| 166| 			"interests": [["canGather", 1], ["strength", 1.6], ["costsResource", 0.3, "stone"], ["costsResource", 0.3, "metal"]] };
| 167|    |-		this.unitStat.MeleeInfantry  = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Melee"],
|    | 167|+		this.unitStat.MeleeInfantry = { "priority": 1, "minSize": 6, "targetSize": 16, "batchSize": 3, "classes": ["Infantry", "Melee"],
| 168| 168| 			"interests": [["canGather", 1], ["strength", 1.6], ["costsResource", 0.3, "stone"], ["costsResource", 0.3, "metal"]] };
| 169| 169| 		this.unitStat.Cavalry = { "priority": 1, "minSize": 2, "targetSize": 6, "batchSize": 2, "classes": ["Cavalry", "CitizenSoldier"],
| 170| 170| 			"interests": [["strength", 1]] };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 399| 399| 	// the completing step is used to return resources and regroup the units
| 400| 400| 	// so we check that we have no more forced order before starting the attack
| 401| 401| 	if (this.state == "completing")
| 402|    |-	{
|    | 402|+	
| 403| 403| 		// if our target was destroyed, go back to "unexecuted" state
| 404| 404| 		if (this.targetPlayer === undefined || !this.target || !gameState.getEntityById(this.target.id()))
| 405| 405| 		{
| 416| 416| 				return 1;
| 417| 417| 			return 2;
| 418| 418| 		}
| 419|    |-	}
|    | 419|+	
| 420| 420| 
| 421| 421| 	if (this.Config.debug > 3 && gameState.ai.playedTurn % 50 === 0)
| 422| 422| 		this.debugAttack();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 525| 525| 
| 526| 526| 	// Remove those units which were in a temporary bombing attack
| 527| 527| 	for (let unitIds of gameState.ai.HQ.attackManager.bombingAttacks.values())
| 528|    |-	{
|    | 528|+	
| 529| 529| 		for (let entId of unitIds.values())
| 530| 530| 		{
| 531| 531| 			let ent = gameState.getEntityById(entId);
| 534| 534| 			unitIds.delete(entId);
| 535| 535| 			ent.stopMoving();
| 536| 536| 		}
| 537|    |-	}
|    | 537|+	
| 538| 538| 
| 539| 539| 	let rallyPoint = this.rallyPoint;
| 540| 540| 	let rallyIndex = gameState.ai.accessibility.getAccessValue(rallyPoint);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
| 872| 872| 			targets.addEnt(ent);
| 873| 873| 	}
| 874| 874| 	else
| 875|    |-	{
|    | 875|+	
| 876| 876| 		if (this.type == "Raid")
| 877| 877| 			targets = this.raidTargetFinder(gameState);
| 878| 878| 		else if (this.type == "Rush" || this.type == "Attack")
| 883| 883| 		}
| 884| 884| 		else
| 885| 885| 			targets = this.defaultTargetFinder(gameState, this.targetPlayer);
| 886|    |-	}
|    | 886|+	
| 887| 887| 	if (!targets.hasEntities())
| 888| 888| 		return undefined;
| 889| 889| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1143|1143| 
|1144|1144| 	if (blocker && blocker.hasClass("StoneWall"))
|1145|1145| 	{
|1146|    |-/*		if (this.hasSiegeUnits())
|    |1146|+		/*		if (this.hasSiegeUnits())
|1147|1147| 		{ */
|1148|1148| 			this.isBlocked = true;
|1149|1149| 			return blocker;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1145|1145| 	{
|1146|1146| /*		if (this.hasSiegeUnits())
|1147|1147| 		{ */
|1148|    |-			this.isBlocked = true;
|    |1148|+		this.isBlocked = true;
|1149|1149| 			return blocker;
|1150|1150| /*		}
|1151|1151| 		return undefined; */
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1146|1146| /*		if (this.hasSiegeUnits())
|1147|1147| 		{ */
|1148|1148| 			this.isBlocked = true;
|1149|    |-			return blocker;
|    |1149|+		return blocker;
|1150|1150| /*		}
|1151|1151| 		return undefined; */
|1152|1152| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1147|1147| 		{ */
|1148|1148| 			this.isBlocked = true;
|1149|1149| 			return blocker;
|1150|    |-/*		}
|    |1150|+		/*		}
|1151|1151| 		return undefined; */
|1152|1152| 	}
|1153|1153| 	else if (blocker)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1345|1345| 				}
|1346|1346| 			}
|1347|1347| 			else
|1348|    |-			{
|    |1348|+			
|1349|1349| 				if (this.isBlocked && !ourUnit.hasClass("Ranged") && attacker.hasClass("Ranged"))
|1350|1350| 				{
|1351|1351| 					// do not react if our melee units are attacked by ranged one and we are blocked by walls
|1398|1398| 					ourUnit.attack(attacker.id(), m.allowCapture(gameState, ourUnit, attacker));
|1399|1399| 					ourUnit.setMetadata(PlayerID, "lastAttackPlanUpdateTime", time);
|1400|1400| 				}
|1401|    |-			}
|    |1401|+			
|1402|1402| 		}
|1403|1403| 
|1404|1404| 		let enemyUnits = gameState.getEnemyUnits(this.targetPlayer);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1347|1347| 			else
|1348|1348| 			{
|1349|1349| 				if (this.isBlocked && !ourUnit.hasClass("Ranged") && attacker.hasClass("Ranged"))
|1350|    |-				{
|    |1350|+				
|1351|1351| 					// do not react if our melee units are attacked by ranged one and we are blocked by walls
|1352|1352| 					// TODO check that the attacker is from behind the wall
|1353|1353| 					continue;
|1354|    |-				}
|    |1354|+				
|1355|1355| 				else if (m.isSiegeUnit(attacker))
|1356|1356| 				{	// if our unit is attacked by a siege unit, we'll send some melee units to help it.
|1357|1357| 					let collec = this.unitCollection.filter(API3.Filters.byClass("Melee")).filterNearest(ourUnit.position(), 5);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1390|1390| 							continue;
|1391|1391| 						let target = gameState.getEntityById(orderData[0].target);
|1392|1392| 						if (target && !target.hasClass("Structure") && !target.hasClass("Support"))
|1393|    |-						{
|    |1393|+						
|1394|1394| 							if (!target.hasClass("Ranged") || !attacker.hasClass("Melee"))
|1395|1395| 								continue;
|1396|    |-						}
|    |1396|+						
|1397|1397| 					}
|1398|1398| 					ourUnit.attack(attacker.id(), m.allowCapture(gameState, ourUnit, attacker));
|1399|1399| 					ourUnit.setMetadata(PlayerID, "lastAttackPlanUpdateTime", time);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1418|1418| 			if (!target || target.hasClass("Structure"))
|1419|1419| 				continue;
|1420|1420| 			if (!(targetId in unitTargets))
|1421|    |-			{
|    |1421|+			
|1422|1422| 				if (m.isSiegeUnit(target) || target.hasClass("Hero"))
|1423|1423| 					unitTargets[targetId] = -8;
|1424|1424| 				else if (target.hasClass("Champion") || target.hasClass("Ship"))
|1425|1425| 					unitTargets[targetId] = -5;
|1426|1426| 				else
|1427|1427| 					unitTargets[targetId] = -3;
|1428|    |-			}
|    |1428|+			
|1429|1429| 			++unitTargets[targetId];
|1430|1430| 		}
|1431|1431| 		let veto = {};
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1438|1438| 		if (this.type == "Rush")
|1439|1439| 			targetClassesUnit = { "attack": ["Unit", "Structure"], "avoid": ["Palisade", "StoneWall", "Tower", "Fortress"], "vetoEntities": veto };
|1440|1440| 		else
|1441|    |-		{
|    |1441|+		
|1442|1442| 			if (this.target.hasClass("Fortress"))
|1443|1443| 				targetClassesUnit = { "attack": ["Unit", "Structure"], "avoid": ["Palisade", "StoneWall"], "vetoEntities": veto };
|1444|1444| 			else if (this.target.hasClass("Palisade") || this.target.hasClass("StoneWall"))
|1445|1445| 				targetClassesUnit = { "attack": ["Unit", "Structure"], "avoid": ["Fortress"], "vetoEntities": veto };
|1446|1446| 			else
|1447|1447| 				targetClassesUnit = { "attack": ["Unit", "Structure"], "avoid": ["Palisade", "StoneWall", "Fortress"], "vetoEntities": veto };
|1448|    |-		}
|    |1448|+		
|1449|1449| 		if (this.target.hasClass("Structure"))
|1450|1450| 			targetClassesSiege = { "attack": ["Structure"], "avoid": [], "vetoEntities": veto };
|1451|1451| 		else
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1529|1529| 			let range = 60;
|1530|1530| 			let attackTypes = ent.attackTypes();
|1531|1531| 			if (this.isBlocked)
|1532|    |-			{
|    |1532|+			
|1533|1533| 				if (attackTypes && attackTypes.indexOf("Ranged") !== -1)
|1534|1534| 					range = ent.attackRange("Ranged").max;
|1535|1535| 				else if (attackTypes && attackTypes.indexOf("Melee") !== -1)
|1536|1536| 					range = ent.attackRange("Melee").max;
|1537|1537| 				else
|1538|1538| 					range = 10;
|1539|    |-			}
|    |1539|+			
|1540|1540| 			else if (attackTypes && attackTypes.indexOf("Ranged") !== -1)
|1541|1541| 				range = 30 + ent.attackRange("Ranged").max;
|1542|1542| 			else if (ent.hasClass("Cavalry"))
|    | [NORMAL] ESLintBear (operator-assignment):
|    | Assignment can be replaced with operator assignment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1541|1541| 				range = 30 + ent.attackRange("Ranged").max;
|1542|1542| 			else if (ent.hasClass("Cavalry"))
|1543|1543| 				range += 30;
|1544|    |-			range = range * range;
|    |1544|+			range *= range;
|1545|1545| 			let entAccess = m.getLandAccess(gameState, ent);
|1546|1546| 			// Checking for gates if we're a siege unit.
|1547|1547| 			if (siegeUnit)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1585|1585| 					}
|1586|1586| 				}
|1587|1587| 				else
|1588|    |-				{
|    |1588|+				
|1589|1589| 					if (!ent.hasClass("Ranged"))
|1590|1590| 					{
|1591|1591| 						let targetClasses = { "attack": targetClassesSiege.attack, "avoid": targetClassesSiege.avoid.concat("Ship"), "vetoEntities": veto };
|1593|1593| 					}
|1594|1594| 					else
|1595|1595| 						ent.attackMove(this.targetPos[0], this.targetPos[1], targetClassesSiege);
|1596|    |-				}
|    |1596|+				
|1597|1597| 			}
|1598|1598| 			else
|1599|1599| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1647|1647| 				{
|1648|1648| 					let targetClasses = targetClassesUnit;
|1649|1649| 					if (maybeUpdate && ent.unitAIState() === "INDIVIDUAL.COMBAT.APPROACHING")	// we may be blocked by walls, attack everything
|1650|    |-					{
|    |1650|+					
|1651|1651| 						if (!ent.hasClass("Ranged") && !ent.hasClass("Ship"))
|1652|1652| 							targetClasses = { "attack": ["Unit", "Structure"], "avoid": ["Ship"], "vetoEntities": veto };
|1653|1653| 						else
|1654|1654| 							targetClasses = { "attack": ["Unit", "Structure"], "vetoEntities": veto };
|1655|    |-					}
|    |1655|+					
|1656|1656| 					else if (!ent.hasClass("Ranged") && !ent.hasClass("Ship"))
|1657|1657| 						targetClasses = { "attack": targetClassesUnit.attack, "avoid": targetClassesUnit.avoid.concat("Ship"), "vetoEntities": veto };
|1658|1658| 					ent.attackMove(this.targetPos[0], this.targetPos[1], targetClasses);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1793|1793| 	}
|1794|1794| 	// Are we arrived at destination ?
|1795|1795| 	if (attackedNB > 1 && (attackedUnitNB || this.hasSiegeUnits()))
|1796|    |-	{
|    |1796|+	
|1797|1797| 		if (gameState.ai.HQ.territoryMap.getOwner(this.position) === this.targetPlayer || attackedNB > 3)
|1798|1798| 		{
|1799|1799| 			this.state = "arrived";
|1800|1800| 			return true;
|1801|1801| 		}
|1802|    |-	}
|    |1802|+	
|1803|1803| 
|1804|1804| 	// basically haven't moved an inch: very likely stuck)
|1805|1805| 	if (API3.SquareVectorDistance(this.position, this.position5TurnsAgo) < 10 && this.path.length > 0 && gameState.ai.playedTurn % 5 === 0)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/attackPlan.js
|1919|1919| 			// Check if we could help any current attack
|1920|1920| 			let attackManager = gameState.ai.HQ.attackManager;
|1921|1921| 			for (let attackType in attackManager.startedAttacks)
|1922|    |-			{
|    |1922|+			
|1923|1923| 				for (let attack of attackManager.startedAttacks[attackType])
|1924|1924| 				{
|1925|1925| 					if (attack.name == this.name)
|1938|1938| 					this.targetPos = this.target.position();
|1939|1939| 					return true;
|1940|1940| 				}
|1941|    |-			}
|    |1941|+			
|1942|1942| 
|1943|1943| 			// If not, let's look for another enemy
|1944|1944| 			if (!this.target)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 209| 209| 	}
| 210| 210| 
| 211| 211| 	for (let evt of events.Destroy)
| 212|    |-	{
|    | 212|+	
| 213| 213| 		// Let's check we haven't lost an important building here.
| 214| 214| 		if (evt && !evt.SuccessfulFoundation && evt.entityObj && evt.metadata && evt.metadata[PlayerID] &&
| 215| 215| 			evt.metadata[PlayerID].base)
| 226| 226| 			if (evt.metadata[PlayerID].baseAnchor && evt.metadata[PlayerID].baseAnchor === true)
| 227| 227| 				base.anchorLost(gameState, ent);
| 228| 228| 		}
| 229|    |-	}
|    | 229|+	
| 230| 230| 
| 231| 231| 	for (let evt of events.EntityRenamed)
| 232| 232| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 255| 255| 			// Let's get a few units from other bases there to build this.
| 256| 256| 			let builders = this.bulkPickWorkers(gameState, newbase, 10);
| 257| 257| 			if (builders !== false)
| 258|    |-			{
|    | 258|+			
| 259| 259| 				builders.forEach(worker => {
| 260| 260| 					worker.setMetadata(PlayerID, "base", newbase.ID);
| 261| 261| 					worker.setMetadata(PlayerID, "subrole", "builder");
| 262| 262| 					worker.setMetadata(PlayerID, "target-foundation", ent.id());
| 263| 263| 				});
| 264|    |-			}
|    | 264|+			
| 265| 265| 		}
| 266| 266| 		else if (ent.getMetadata(PlayerID, "base") == -2)	// anchorless base around a dock
| 267| 267| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 269| 269| 			// Let's get a few units from other bases there to build this.
| 270| 270| 			let builders = this.bulkPickWorkers(gameState, newbase, 4);
| 271| 271| 			if (builders != false)
| 272|    |-			{
|    | 272|+			
| 273| 273| 				builders.forEach(worker => {
| 274| 274| 					worker.setMetadata(PlayerID, "base", newbase.ID);
| 275| 275| 					worker.setMetadata(PlayerID, "subrole", "builder");
| 276| 276| 					worker.setMetadata(PlayerID, "target-foundation", ent.id());
| 277| 277| 				});
| 278|    |-			}
|    | 278|+			
| 279| 279| 		}
| 280| 280| 	}
| 281| 281| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 395| 395| 	}
| 396| 396| 
| 397| 397| 	for (let evt of events.TrainingFinished)
| 398|    |-	{
|    | 398|+	
| 399| 399| 		for (let entId of evt.entities)
| 400| 400| 		{
| 401| 401| 			let ent = gameState.getEntityById(entId);
| 463| 463| 					ent.moveToRange(goal[0], goal[1]);
| 464| 464| 			}
| 465| 465| 		}
| 466|    |-	}
|    | 466|+	
| 467| 467| 
| 468| 468| 	for (let evt of events.TerritoryDecayChanged)
| 469| 469| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 411| 411| 					this.garrisonManager.registerHolder(gameState, holder);
| 412| 412| 			}
| 413| 413| 			else if (ent.getMetadata(PlayerID, "garrisonType"))
| 414|    |-			{
|    | 414|+			
| 415| 415| 				// we were supposed to be autogarrisoned, but this has failed (may-be full)
| 416| 416| 				ent.setMetadata(PlayerID, "garrisonType", undefined);
| 417|    |-			}
|    | 417|+			
| 418| 418| 
| 419| 419| 			// Check if this unit is no more needed in its attack plan
| 420| 420| 			// (happen when the training ends after the attack is started or aborted)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 482| 482| 	}
| 483| 483| 
| 484| 484| 	if (addBase)
| 485|    |-	{
|    | 485|+	
| 486| 486| 		if (!this.firstBaseConfig)
| 487| 487| 		{
| 488| 488| 			// This is our first base, let us configure our starting resources
| 495| 495| 			this.saveSpace = undefined;
| 496| 496| 			this.maxFields = false;
| 497| 497| 		}
| 498|    |-	}
|    | 498|+	
| 499| 499| 
| 500| 500| 	// Then deals with decaying structures: destroy them if being lost to enemy (except in easier difficulties)
| 501| 501| 	if (this.Config.difficulty < 2)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 484| 484| 	if (addBase)
| 485| 485| 	{
| 486| 486| 		if (!this.firstBaseConfig)
| 487|    |-		{
|    | 487|+		
| 488| 488| 			// This is our first base, let us configure our starting resources
| 489| 489| 			this.configFirstBase(gameState);
| 490|    |-		}
|    | 490|+		
| 491| 491| 		else
| 492| 492| 		{
| 493| 493| 			// Let us hope this new base will fix our possible resource shortage
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 773| 773| 		let aValue = 0.1;
| 774| 774| 		let bValue = 0.1;
| 775| 775| 		for (let param of parameters)
| 776|    |-		{
|    | 776|+		
| 777| 777| 			if (param[0] == "strength")
| 778| 778| 			{
| 779| 779| 				aValue += m.getMaxStrength(a[1]) * param[1];
| 807| 807| 			}
| 808| 808| 			else
| 809| 809| 				API3.warn(" trainMoreUnits avec non prevu " + uneval(param));
| 810|    |-		}
|    | 810|+		
| 811| 811| 		return -aValue/aCost + bValue/bCost;
| 812| 812| 	});
| 813| 813| 	return units[0][0];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1051|1051| 				continue;
|1052|1052| 
|1053|1053| 			if (minDist > maxAccessDisfavored)     // Disfavor if quite far from any allied cc
|1054|    |-			{
|    |1054|+			
|1055|1055| 				if (!accessible)
|1056|1056| 				{
|1057|1057| 					if (minDist > maxNoAccessDisfavored)
|1061|1061| 				}
|1062|1062| 				else
|1063|1063| 					norm *= 0.5;
|1064|    |-			}
|    |1064|+			
|1065|1065| 
|1066|1066| 			// Not near any of our dropsite, except for oversea docks
|1067|1067| 			oversea = !accessible && dpList.some(dp => m.getLandAccess(gameState, dp.ent) == index);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1053|1053| 			if (minDist > maxAccessDisfavored)     // Disfavor if quite far from any allied cc
|1054|1054| 			{
|1055|1055| 				if (!accessible)
|1056|    |-				{
|    |1056|+				
|1057|1057| 					if (minDist > maxNoAccessDisfavored)
|1058|1058| 						norm *= 0.5;
|1059|1059| 					else
|1060|1060| 						norm *= 0.8;
|1061|    |-				}
|    |1061|+				
|1062|1062| 				else
|1063|1063| 					norm *= 0.5;
|1064|1064| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1066|1066| 			// Not near any of our dropsite, except for oversea docks
|1067|1067| 			oversea = !accessible && dpList.some(dp => m.getLandAccess(gameState, dp.ent) == index);
|1068|1068| 			if (!oversea)
|1069|    |-			{
|    |1069|+			
|1070|1070| 				for (let dp of dpList)
|1071|1071| 				{
|1072|1072| 					let dist = API3.SquareVectorDistance(dp.pos, pos);
|1078|1078| 					else if (dist < 6400)
|1079|1079| 						norm *= 0.5;
|1080|1080| 				}
|1081|    |-			}
|    |1081|+			
|1082|1082| 			if (norm == 0)
|1083|1083| 				continue;
|1084|1084| 		}
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1092|1092| 				val += gameState.sharedScript.ccResourceMaps[res].map[j];
|1093|1093| 		val *= norm;
|1094|1094| 
|1095|    |-		// If oversea, be just above threshold to be accepted if nothing else 
|    |1095|+		// If oversea, be just above threshold to be accepted if nothing else
|1096|1096| 		if (oversea)
|1097|1097| 			val = Math.max(val, cut + 0.1);
|1098|1098| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1378|1378| 	// do not keep it if gain is too small, except if this is our first BarterMarket
|1379|1379| 	let idx;
|1380|1380| 	if (expectedGain < this.tradeManager.minimalGain)
|1381|    |-	{
|    |1381|+	
|1382|1382| 		if (template.hasClass("BarterMarket") &&
|1383|1383| 		    !gameState.getOwnEntitiesByClass("BarterMarket", true).hasEntities())
|1384|1384| 			idx = -1;	// needed by queueplanBuilding manager to keep that market
|1385|1385| 		else
|1386|1386| 			return false;
|1387|    |-	}
|    |1387|+	
|1388|1388| 	else
|1389|1389| 		idx = this.basesMap.map[bestJdx];
|1390|1390| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1565|1565| 			let cost = queues.economicBuilding.plans[0].getCost();
|1566|1566| 			queueManager.setAccounts(gameState, cost, "economicBuilding");
|1567|1567| 			if (!queueManager.canAfford("economicBuilding", cost))
|1568|    |-			{
|    |1568|+			
|1569|1569| 				for (let q in queueManager.queues)
|1570|1570| 				{
|1571|1571| 					if (q == "economicBuilding")
|1574|1574| 					if (queueManager.canAfford("economicBuilding", cost))
|1575|1575| 						break;
|1576|1576| 				}
|1577|    |-			}
|    |1577|+			
|1578|1578| 		}
|1579|1579| 		return;
|1580|1580| 	}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1624|1624| 		let highLevel = 0;
|1625|1625| 		let lowLevel = 0;
|1626|1626| 		for (let res in cost)
|1627|    |-		{
|    |1627|+		
|1628|1628| 			if (resources[res] && resources[res] > 0.7 * cost[res])
|1629|1629| 				++highLevel;
|1630|1630| 			else if (!resources[res] || resources[res] < 0.3 * cost[res])
|1631|1631| 				++lowLevel;
|1632|    |-		}
|    |1632|+		
|1633|1633| 		if (highLevel == 0 || lowLevel > 1)
|1634|1634| 			return;
|1635|1635| 	}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1750|1750| 	let freeSlots = gameState.getPopulationLimit() + HouseNb*popBonus - this.getAccountedPopulation(gameState);
|1751|1751| 	let priority;
|1752|1752| 	if (freeSlots < 5)
|1753|    |-	{
|    |1753|+	
|1754|1754| 		if (this.buildManager.isUnbuildable(gameState, house))
|1755|1755| 		{
|1756|1756| 			if (this.Config.debug > 1)
|1759|1759| 		}
|1760|1760| 		else
|1761|1761| 			priority = 2*this.Config.priorities.house;
|1762|    |-	}
|    |1762|+	
|1763|1763| 	else
|1764|1764| 		priority = this.Config.priorities.house;
|1765|1765| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|1841|1841| 		return;
|1842|1842| 
|1843|1843| 	if (!this.saveResources && (this.currentPhase > 2 || gameState.isResearching(gameState.getPhaseName(3))))
|1844|    |-	{
|    |1844|+	
|1845|1845| 		// try to build fortresses
|1846|1846| 		if (this.canBuild(gameState, "structures/{civ}_fortress"))
|1847|1847| 		{
|1860|1860| 				return;
|1861|1861| 			}
|1862|1862| 		}
|1863|    |-	}
|    |1863|+	
|1864|1864| 
|1865|1865| 	if (this.Config.Military.numSentryTowers && this.currentPhase < 2 && this.canBuild(gameState, "structures/{civ}_sentry_tower"))
|1866|1866| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2006|2006| 		nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|2007|2007| 
|2008|2008| 	if (!nAdvanced || nAdvanced < this.bAdvanced.length && this.getAccountedPopulation(gameState) > 110)
|2009|    |-	{
|    |2009|+	
|2010|2010| 		for (let advanced of this.bAdvanced)
|2011|2011| 		{
|2012|2012| 			if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|2021|2021| 				queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|2022|2022| 			return;
|2023|2023| 		}
|2024|    |-	}
|    |2024|+	
|2025|2025| };
|2026|2026| 
|2027|2027| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2109|2109| 	// in which case we prefer melee units
|2110|2110| 	let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor);
|2111|2111| 	if (nearestAnchor._entity.trainingQueue)
|2112|    |-	{
|    |2112|+	
|2113|2113| 		for (let item of nearestAnchor._entity.trainingQueue)
|2114|2114| 		{
|2115|2115| 			if (item.metadata && item.metadata.garrisonType)
|2117|2117| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2118|2118| 				nearestAnchor.stopProduction(item.id);
|2119|2119| 		}
|2120|    |-	}
|    |2120|+	
|2121|2121| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2122|2122| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|2123|2123| 	let rangedWanted = randBool() && autogarrison;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2111|2111| 	if (nearestAnchor._entity.trainingQueue)
|2112|2112| 	{
|2113|2113| 		for (let item of nearestAnchor._entity.trainingQueue)
|2114|    |-		{
|    |2114|+		
|2115|2115| 			if (item.metadata && item.metadata.garrisonType)
|2116|2116| 				numGarrisoned += item.count;
|2117|2117| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2118|2118| 				nearestAnchor.stopProduction(item.id);
|2119|    |-		}
|    |2119|+		
|2120|2120| 	}
|2121|2121| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2122|2122| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2151|2151| 	let cost = new API3.Resources(templateFound[1].cost());
|2152|2152| 	queueManager.setAccounts(gameState, cost, "emergency");
|2153|2153| 	if (!queueManager.canAfford("emergency", cost))
|2154|    |-	{
|    |2154|+	
|2155|2155| 		for (let q in queueManager.queues)
|2156|2156| 		{
|2157|2157| 			if (q == "emergency")
|2160|2160| 			if (queueManager.canAfford("emergency", cost))
|2161|2161| 				break;
|2162|2162| 		}
|2163|    |-	}
|    |2163|+	
|2164|2164| 	let metadata = { "role": "worker", "base": nearestAnchor.getMetadata(PlayerID, "base"), "plan": -1, "trainer": nearestAnchor.id() };
|2165|2165| 	if (autogarrison)
|2166|2166| 		metadata.garrisonType = "protection";
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2441|2441| m.HQ.prototype.assignGatherers = function()
|2442|2442| {
|2443|2443| 	for (let base of this.baseManagers)
|2444|    |-	{
|    |2444|+	
|2445|2445| 		for (let worker of base.workers.values())
|2446|2446| 		{
|2447|2447| 			if (worker.unitAIState().split(".")[1] != "RETURNRESOURCE")
|2451|2451| 				continue;
|2452|2452| 			this.AddTCGatherer(orders[1].target);
|2453|2453| 		}
|2454|    |-	}
|    |2454|+	
|2455|2455| };
|2456|2456| 
|2457|2457| m.HQ.prototype.isDangerousLocation = function(gameState, pos, radius)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2623|2623| 	{
|2624|2624| 		let pop = gameState.getPopulation();
|2625|2625| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2626|    |-		{
|    |2626|+		
|2627|2627| 			for (let item of ent.trainingQueue())
|2628|2628| 			{
|2629|2629| 				if (!item.unitTemplate)
|2632|2632| 				if (unitPop)
|2633|2633| 					pop += item.count * unitPop;
|2634|2634| 			}
|2635|    |-		}
|    |2635|+		
|2636|2636| 		this.turnCache.accountedPopulation = pop;
|2637|2637| 	}
|2638|2638| 	return this.turnCache.accountedPopulation;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2647|2647| 	{
|2648|2648| 		let workers = gameState.getOwnEntitiesByRole("worker", true).length;
|2649|2649| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2650|    |-		{
|    |2650|+		
|2651|2651| 			for (let item of ent.trainingQueue())
|2652|2652| 			{
|2653|2653| 				if (!item.metadata || !item.metadata.role || item.metadata.role != "worker")
|2654|2654| 					continue;
|2655|2655| 				workers += item.count;
|2656|2656| 			}
|2657|    |-		}
|    |2657|+		
|2658|2658| 		this.turnCache.accountedWorkers = workers;
|2659|2659| 	}
|2660|2660| 	return this.turnCache.accountedWorkers;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2685|2685| 			this.phasing = 0;
|2686|2686| 	}
|2687|2687| 
|2688|    |-/*	if (this.Config.debug > 1)
|    |2688|+	/*	if (this.Config.debug > 1)
|2689|2689| 	{
|2690|2690| 		gameState.getOwnUnits().forEach (function (ent) {
|2691|2691| 			if (!ent.position())
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2760|2760| 		this.currentBase %= this.baseManagers.length;
|2761|2761| 		activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
|2762|2762| 		--nbBases;
|2763|    |-// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|    |2763|+		// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|2764|2764| 	}
|2765|2765| 	while (!activeBase && nbBases != 0);
|2766|2766| 

binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 524| »   »   »   let·ratioMax·=·0.70·+·randFloat(0.,·0.1);
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '0.'.

binaries/data/mods/public/simulation/ai/petra/headquarters.js
| 529| »   »   »   »   ratioMax·=·0.85·+·randFloat(0.,·0.1);
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '0.'.

Link to build: https://jenkins.wildfiregames.com/job/differential/575/display/redirect

bb accepted this revision.Jun 1 2018, 10:47 PM
bb added a subscriber: bb.

Noticed them some times before, thx for fixing them
patch correct and complete, not sure these kind of patches require a review, but whatever
should be committed in A24 development (so wait for an official leave of commit freeze)

This revision is now accepted and ready to land.Jun 1 2018, 10:47 PM
Stan commandeered this revision.Dec 29 2018, 5:12 PM
Stan added a reviewer: Gallaecio.
Stan added a subscriber: Stan.

Fixed in rP21981

Stan closed this revision.Dec 29 2018, 5:12 PM