Page MenuHomeWildfire Games

Easier introduction of new damage types.
Needs ReviewPublic

Authored by Freagarach on Fri, May 31, 1:37 PM.

Details

Reviewers
bb
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#4801
Summary

Currently when introducing a new damage type someone has to make sure that every template has it in the attack and armour components (either directly or inherited). This patch aims at fixing that. If a damage type is not given, an armour of "0" against it is assumed. There is also no need to specify every kind of damage in the Attack-component in templates anymore.
Extension of #4801.

Test Plan
  • Create a new damage type and watch the errors/warnings be thrown!
  • Apply this patch and the errors will not be thrown. This needs some rigorous testing.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8019
Build 13052: Vulcan BuildJenkins
Build 13051: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Applied (most of) @wraitii's comments.

Freagarach marked an inline comment as done.Thu, Jun 6, 5:07 PM
Vulcan added a comment.Thu, Jun 6, 5:08 PM

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-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 308| 308| 			return undefined;
| 309| 309| 
| 310| 310| 		if (this.get("Attack/" + type + "/Bonuses"))
| 311|    |-		{
|    | 311|+		
| 312| 312| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 313| 313| 			{
| 314| 314| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 318| 318| 					if (bcl == againstClass)
| 319| 319| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 320| 320| 			}
| 321|    |-		}
|    | 321|+		
| 322| 322| 		return 1;
| 323| 323| 	},
| 324| 324| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 798| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 815| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.
Executing section cli...

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

WARNING: JavaScript warning: simulation/components/Armour.js line 71
reference to undefined property this.template[type]

which is easily fixed by adding "|| 0" there. Thank you for this simplification!

Mh, that's odd, I ran that code with the status effects change and didn't trigger that. Are you running this code on top of D1936 or another rev? Or maybe we were just lucky.
Though || 0 as it stands is perfectly fine for me

You are referring to D1936?

Yes, but we've discussed that a there I guess.

WARNING: JavaScript warning: simulation/components/Armour.js line 71
reference to undefined property this.template[type]

which is easily fixed by adding "|| 0" there. Thank you for this simplification!

Mh, that's odd, I ran that code with the status effects change and didn't trigger that. Are you running this code on top of D1936 or another rev? Or maybe we were just lucky.
Though || 0 as it stands is perfectly fine for me

Did you also introduce a new damage type? And then selected a unit? For I did introduce a new damage type for testing purposes, as that is where this diff is about ;)

Freagarach added inline comments.Sat, Jun 8, 7:45 AM
binaries/data/mods/public/simulation/helpers/DamageTypes.js
15

I can't seem to get this working:

ERROR: CXeromyces: Parse error: in_memory_buffer:1: Element or text conflicts in interleave

with this as the shema:

let schema =
	"<oneOrMore>" +
		"<element a:help='" + helptext + "'>" +
			"<anyName/>" +
			"<ref name='nonNegativeDecimal'/>" +
		"</element>" +
	"</oneOrMore>";

I still believe you should remove dependencies on "GetTypes" everywhere where you've introduced them. I don't think it's needed anywhere and things should work without needing to define them explicitly anywhere (in fact the global script should be removed I think then).

binaries/data/mods/public/globalscripts/Templates.js
195

Instead use for (let damageType of template.Attack[type])

binaries/data/mods/public/simulation/ai/common-api/entity.js
208

That should probably be handled at the call-site, rather.

binaries/data/mods/public/simulation/helpers/DamageTypes.js
15

This sent me for a bit of a loop... The problem is that this element's name (being any) might conflict with other elements at the same level.

So you need to do something like:

DamageTypes.prototype.BuildSchema = function(helptext = "", except = [])
{
	return "<oneOrMore>" +
		"<element>" +
			"<anyName>" +
				(except.length ? ("<except>" + except.map(e => "<name>" + e + "</name>").join('') + "</except>") : "") +
			"</anyName>" +
			"<ref name='nonNegativeDecimal' />" +
		"</element>" +
	"</oneOrMore>";
};

and pass the appropriate list everywhere (which is annoying where there are many conflicts).
So I guess that's one more argument for D1950 :)

Though I do think we should allow any name, so I would wait for D1950 first.

I still believe you should remove dependencies on "GetTypes" everywhere where you've introduced them. I don't think it's needed anywhere and things should work without needing to define them explicitly anywhere (in fact the global script should be removed I think then).

"everywhere" would refer to the AI only ;) The rest is long gone xD But I guess you mean I should remove all dependencies on "GetTypes". ?

binaries/data/mods/public/simulation/helpers/DamageTypes.js
15

We discussed that the "Armour" doesn't need the "Damage"-container, so there it can still conflict with "Foundation", right? And there the except "Foundation" needs to be given, then. If I read this correctly.

"everywhere" would refer to the AI only ;) The rest is long gone xD But I guess you mean I should remove all dependencies on "GetTypes". ?

I did indeed :)

binaries/data/mods/public/simulation/helpers/DamageTypes.js
15

You read this correctly indeed, but you need to pass ['Foundation'] as it can take a list.

Freagarach planned changes to this revision.Thu, Jun 13, 9:21 PM

"everywhere" would refer to the AI only ;) The rest is long gone xD But I guess you mean I should remove all dependencies on "GetTypes". ?

I did indeed :)

That is again easier (/doable only) with D1950, I just noticed :) So I have to wait for that to land.

Freagarach updated this revision to Diff 8533.Mon, Jun 17, 8:19 PM
Freagarach edited the test plan for this revision. (Show Details)
  • Removed "GetTypes()"

ToDo:

  • PetraAI.
Freagarach added inline comments.Mon, Jun 17, 8:20 PM
binaries/data/mods/public/globalscripts/DamageTypes.js
0

This is needed for the helper, if it can be removed please let me know how ;)

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| function getRepairTimeTooltip(entState)
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 396|+		"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397|    |-			"details": entState.repairable.numBuilders
|    | 397|+		"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 398|+	}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
| 401| 401| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getBuildTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of builders:")),
|    | 418|+		"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419|    |-			"details": entState.foundation.numBuilders
|    | 419|+		"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 420|+	}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 312| 312| 			return undefined;
| 313| 313| 
| 314| 314| 		if (this.get("Attack/" + type + "/Bonuses"))
| 315|    |-		{
|    | 315|+		
| 316| 316| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 317| 317| 			{
| 318| 318| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 322| 322| 					if (bcl == againstClass)
| 323| 323| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 324| 324| 			}
| 325|    |-		}
|    | 325|+		
| 326| 326| 		return 1;
| 327| 327| 	},
| 328| 328| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 802| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 819| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 949| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
Executing section cli...

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

Freagarach marked 10 inline comments as done.Mon, Jun 17, 8:27 PM

This indeed looks much better. I kinda wish we could get rid of the Foundation special-ness but it sounds more annoying right now.

Added a few comments.

binaries/data/mods/public/globalscripts/DamageTypes.js
0

see below.

binaries/data/mods/public/simulation/ai/common-api/entity.js
204–209

I think armour is also a mass-noun. ArmourTypes perhaps here.

208

Here check if the entity is a foundation and return the foundation damage if so.

binaries/data/mods/public/simulation/helpers/DamageTypes.js
9

Just rename this to function BuildDamageTypesSchema()

17

I've add some more time to think about this, and we don't need the "except" parameter.
Foundation cannot be used as a damage name since you can't have armour against it. So instead, we should just explicitly forbid it in all Damage Types schema - no need for the parameter, just write:

"<oneOrMore>" +
	"<element>" +
		"<anyName>" +
			// Armour requires Foundation to not be a damage type.
			"<except>name>Foundation</name></except>" +
		"</anyName>" +
		"<ref name='nonNegativeDecimal' />" +
	"</element>" +
"</oneOrMore>"
22

And instead here use Engine.RegisterGlobal("BuildDamageTypesSchema", BuildDamageTypesSchema);

Stan added inline comments.Tue, Jun 18, 3:14 PM
binaries/data/mods/public/simulation/ai/common-api/entity.js
204–209
Nescio added inline comments.Tue, Jun 18, 3:52 PM
binaries/data/mods/public/simulation/ai/common-api/entity.js
204–209

The style guide only applies to user-facing text strings; “armor” because US spelling.
However, in the json and xml files, the node is called Armour.

Freagarach marked 7 inline comments as done.Tue, Jun 18, 6:02 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/ai/common-api/entity.js
208

It seems that it is never called for buildings. Should I still return foundation damages?

Freagarach updated this revision to Diff 8546.Tue, Jun 18, 6:05 PM

So funny to find out where "DamageTypes" were to be found.

Owners added a subscriber: Restricted Owners Package.Tue, Jun 18, 6:05 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  17|  17| 			"<ref name='nonNegativeDecimal' />" +
|  18|  18| 		"</element>" +
|  19|  19| 	"</oneOrMore>";
|  20|    |-};
|    |  20|+}
|  21|  21| 
|  22|  22| Engine.RegisterGlobal("BuildDamageTypesSchema", BuildDamageTypesSchema);

binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  20| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| function getRepairTimeTooltip(entState)
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 396|+		"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397|    |-			"details": entState.repairable.numBuilders
|    | 397|+		"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 398|+	}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
| 401| 401| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getBuildTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of builders:")),
|    | 418|+		"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419|    |-			"details": entState.foundation.numBuilders
|    | 419|+		"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 420|+	}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 312| 312| 			return undefined;
| 313| 313| 
| 314| 314| 		if (this.get("Attack/" + type + "/Bonuses"))
| 315|    |-		{
|    | 315|+		
| 316| 316| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 317| 317| 			{
| 318| 318| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 322| 322| 					if (bcl == againstClass)
| 323| 323| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 324| 324| 			}
| 325|    |-		}
|    | 325|+		
| 326| 326| 		return 1;
| 327| 327| 	},
| 328| 328| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 802| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 819| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 949| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
Executing section cli...

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

wraitii added inline comments.Tue, Jun 18, 6:29 PM
binaries/data/mods/public/simulation/ai/common-api/entity.js
208

I guess it also didn't work before...
Feel free to just add a "TODO implement".

Looks good - I'll test when I can and commit it.

binaries/data/mods/public/simulation/helpers/DamageTypes.js
6

You're not actually displaying that :p

Stan added inline comments.Tue, Jun 18, 6:35 PM
binaries/data/mods/public/simulation/helpers/DamageTypes.js
6

Yeah, should be added back line 12.

Freagarach marked 4 inline comments as done.Tue, Jun 18, 6:50 PM

Looks good - I'll test when I can and commit it.

Should I also try to fix "PetraAI"? It currently has the "damageTypes" hardcoded in its "entityExtend.js" with an importance factor.

binaries/data/mods/public/simulation/ai/common-api/entity.js
208

I read that adding "TODO" in code is not appreciated;

we have trac for that

(I do not recall where I read it, I think it was in a old ticket on trac ;) )

binaries/data/mods/public/simulation/helpers/DamageTypes.js
6

I don't even know where it is used ;)

Freagarach updated this revision to Diff 8547.Tue, Jun 18, 6:51 PM
Freagarach marked 2 inline comments as done.

Helptext in helper :)

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

Linter detected issues:
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/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| function getRepairTimeTooltip(entState)
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 396|+		"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397|    |-			"details": entState.repairable.numBuilders
|    | 397|+		"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 398|+	}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
| 401| 401| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getBuildTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of builders:")),
|    | 418|+		"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419|    |-			"details": entState.foundation.numBuilders
|    | 419|+		"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 420|+	}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 312| 312| 			return undefined;
| 313| 313| 
| 314| 314| 		if (this.get("Attack/" + type + "/Bonuses"))
| 315|    |-		{
|    | 315|+		
| 316| 316| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 317| 317| 			{
| 318| 318| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 322| 322| 					if (bcl == againstClass)
| 323| 323| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 324| 324| 			}
| 325|    |-		}
|    | 325|+		
| 326| 326| 		return 1;
| 327| 327| 	},
| 328| 328| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 802| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 819| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 949| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  17|  17| 			"<ref name='nonNegativeDecimal' />" +
|  18|  18| 		"</element>" +
|  19|  19| 	"</oneOrMore>";
|  20|    |-};
|    |  20|+}
|  21|  21| 
|  22|  22| Engine.RegisterGlobal("BuildDamageTypesSchema", BuildDamageTypesSchema);

binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  20| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.
Executing section cli...

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

Stan added a comment.Tue, Jun 18, 7:14 PM

Well if you can fix the ai that's nice.

In D1938#83100, @Stan wrote:

Well if you can fix the ai that's nice.

Hmm, I'm trying, but it doesn't go smooth ;)
I'm using the "config.js" since that is the most logical place to store the "damage importance values", IMHO. But it seems that I can't call that "config" from "entityExtend.js". Many (other) managers are started with the "config" as an element in it's function.
I think it is best to leave it at this for now.

Angen added a comment.Tue, Jun 18, 8:16 PM

common-ai is supposed to be independent from any ai created upon it.

what do you want to do ?
did not damages.js work?

Freagarach updated this revision to Diff 8549.Tue, Jun 18, 8:38 PM

Could not stand not figuring out the PetraAI.

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 169| 169| 			plan.removeUnit(gameState, ent);
| 170| 170| 	}
| 171| 171| 
| 172|    |-/*
|    | 172|+	/*
| 173| 173| 	// TODO be sure that all units in the transport need the cancelation
| 174| 174| 	if (!ent.position())	// this unit must still be in a transport plan ... try to cancel it
| 175| 175| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 385| 385| {
| 386| 386| 	// copy over all parameters.
| 387| 387| 	for (let i in otherArmy.assignedAgainst)
| 388|    |-	{
|    | 388|+	
| 389| 389| 		if (this.assignedAgainst[i] === undefined)
| 390| 390| 			this.assignedAgainst[i] = otherArmy.assignedAgainst[i];
| 391| 391| 		else
| 392| 392| 			this.assignedAgainst[i] = this.assignedAgainst[i].concat(otherArmy.assignedAgainst[i]);
| 393|    |-	}
|    | 393|+	
| 394| 394| 	for (let i in otherArmy.assignedTo)
| 395| 395| 		this.assignedTo[i] = otherArmy.assignedTo[i];
| 396| 396| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 481| 481| 
| 482| 482| 	let entStrength;
| 483| 483| 	if (ent.hasClass("Structure"))
| 484|    |-	{
|    | 484|+	
| 485| 485| 		if (ent.owner() !== PlayerID)
| 486| 486| 			entStrength = ent.getDefaultArrow() ? 6*ent.getDefaultArrow() : 4;
| 487| 487| 		else	// small strength used only when we try to recover capture points
| 488| 488| 			entStrength = 2;
| 489|    |-	}
|    | 489|+	
| 490| 490| 	else
| 491| 491| 		entStrength = m.getMaxStrength(ent, damageTypeFactors);
| 492| 492| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 510| 510| 	// otherwise it would remove the old entity from this army list
| 511| 511| 	// TODO we should may-be reevaluate the strength
| 512| 512| 	for (let evt of events.EntityRenamed)	// take care of promoted and packed units
| 513|    |-	{
|    | 513|+	
| 514| 514| 		if (this.foeEntities.indexOf(evt.entity) !== -1)
| 515| 515| 		{
| 516| 516| 			let ent = gameState.getEntityById(evt.newentity);
| 538| 538| 					this.assignedAgainst[against][this.assignedAgainst[against].indexOf(evt.entity)] = evt.newentity;
| 539| 539| 			}
| 540| 540| 		}
| 541|    |-	}
|    | 541|+	
| 542| 542| 
| 543| 543| 	for (let evt of events.Garrison)
| 544| 544| 		this.removeFoe(gameState, evt.entity);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 544| 544| 		this.removeFoe(gameState, evt.entity);
| 545| 545| 
| 546| 546| 	for (let evt of events.OwnershipChanged)	// captured
| 547|    |-	{
|    | 547|+	
| 548| 548| 		if (!gameState.isPlayerEnemy(evt.to))
| 549| 549| 			this.removeFoe(gameState, evt.entity);
| 550| 550| 		else if (evt.from === PlayerID)
| 551| 551| 			this.removeOwn(gameState, evt.entity);
| 552|    |-	}
|    | 552|+	
| 553| 553| 
| 554| 554| 	for (let evt of events.Destroy)
| 555| 555| 	{

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 651| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|  54|  54| 		"armyMergeSize": 1400	// squared.
|  55|  55| 	};
|  56|  56| 
|  57|    |-	// Additional buildings that the AI does not yet know when to build 
|    |  57|+	// Additional buildings that the AI does not yet know when to build
|  58|  58| 	// and that it will try to build on phase 3 when enough resources.
|  59|  59| 	this.buildings =
|  60|  60| 	{

binaries/data/mods/public/simulation/ai/petra/config.js
| 265| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [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], gameState) * 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
|2004|2004| 		nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|2005|2005| 
|2006|2006| 	if (!nAdvanced || nAdvanced < this.bAdvanced.length && this.getAccountedPopulation(gameState) > 110)
|2007|    |-	{
|    |2007|+	
|2008|2008| 		for (let advanced of this.bAdvanced)
|2009|2009| 		{
|2010|2010| 			if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|2019|2019| 				queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|2020|2020| 			return;
|2021|2021| 		}
|2022|    |-	}
|    |2022|+	
|2023|2023| };
|2024|2024| 
|2025|2025| /**
|    | [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
|2107|2107| 	// in which case we prefer melee units
|2108|2108| 	let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor);
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|    |-	{
|    |2110|+	
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|2112| 		{
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|2117| 		}
|2118|    |-	}
|    |2118|+	
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|2121|2121| 	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
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|2110| 	{
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|    |-		{
|    |2112|+		
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2114|2114| 				numGarrisoned += item.count;
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|    |-		}
|    |2117|+		
|2118|2118| 	}
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   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
|2149|2149| 	let cost = new API3.Resources(templateFound[1].cost());
|2150|2150| 	queueManager.setAccounts(gameState, cost, "emergency");
|2151|2151| 	if (!queueManager.canAfford("emergency", cost))
|2152|    |-	{
|    |2152|+	
|2153|2153| 		for (let q in queueManager.queues)
|2154|2154| 		{
|2155|2155| 			if (q == "emergency")
|2158|2158| 			if (queueManager.canAfford("emergency", cost))
|2159|2159| 				break;
|2160|2160| 		}
|2161|    |-	}
|    |2161|+	
|2162|2162| 	let metadata = { "role": "worker", "base": nearestAnchor.getMetadata(PlayerID, "base"), "plan": -1, "trainer": nearestAnchor.id() };
|2163|2163| 	if (autogarrison)
|2164|2164| 		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
|2439|2439| m.HQ.prototype.assignGatherers = function()
|2440|2440| {
|2441|2441| 	for (let base of this.baseManagers)
|2442|    |-	{
|    |2442|+	
|2443|2443| 		for (let worker of base.workers.values())
|2444|2444| 		{
|2445|2445| 			if (worker.unitAIState().split(".")[1] != "RETURNRESOURCE")
|2449|2449| 				continue;
|2450|2450| 			this.AddTCGatherer(orders[1].target);
|2451|2451| 		}
|2452|    |-	}
|    |2452|+	
|2453|2453| };
|2454|2454| 
|2455|2455| 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
|2621|2621| 	{
|2622|2622| 		let pop = gameState.getPopulation();
|2623|2623| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2624|    |-		{
|    |2624|+		
|2625|2625| 			for (let item of ent.trainingQueue())
|2626|2626| 			{
|2627|2627| 				if (!item.unitTemplate)
|2630|2630| 				if (unitPop)
|2631|2631| 					pop += item.count * unitPop;
|2632|2632| 			}
|2633|    |-		}
|    |2633|+		
|2634|2634| 		this.turnCache.accountedPopulation = pop;
|2635|2635| 	}
|2636|2636| 	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
|2645|2645| 	{
|2646|2646| 		let workers = gameState.getOwnEntitiesByRole("worker", true).length;
|2647|2647| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2648|    |-		{
|    |2648|+		
|2649|2649| 			for (let item of ent.trainingQueue())
|2650|2650| 			{
|2651|2651| 				if (!item.metadata || !item.metadata.role || item.metadata.role != "worker")
|2652|2652| 					continue;
|2653|2653| 				workers += item.count;
|2654|2654| 			}
|2655|    |-		}
|    |2655|+		
|2656|2656| 		this.turnCache.accountedWorkers = workers;
|2657|2657| 	}
|2658|2658| 	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
|2683|2683| 			this.phasing = 0;
|2684|2684| 	}
|2685|2685| 
|2686|    |-/*	if (this.Config.debug > 1)
|    |2686|+	/*	if (this.Config.debug > 1)
|2687|2687| 	{
|2688|2688| 		gameState.getOwnUnits().forEach (function (ent) {
|2689|2689| 			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
|2758|2758| 		this.currentBase %= this.baseManagers.length;
|2759|2759| 		activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
|2760|2760| 		--nbBases;
|2761|    |-// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|    |2761|+		// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|2762|2762| 	}
|2763|2763| 	while (!activeBase && nbBases != 0);
|2764|2764| 

binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2896| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

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.'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 312| 312| m.getHolder = function(gameState, ent)
| 313| 313| {
| 314| 314| 	for (let holder of gameState.getEntities().values())
| 315|    |-	{
|    | 315|+	
| 316| 316| 		if (holder.isGarrisonHolder() && holder.garrisoned().indexOf(ent.id()) !== -1)
| 317| 317| 			return holder;
| 318|    |-	}
|    | 318|+	
| 319| 319| 	return undefined;
| 320| 320| };
| 321| 321| 

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 428| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [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
| 328| 328| 		if (!gameState.isPlayerEnemy(owner))
| 329| 329| 		{
| 330| 330| 			if (gameState.isPlayerMutualAlly(owner))
| 331|    |-			{
|    | 331|+			
| 332| 332| 				// update the number of enemies attacking this ally
| 333| 333| 				for (let id of army.foeEntities)
| 334| 334| 				{
| 343| 343| 					this.attackingArmies[enemy][owner] += 1;
| 344| 344| 					break;
| 345| 345| 				}
| 346|    |-			}
|    | 346|+			
| 347| 347| 			continue;
| 348| 348| 		}
| 349| 349| 		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
| 530| 530| 		army.checkEvents(gameState, events);
| 531| 531| 
| 532| 532| 	for (let evt of events.OwnershipChanged)   // capture events
| 533|    |-	{
|    | 533|+	
| 534| 534| 		if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0)
| 535| 535| 		{
| 536| 536| 			let ent = gameState.getEntityById(evt.entity);
| 537| 537| 			if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured
| 538| 538| 				gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 });
| 539| 539| 		}
| 540|    |-	}
|    | 540|+	
| 541| 541| 
| 542| 542| 	let allAttacked = {};
| 543| 543| 	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
| 552| 552| 		let attacker = gameState.getEntityById(evt.attacker);
| 553| 553| 		if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") &&
| 554| 554| 		   (!target.hasClass("Structure") || target.attackRange("Ranged")))
| 555|    |-		{
|    | 555|+		
| 556| 556| 			// If enemies are in range of one of our defensive structures, garrison it for arrow multiplier
| 557| 557| 			// (enemy non-defensive structure are not considered to stay in sync with garrisonManager)
| 558| 558| 			if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() &&
| 559| 559| 			    (target.owner() != 0 || !target.hasClass("Unit") ||
| 560| 560| 			     target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT"))
| 561| 561| 				this.garrisonUnitsInside(gameState, attacker, { "attacker": target });
| 562|    |-		}
|    | 562|+		
| 563| 563| 
| 564| 564| 		if (!gameState.isEntityOwn(target))
| 565| 565| 			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
| 957| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  17|  17| 			"<ref name='nonNegativeDecimal' />" +
|  18|  18| 		"</element>" +
|  19|  19| 	"</oneOrMore>";
|  20|    |-};
|    |  20|+}
|  21|  21| 
|  22|  22| Engine.RegisterGlobal("BuildDamageTypesSchema", BuildDamageTypesSchema);

binaries/data/mods/public/simulation/helpers/DamageTypes.js
|  20| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| function getRepairTimeTooltip(entState)
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 396|+		"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397|    |-			"details": entState.repairable.numBuilders
|    | 397|+		"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 398|+	}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
| 401| 401| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getBuildTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of builders:")),
|    | 418|+		"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419|    |-			"details": entState.foundation.numBuilders
|    | 419|+		"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 420|+	}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 312| 312| 			return undefined;
| 313| 313| 
| 314| 314| 		if (this.get("Attack/" + type + "/Bonuses"))
| 315|    |-		{
|    | 315|+		
| 316| 316| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 317| 317| 			{
| 318| 318| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 322| 322| 					if (bcl == againstClass)
| 323| 323| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 324| 324| 			}
| 325|    |-		}
|    | 325|+		
| 326| 326| 		return 1;
| 327| 327| 	},
| 328| 328| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 802| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 819| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 949| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
Executing section cli...

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

In D1938#83103, @Angen wrote:

common-ai is supposed to be independent from any ai created upon it.
what do you want to do ?
did not damages.js work?

Oh sorry, I did not see your comment untill now. What is desired is that when someone creates a new damage type, that person only has to change a line in config.js what importance value is to be used. I guess this works now.

Freagarach updated this revision to Diff 8550.Tue, Jun 18, 8:44 PM

Forgot a few lines in "Headquarters.js".

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|  54|  54| 		"armyMergeSize": 1400	// squared.
|  55|  55| 	};
|  56|  56| 
|  57|    |-	// Additional buildings that the AI does not yet know when to build 
|    |  57|+	// Additional buildings that the AI does not yet know when to build
|  58|  58| 	// and that it will try to build on phase 3 when enough resources.
|  59|  59| 	this.buildings =
|  60|  60| 	{

binaries/data/mods/public/simulation/ai/petra/config.js
| 265| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 312| 312| 			return undefined;
| 313| 313| 
| 314| 314| 		if (this.get("Attack/" + type + "/Bonuses"))
| 315|    |-		{
|    | 315|+		
| 316| 316| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 317| 317| 			{
| 318| 318| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 322| 322| 					if (bcl == againstClass)
| 323| 323| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 324| 324| 			}
| 325|    |-		}
|    | 325|+		
| 326| 326| 		return 1;
| 327| 327| 	},
| 328| 328| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 802| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 819| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 949| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 169| 169| 			plan.removeUnit(gameState, ent);
| 170| 170| 	}
| 171| 171| 
| 172|    |-/*
|    | 172|+	/*
| 173| 173| 	// TODO be sure that all units in the transport need the cancelation
| 174| 174| 	if (!ent.position())	// this unit must still be in a transport plan ... try to cancel it
| 175| 175| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 385| 385| {
| 386| 386| 	// copy over all parameters.
| 387| 387| 	for (let i in otherArmy.assignedAgainst)
| 388|    |-	{
|    | 388|+	
| 389| 389| 		if (this.assignedAgainst[i] === undefined)
| 390| 390| 			this.assignedAgainst[i] = otherArmy.assignedAgainst[i];
| 391| 391| 		else
| 392| 392| 			this.assignedAgainst[i] = this.assignedAgainst[i].concat(otherArmy.assignedAgainst[i]);
| 393|    |-	}
|    | 393|+	
| 394| 394| 	for (let i in otherArmy.assignedTo)
| 395| 395| 		this.assignedTo[i] = otherArmy.assignedTo[i];
| 396| 396| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 481| 481| 
| 482| 482| 	let entStrength;
| 483| 483| 	if (ent.hasClass("Structure"))
| 484|    |-	{
|    | 484|+	
| 485| 485| 		if (ent.owner() !== PlayerID)
| 486| 486| 			entStrength = ent.getDefaultArrow() ? 6*ent.getDefaultArrow() : 4;
| 487| 487| 		else	// small strength used only when we try to recover capture points
| 488| 488| 			entStrength = 2;
| 489|    |-	}
|    | 489|+	
| 490| 490| 	else
| 491| 491| 		entStrength = m.getMaxStrength(ent, damageTypeFactors);
| 492| 492| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 510| 510| 	// otherwise it would remove the old entity from this army list
| 511| 511| 	// TODO we should may-be reevaluate the strength
| 512| 512| 	for (let evt of events.EntityRenamed)	// take care of promoted and packed units
| 513|    |-	{
|    | 513|+	
| 514| 514| 		if (this.foeEntities.indexOf(evt.entity) !== -1)
| 515| 515| 		{
| 516| 516| 			let ent = gameState.getEntityById(evt.newentity);
| 538| 538| 					this.assignedAgainst[against][this.assignedAgainst[against].indexOf(evt.entity)] = evt.newentity;
| 539| 539| 			}
| 540| 540| 		}
| 541|    |-	}
|    | 541|+	
| 542| 542| 
| 543| 543| 	for (let evt of events.Garrison)
| 544| 544| 		this.removeFoe(gameState, evt.entity);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 544| 544| 		this.removeFoe(gameState, evt.entity);
| 545| 545| 
| 546| 546| 	for (let evt of events.OwnershipChanged)	// captured
| 547|    |-	{
|    | 547|+	
| 548| 548| 		if (!gameState.isPlayerEnemy(evt.to))
| 549| 549| 			this.removeFoe(gameState, evt.entity);
| 550| 550| 		else if (evt.from === PlayerID)
| 551| 551| 			this.removeOwn(gameState, evt.entity);
| 552|    |-	}
|    | 552|+	
| 553| 553| 
| 554| 554| 	for (let evt of events.Destroy)
| 555| 555| 	{

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 651| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [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
| 328| 328| 		if (!gameState.isPlayerEnemy(owner))
| 329| 329| 		{
| 330| 330| 			if (gameState.isPlayerMutualAlly(owner))
| 331|    |-			{
|    | 331|+			
| 332| 332| 				// update the number of enemies attacking this ally
| 333| 333| 				for (let id of army.foeEntities)
| 334| 334| 				{
| 343| 343| 					this.attackingArmies[enemy][owner] += 1;
| 344| 344| 					break;
| 345| 345| 				}
| 346|    |-			}
|    | 346|+			
| 347| 347| 			continue;
| 348| 348| 		}
| 349| 349| 		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
| 530| 530| 		army.checkEvents(gameState, events);
| 531| 531| 
| 532| 532| 	for (let evt of events.OwnershipChanged)   // capture events
| 533|    |-	{
|    | 533|+	
| 534| 534| 		if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0)
| 535| 535| 		{
| 536| 536| 			let ent = gameState.getEntityById(evt.entity);
| 537| 537| 			if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured
| 538| 538| 				gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 });
| 539| 539| 		}
| 540|    |-	}
|    | 540|+	
| 541| 541| 
| 542| 542| 	let allAttacked = {};
| 543| 543| 	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
| 552| 552| 		let attacker = gameState.getEntityById(evt.attacker);
| 553| 553| 		if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") &&
| 554| 554| 		   (!target.hasClass("Structure") || target.attackRange("Ranged")))
| 555|    |-		{
|    | 555|+		
| 556| 556| 			// If enemies are in range of one of our defensive structures, garrison it for arrow multiplier
| 557| 557| 			// (enemy non-defensive structure are not considered to stay in sync with garrisonManager)
| 558| 558| 			if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() &&
| 559| 559| 			    (target.owner() != 0 || !target.hasClass("Unit") ||
| 560| 560| 			     target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT"))
| 561| 561| 				this.garrisonUnitsInside(gameState, attacker, { "attacker": target });
| 562|    |-		}
|    | 562|+		
| 563| 563| 
| 564| 564| 		if (!gameState.isEntityOwn(target))
| 565| 565| 			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
| 957| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 312| 312| m.getHolder = function(gameState, ent)
| 313| 313| {
| 314| 314| 	for (let holder of gameState.getEntities().values())
| 315|    |-	{
|    | 315|+	
| 316| 316| 		if (holder.isGarrisonHolder() && holder.garrisoned().indexOf(ent.id()) !== -1)
| 317| 317| 			return holder;
| 318|    |-	}
|    | 318|+	
| 319| 319| 	return undefined;
| 320| 320| };
| 321| 321| 

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 428| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 393| 393| function getRepairTimeTooltip(entState)
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 396|+		"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 394| 394| {
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397|    |-			"details": entState.repairable.numBuilders
|    | 397|+		"details": entState.repairable.numBuilders
| 398| 398| 		}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 395| 395| 	return sprintf(translate("%(label)s %(details)s"), {
| 396| 396| 			"label": headerFont(translate("Number of repairers:")),
| 397| 397| 			"details": entState.repairable.numBuilders
| 398|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 398|+	}) + "\n" + (entState.repairable.numBuilders ?
| 399| 399| 		sprintf(translatePlural(
| 400| 400| 			"Add another worker to speed up the repairs by %(second)s second.",
| 401| 401| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getBuildTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of builders:")),
|    | 418|+		"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419|    |-			"details": entState.foundation.numBuilders
|    | 419|+		"details": entState.foundation.numBuilders
| 420| 420| 		}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of builders:")),
| 419| 419| 			"details": entState.foundation.numBuilders
| 420|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 420|+	}) + "\n" + (entState.foundation.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the construction by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [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], gameState.ai.Config.DamageTypeFactors) * 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
|2004|2004| 		nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|2005|2005| 
|2006|2006| 	if (!nAdvanced || nAdvanced < this.bAdvanced.length && this.getAccountedPopulation(gameState) > 110)
|2007|    |-	{
|    |2007|+	
|2008|2008| 		for (let advanced of this.bAdvanced)
|2009|2009| 		{
|2010|2010| 			if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|2019|2019| 				queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|2020|2020| 			return;
|2021|2021| 		}
|2022|    |-	}
|    |2022|+	
|2023|2023| };
|2024|2024| 
|2025|2025| /**
|    | [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
|2107|2107| 	// in which case we prefer melee units
|2108|2108| 	let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor);
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|    |-	{
|    |2110|+	
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|2112| 		{
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|2117| 		}
|2118|    |-	}
|    |2118|+	
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|2121|2121| 	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
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|2110| 	{
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|    |-		{
|    |2112|+		
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2114|2114| 				numGarrisoned += item.count;
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|    |-		}
|    |2117|+		
|2118|2118| 	}
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   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
|2149|2149| 	let cost = new API3.Resources(templateFound[1].cost());
|2150|2150| 	queueManager.setAccounts(gameState, cost, "emergency");
|2151|2151| 	if (!queueManager.canAfford("emergency", cost))
|2152|    |-	{
|    |2152|+	
|2153|2153| 		for (let q in queueManager.queues)
|2154|2154| 		{
|2155|2155| 			if (q == "emergency")
|2158|2158| 			if (queueManager.canAfford("emergency", cost))
|2159|2159| 				break;
|2160|2160| 		}
|2161|    |-	}
|    |2161|+	
|2162|2162| 	let metadata = { "role": "worker", "base": nearestAnchor.getMetadata(PlayerID, "base"), "plan": -1, "trainer": nearestAnchor.id() };
|2163|2163| 	if (autogarrison)
|2164|2164| 		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
|2439|2439| m.HQ.prototype.assignGatherers = function()
|2440|2440| {
|2441|2441| 	for (let base of this.baseManagers)
|2442|    |-	{
|    |2442|+	
|2443|2443| 		for (let worker of base.workers.values())
|2444|2444| 		{
|2445|2445| 			if (worker.unitAIState().split(".")[1] != "RETURNRESOURCE")
|2449|2449| 				continue;
|2450|2450| 			this.AddTCGatherer(orders[1].target);
|2451|2451| 		}
|2452|    |-	}
|    |2452|+	
|2453|2453| };
|2454|2454| 
|2455|2455| 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
|2621|2621| 	{
|2622|2622| 		let pop = gameState.getPopulation();
|2623|2623| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2624|    |-		{
|    |2624|+		
|2625|2625| 			for (let item of ent.trainingQueue())
|2626|2626| 			{
|2627|2627| 				if (!item.unitTemplate)
|2630|2630| 				if (unitPop)
|2631|2631| 					pop += item.count * unitPop;
|2632|2632| 			}
|2633|    |-		}
|    |2633|+		
|2634|2634| 		this.turnCache.accountedPopulation = pop;
|2635|2635| 	}
|2636|2636| 	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
|2645|2645| 	{
|2646|2646| 		let workers = gameState.getOwnEntitiesByRole("worker", true).length;
|2647|2647| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2648|    |-		{
|    |2648|+		
|2649|2649| 			for (let item of ent.trainingQueue())
|2650|2650| 			{
|2651|2651| 				if (!item.metadata || !item.metadata.role || item.metadata.role != "worker")
|2652|2652| 					continue;
|2653|2653| 				workers += item.count;
|2654|2654| 			}
|2655|    |-		}
|    |2655|+		
|2656|2656| 		this.turnCache.accountedWorkers = workers;
|2657|2657| 	}
|2658|2658| 	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
|2683|2683| 			this.phasing = 0;
|2684|2684| 	}
|2685|2685| 
|2686|    |-/*	if (this.Config.debug > 1)
|    |2686|+	/*	if (this.Config.debug > 1)
|2687|2687| 	{
|2688|2688| 		gameState.getOwnUnits().forEach (function (ent) {
|2689|2689| 			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
|2758|2758| 		this.currentBase %= this.baseManagers.length;
|2759|2759| 		activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
|2760|2760| 		--nbBases;
|2761|    |-// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|    |2761|+		// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|2762|2762| 	}
|2763|2763| 	while (!activeBase && nbBases != 0);
|2764|2764| 

binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2896| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

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.'.
Executing section cli...

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

Stan added inline comments.Tue, Jun 18, 10:00 PM
binaries/data/mods/public/globalscripts/Templates.js
169

Maybe you could write it as :

for (let damageType in template.Armour)
	if (damageType != "Foundation")
		ret.armour[damageType] = getEntityValue("Armour/" + damageType);
binaries/data/mods/public/gui/common/tooltips.js
239

Object.Keys(dmg) ?

binaries/data/mods/public/simulation/ai/common-api/entity.js
208

Same here:

for (let damageType in template.Armour)
	if (damageType != "Foundation")
		armour[damageType] = +this.get("Armour/" + damageType);
239

Maybe cache "Attack/" + type + "/Damage/" into a variable ? so it's not recomputed every time.

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
479

Do the factor change depending on the game state ? Else maybe instead of passing it everywhere it could be called directly here ?

binaries/data/mods/public/simulation/components/Armour.js
55–56

Shouldn't we check for cmpHealth ?

71

Why all the weird stuff with foundation, couldn't they add that in techs directly ?

83

Same here, invert condition, remove continue, remove braces :)

Freagarach added inline comments.Wed, Jun 19, 7:01 AM
binaries/data/mods/public/globalscripts/Templates.js
169

I thought I had that already (was probably lost in one of many reverts ;) ).

binaries/data/mods/public/gui/common/tooltips.js
239

So logical :)

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
479

No they don't.
Well, I tried calling it in the "m.getMaxStrength" directly, but I couldn't get that working.

Freagarach marked 7 inline comments as done.Wed, Jun 19, 7:35 AM
Freagarach added inline comments.
binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
479

Oh, I understand, you mean calling it in "evaluateStrength", well we need the gamestate for that so we then need to pass the gamestate instead of DTFs. I thought that passing as little data as possible would be beneficial.

Freagarach updated this revision to Diff 8552.Wed, Jun 19, 7:36 AM
  • Simplified armour checks.
  • Taught AI where to look for armour.
  • dTTT in "Tooltips.js".
  • Some "var" to "let".

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-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 230| 230| 	},
| 231| 231| 
| 232| 232| 	"attackStrengths": function(type) {
| 233|    |-		let path = "Attack/" + type +"/Damage"
|    | 233|+		let path = "Attack/" + type +"/Damage";
| 234| 234| 		if (!this.get(path))
| 235| 235| 			return undefined;
| 236| 236| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 310| 310| 			return undefined;
| 311| 311| 
| 312| 312| 		if (this.get("Attack/" + type + "/Bonuses"))
| 313|    |-		{
|    | 313|+		
| 314| 314| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 315| 315| 			{
| 316| 316| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 320| 320| 					if (bcl == againstClass)
| 321| 321| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 322| 322| 			}
| 323|    |-		}
|    | 323|+		
| 324| 324| 		return 1;
| 325| 325| 	},
| 326| 326| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 800| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 817| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 947| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 233| »   »   let·path·=·"Attack/"·+·type·+"/Damage"
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
| 328| 328| 		if (!gameState.isPlayerEnemy(owner))
| 329| 329| 		{
| 330| 330| 			if (gameState.isPlayerMutualAlly(owner))
| 331|    |-			{
|    | 331|+			
| 332| 332| 				// update the number of enemies attacking this ally
| 333| 333| 				for (let id of army.foeEntities)
| 334| 334| 				{
| 343| 343| 					this.attackingArmies[enemy][owner] += 1;
| 344| 344| 					break;
| 345| 345| 				}
| 346|    |-			}
|    | 346|+			
| 347| 347| 			continue;
| 348| 348| 		}
| 349| 349| 		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
| 530| 530| 		army.checkEvents(gameState, events);
| 531| 531| 
| 532| 532| 	for (let evt of events.OwnershipChanged)   // capture events
| 533|    |-	{
|    | 533|+	
| 534| 534| 		if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0)
| 535| 535| 		{
| 536| 536| 			let ent = gameState.getEntityById(evt.entity);
| 537| 537| 			if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured
| 538| 538| 				gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 });
| 539| 539| 		}
| 540|    |-	}
|    | 540|+	
| 541| 541| 
| 542| 542| 	let allAttacked = {};
| 543| 543| 	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
| 552| 552| 		let attacker = gameState.getEntityById(evt.attacker);
| 553| 553| 		if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") &&
| 554| 554| 		   (!target.hasClass("Structure") || target.attackRange("Ranged")))
| 555|    |-		{
|    | 555|+		
| 556| 556| 			// If enemies are in range of one of our defensive structures, garrison it for arrow multiplier
| 557| 557| 			// (enemy non-defensive structure are not considered to stay in sync with garrisonManager)
| 558| 558| 			if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() &&
| 559| 559| 			    (target.owner() != 0 || !target.hasClass("Unit") ||
| 560| 560| 			     target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT"))
| 561| 561| 				this.garrisonUnitsInside(gameState, attacker, { "attacker": target });
| 562|    |-		}
|    | 562|+		
| 563| 563| 
| 564| 564| 		if (!gameState.isEntityOwn(target))
| 565| 565| 			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
| 957| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 389| 389| function getRepairTimeTooltip(entState)
| 390| 390| {
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 392|+		"label": headerFont(translate("Number of repairers:")),
| 393| 393| 			"details": entState.repairable.numBuilders
| 394| 394| 		}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 390| 390| {
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392| 392| 			"label": headerFont(translate("Number of repairers:")),
| 393|    |-			"details": entState.repairable.numBuilders
|    | 393|+		"details": entState.repairable.numBuilders
| 394| 394| 		}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
| 396| 396| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392| 392| 			"label": headerFont(translate("Number of repairers:")),
| 393| 393| 			"details": entState.repairable.numBuilders
| 394|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 394|+	}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
| 396| 396| 			"Add another worker to speed up the repairs by %(second)s second.",
| 397| 397| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 411| 411| function getBuildTimeTooltip(entState)
| 412| 412| {
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414|    |-			"label": headerFont(translate("Number of builders:")),
|    | 414|+		"label": headerFont(translate("Number of builders:")),
| 415| 415| 			"details": entState.foundation.numBuilders
| 416| 416| 		}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 412| 412| {
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414| 414| 			"label": headerFont(translate("Number of builders:")),
| 415|    |-			"details": entState.foundation.numBuilders
|    | 415|+		"details": entState.foundation.numBuilders
| 416| 416| 		}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
| 418| 418| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414| 414| 			"label": headerFont(translate("Number of builders:")),
| 415| 415| 			"details": entState.foundation.numBuilders
| 416|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 416|+	}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
| 418| 418| 			"Add another worker to speed up the construction by %(second)s second.",
| 419| 419| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Armour.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Armour.js
|  56|  56| 	let cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
|  57|  57| 	if (cmpHealth)
|  58|  58| 		return cmpHealth.Reduce(total);
|  59|    |-	else
|  60|    |-		return { "killed": false, "change": 0 };
|    |  59|+	return { "killed": false, "change": 0 };
|  61|  60| };
|  62|  61| 
|  63|  62| Armour.prototype.GetArmourStrengths = function()

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|  54|  54| 		"armyMergeSize": 1400	// squared.
|  55|  55| 	};
|  56|  56| 
|  57|    |-	// Additional buildings that the AI does not yet know when to build 
|    |  57|+	// Additional buildings that the AI does not yet know when to build
|  58|  58| 	// and that it will try to build on phase 3 when enough resources.
|  59|  59| 	this.buildings =
|  60|  60| 	{

binaries/data/mods/public/simulation/ai/petra/config.js
| 265| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [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], gameState.ai.Config.DamageTypeFactors) * 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
|2004|2004| 		nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|2005|2005| 
|2006|2006| 	if (!nAdvanced || nAdvanced < this.bAdvanced.length && this.getAccountedPopulation(gameState) > 110)
|2007|    |-	{
|    |2007|+	
|2008|2008| 		for (let advanced of this.bAdvanced)
|2009|2009| 		{
|2010|2010| 			if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|2019|2019| 				queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|2020|2020| 			return;
|2021|2021| 		}
|2022|    |-	}
|    |2022|+	
|2023|2023| };
|2024|2024| 
|2025|2025| /**
|    | [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
|2107|2107| 	// in which case we prefer melee units
|2108|2108| 	let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor);
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|    |-	{
|    |2110|+	
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|2112| 		{
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|2117| 		}
|2118|    |-	}
|    |2118|+	
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|2121|2121| 	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
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|2110| 	{
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|    |-		{
|    |2112|+		
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2114|2114| 				numGarrisoned += item.count;
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|    |-		}
|    |2117|+		
|2118|2118| 	}
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   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
|2149|2149| 	let cost = new API3.Resources(templateFound[1].cost());
|2150|2150| 	queueManager.setAccounts(gameState, cost, "emergency");
|2151|2151| 	if (!queueManager.canAfford("emergency", cost))
|2152|    |-	{
|    |2152|+	
|2153|2153| 		for (let q in queueManager.queues)
|2154|2154| 		{
|2155|2155| 			if (q == "emergency")
|2158|2158| 			if (queueManager.canAfford("emergency", cost))
|2159|2159| 				break;
|2160|2160| 		}
|2161|    |-	}
|    |2161|+	
|2162|2162| 	let metadata = { "role": "worker", "base": nearestAnchor.getMetadata(PlayerID, "base"), "plan": -1, "trainer": nearestAnchor.id() };
|2163|2163| 	if (autogarrison)
|2164|2164| 		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
|2439|2439| m.HQ.prototype.assignGatherers = function()
|2440|2440| {
|2441|2441| 	for (let base of this.baseManagers)
|2442|    |-	{
|    |2442|+	
|2443|2443| 		for (let worker of base.workers.values())
|2444|2444| 		{
|2445|2445| 			if (worker.unitAIState().split(".")[1] != "RETURNRESOURCE")
|2449|2449| 				continue;
|2450|2450| 			this.AddTCGatherer(orders[1].target);
|2451|2451| 		}
|2452|    |-	}
|    |2452|+	
|2453|2453| };
|2454|2454| 
|2455|2455| 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
|2621|2621| 	{
|2622|2622| 		let pop = gameState.getPopulation();
|2623|2623| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2624|    |-		{
|    |2624|+		
|2625|2625| 			for (let item of ent.trainingQueue())
|2626|2626| 			{
|2627|2627| 				if (!item.unitTemplate)
|2630|2630| 				if (unitPop)
|2631|2631| 					pop += item.count * unitPop;
|2632|2632| 			}
|2633|    |-		}
|    |2633|+		
|2634|2634| 		this.turnCache.accountedPopulation = pop;
|2635|2635| 	}
|2636|2636| 	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
|2645|2645| 	{
|2646|2646| 		let workers = gameState.getOwnEntitiesByRole("worker", true).length;
|2647|2647| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2648|    |-		{
|    |2648|+		
|2649|2649| 			for (let item of ent.trainingQueue())
|2650|2650| 			{
|2651|2651| 				if (!item.metadata || !item.metadata.role || item.metadata.role != "worker")
|2652|2652| 					continue;
|2653|2653| 				workers += item.count;
|2654|2654| 			}
|2655|    |-		}
|    |2655|+		
|2656|2656| 		this.turnCache.accountedWorkers = workers;
|2657|2657| 	}
|2658|2658| 	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
|2683|2683| 			this.phasing = 0;
|2684|2684| 	}
|2685|2685| 
|2686|    |-/*	if (this.Config.debug > 1)
|    |2686|+	/*	if (this.Config.debug > 1)
|2687|2687| 	{
|2688|2688| 		gameState.getOwnUnits().forEach (function (ent) {
|2689|2689| 			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
|2758|2758| 		this.currentBase %= this.baseManagers.length;
|2759|2759| 		activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
|2760|2760| 		--nbBases;
|2761|    |-// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|    |2761|+		// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|2762|2762| 	}
|2763|2763| 	while (!activeBase && nbBases != 0);
|2764|2764| 

binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2896| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

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.'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 169| 169| 			plan.removeUnit(gameState, ent);
| 170| 170| 	}
| 171| 171| 
| 172|    |-/*
|    | 172|+	/*
| 173| 173| 	// TODO be sure that all units in the transport need the cancelation
| 174| 174| 	if (!ent.position())	// this unit must still be in a transport plan ... try to cancel it
| 175| 175| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 385| 385| {
| 386| 386| 	// copy over all parameters.
| 387| 387| 	for (let i in otherArmy.assignedAgainst)
| 388|    |-	{
|    | 388|+	
| 389| 389| 		if (this.assignedAgainst[i] === undefined)
| 390| 390| 			this.assignedAgainst[i] = otherArmy.assignedAgainst[i];
| 391| 391| 		else
| 392| 392| 			this.assignedAgainst[i] = this.assignedAgainst[i].concat(otherArmy.assignedAgainst[i]);
| 393|    |-	}
|    | 393|+	
| 394| 394| 	for (let i in otherArmy.assignedTo)
| 395| 395| 		this.assignedTo[i] = otherArmy.assignedTo[i];
| 396| 396| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 481| 481| 
| 482| 482| 	let entStrength;
| 483| 483| 	if (ent.hasClass("Structure"))
| 484|    |-	{
|    | 484|+	
| 485| 485| 		if (ent.owner() !== PlayerID)
| 486| 486| 			entStrength = ent.getDefaultArrow() ? 6*ent.getDefaultArrow() : 4;
| 487| 487| 		else	// small strength used only when we try to recover capture points
| 488| 488| 			entStrength = 2;
| 489|    |-	}
|    | 489|+	
| 490| 490| 	else
| 491| 491| 		entStrength = m.getMaxStrength(ent, damageTypeFactors);
| 492| 492| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 510| 510| 	// otherwise it would remove the old entity from this army list
| 511| 511| 	// TODO we should may-be reevaluate the strength
| 512| 512| 	for (let evt of events.EntityRenamed)	// take care of promoted and packed units
| 513|    |-	{
|    | 513|+	
| 514| 514| 		if (this.foeEntities.indexOf(evt.entity) !== -1)
| 515| 515| 		{
| 516| 516| 			let ent = gameState.getEntityById(evt.newentity);
| 538| 538| 					this.assignedAgainst[against][this.assignedAgainst[against].indexOf(evt.entity)] = evt.newentity;
| 539| 539| 			}
| 540| 540| 		}
| 541|    |-	}
|    | 541|+	
| 542| 542| 
| 543| 543| 	for (let evt of events.Garrison)
| 544| 544| 		this.removeFoe(gameState, evt.entity);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 544| 544| 		this.removeFoe(gameState, evt.entity);
| 545| 545| 
| 546| 546| 	for (let evt of events.OwnershipChanged)	// captured
| 547|    |-	{
|    | 547|+	
| 548| 548| 		if (!gameState.isPlayerEnemy(evt.to))
| 549| 549| 			this.removeFoe(gameState, evt.entity);
| 550| 550| 		else if (evt.from === PlayerID)
| 551| 551| 			this.removeOwn(gameState, evt.entity);
| 552|    |-	}
|    | 552|+	
| 553| 553| 
| 554| 554| 	for (let evt of events.Destroy)
| 555| 555| 	{

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 651| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 302| 302| m.getHolder = function(gameState, ent)
| 303| 303| {
| 304| 304| 	for (let holder of gameState.getEntities().values())
| 305|    |-	{
|    | 305|+	
| 306| 306| 		if (holder.isGarrisonHolder() && holder.garrisoned().indexOf(ent.id()) !== -1)
| 307| 307| 			return holder;
| 308|    |-	}
|    | 308|+	
| 309| 309| 	return undefined;
| 310| 310| };
| 311| 311| 

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  30| »   »   »   damageTypeFactors[str]·?·strength·+=·damageTypeFactors[str]·*·val·/·damageTypes.length·:
|    | [NORMAL] ESLintBear (no-unused-expressions):
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  60| »   »   damageTypeFactors[str]·?·strength·+=·damageTypeFactors[str]·*·val·/·damageTypes.length·:
|    | [NORMAL] ESLintBear (no-unused-expressions):
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 418| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  31| »   »   »   »   API3.warn("Petra:·"·+·str·+·"·unknown·attackStrength·in·getMaxStrength·(please·add·"·+·str·+·"··to·config.js).");
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  61| »   »   »   API3.warn("Petra:·"·+·str·+·"·unknown·armourStrength·in·getMaxStrength·(please·add·"·+·str·+·"··to·config.js).");
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.
Executing section cli...

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

Angen added a comment.EditedWed, Jun 19, 7:44 AM

some comments

Edit: check constructor for this. Config, not init

binaries/data/mods/public/simulation/ai/common-api/entity.js
233–234

This will not work at line 239, because missing / at the end

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
68

use this.Config.DamageType...

binaries/data/mods/public/simulation/ai/petra/defenseManager.js
490

same here, for future, check init function for this.Config = config

Freagarach updated this revision to Diff 8554.Wed, Jun 19, 8:09 AM
Freagarach marked 3 inline comments as done.
  • this.Config.DamageTypeFactors.
  • Added missing "/".

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Armour.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Armour.js
|  56|  56| 	let cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
|  57|  57| 	if (cmpHealth)
|  58|  58| 		return cmpHealth.Reduce(total);
|  59|    |-	else
|  60|    |-		return { "killed": false, "change": 0 };
|    |  59|+	return { "killed": false, "change": 0 };
|  61|  60| };
|  62|  61| 
|  63|  62| Armour.prototype.GetArmourStrengths = function()
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 169| 169| 			plan.removeUnit(gameState, ent);
| 170| 170| 	}
| 171| 171| 
| 172|    |-/*
|    | 172|+	/*
| 173| 173| 	// TODO be sure that all units in the transport need the cancelation
| 174| 174| 	if (!ent.position())	// this unit must still be in a transport plan ... try to cancel it
| 175| 175| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 385| 385| {
| 386| 386| 	// copy over all parameters.
| 387| 387| 	for (let i in otherArmy.assignedAgainst)
| 388|    |-	{
|    | 388|+	
| 389| 389| 		if (this.assignedAgainst[i] === undefined)
| 390| 390| 			this.assignedAgainst[i] = otherArmy.assignedAgainst[i];
| 391| 391| 		else
| 392| 392| 			this.assignedAgainst[i] = this.assignedAgainst[i].concat(otherArmy.assignedAgainst[i]);
| 393|    |-	}
|    | 393|+	
| 394| 394| 	for (let i in otherArmy.assignedTo)
| 395| 395| 		this.assignedTo[i] = otherArmy.assignedTo[i];
| 396| 396| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 481| 481| 
| 482| 482| 	let entStrength;
| 483| 483| 	if (ent.hasClass("Structure"))
| 484|    |-	{
|    | 484|+	
| 485| 485| 		if (ent.owner() !== PlayerID)
| 486| 486| 			entStrength = ent.getDefaultArrow() ? 6*ent.getDefaultArrow() : 4;
| 487| 487| 		else	// small strength used only when we try to recover capture points
| 488| 488| 			entStrength = 2;
| 489|    |-	}
|    | 489|+	
| 490| 490| 	else
| 491| 491| 		entStrength = m.getMaxStrength(ent, this.Config.DamageTypeFactors);
| 492| 492| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 510| 510| 	// otherwise it would remove the old entity from this army list
| 511| 511| 	// TODO we should may-be reevaluate the strength
| 512| 512| 	for (let evt of events.EntityRenamed)	// take care of promoted and packed units
| 513|    |-	{
|    | 513|+	
| 514| 514| 		if (this.foeEntities.indexOf(evt.entity) !== -1)
| 515| 515| 		{
| 516| 516| 			let ent = gameState.getEntityById(evt.newentity);
| 538| 538| 					this.assignedAgainst[against][this.assignedAgainst[against].indexOf(evt.entity)] = evt.newentity;
| 539| 539| 			}
| 540| 540| 		}
| 541|    |-	}
|    | 541|+	
| 542| 542| 
| 543| 543| 	for (let evt of events.Garrison)
| 544| 544| 		this.removeFoe(gameState, evt.entity);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 544| 544| 		this.removeFoe(gameState, evt.entity);
| 545| 545| 
| 546| 546| 	for (let evt of events.OwnershipChanged)	// captured
| 547|    |-	{
|    | 547|+	
| 548| 548| 		if (!gameState.isPlayerEnemy(evt.to))
| 549| 549| 			this.removeFoe(gameState, evt.entity);
| 550| 550| 		else if (evt.from === PlayerID)
| 551| 551| 			this.removeOwn(gameState, evt.entity);
| 552|    |-	}
|    | 552|+	
| 553| 553| 
| 554| 554| 	for (let evt of events.Destroy)
| 555| 555| 	{

binaries/data/mods/public/simulation/ai/petra/defenseArmy.js
| 651| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 109| 109| 			if (j + 1 < oldWall.length &&
| 110| 110| 				fillTowersBetween.indexOf(oldWall[j]) != -1 &&
| 111| 111| 				fillTowersBetween.indexOf(oldWall[j + 1]) != -1)
| 112|    |-			{
|    | 112|+			
| 113| 113| 				defaultFortresses[newKey].wall.push("tower");
| 114|    |-			}
|    | 114|+			
| 115| 115| 		}
| 116| 116| 	}
| 117| 117| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 623| 623| 	{
| 624| 624| 		let wallEle = getWallElement(wallPart[0], style);
| 625| 625| 		let addAngle = scaleFactor * wallEle.length / radius;
| 626|    |-		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle))
|    | 626|+		let target = Vector2D.add(center, new Vector2D(radius, 0).rotate(-actualAngle - addAngle));
| 627| 627| 		let place = Vector2D.average([position, target]);
| 628| 628| 		let placeAngle = actualAngle + addAngle / 2;
| 629| 629| 		if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
|  85| »   let·addFortress·=·(type,·walls)·=>·defaultFortresses[type]·=·{·"wall":·walls.concat(walls,·walls,·walls)·};
|    | [NORMAL] ESLintBear (no-return-assign):
|    | Arrow function should not return assignment.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 410| function·placeWall(position,·wall·=·[],·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 464| function·placeFortress(centerPosition,·type·=·"medium",·style,·playerId·=·0,·orientation·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 481| function·placeLinearWall(startPosition,·targetPosition,·wallPart·=·undefined,·style,·playerId·=·0,·endWithFirst·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 565| function·placeCircularWall(center,·radius,·wallPart,·style,·playerId·=·0,·orientation·=·0,·maxAngle·=·2·*·Math.PI,·endWithFirst,·maxBendOff·=·0,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 626| »   »   let·target·=·Vector2D.add(center,·new·Vector2D(radius,·0).rotate(-actualAngle·-·addAngle))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 652| function·placePolygonalWall(centerPosition,·radius,·wallPart,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners·=·8,·skipFirstWall·=·true,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 714| function·placeIrregularPolygonalWall(centerPosition,·radius,·cornerWallElement·=·"tower",·style,·playerId·=·0,·orientation·=·0,·numCorners,·irregularity·=·0.5,·skipFirstWall·=·false,·wallPartsAssortment·=·undefined,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.

binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
| 849| function·placeGenericFortress(center,·radius·=·20,·playerId·=·0,·style,·irregularity·=·0.5,·gateOccurence·=·3,·maxTries·=·100,·constraints·=·undefined)
|    | [NORMAL] JSHintBear:
|    | Regular parameters should not come after default parameters.
|    | [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
| 328| 328| 		if (!gameState.isPlayerEnemy(owner))
| 329| 329| 		{
| 330| 330| 			if (gameState.isPlayerMutualAlly(owner))
| 331|    |-			{
|    | 331|+			
| 332| 332| 				// update the number of enemies attacking this ally
| 333| 333| 				for (let id of army.foeEntities)
| 334| 334| 				{
| 343| 343| 					this.attackingArmies[enemy][owner] += 1;
| 344| 344| 					break;
| 345| 345| 				}
| 346|    |-			}
|    | 346|+			
| 347| 347| 			continue;
| 348| 348| 		}
| 349| 349| 		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
| 530| 530| 		army.checkEvents(gameState, events);
| 531| 531| 
| 532| 532| 	for (let evt of events.OwnershipChanged)   // capture events
| 533|    |-	{
|    | 533|+	
| 534| 534| 		if (gameState.isPlayerMutualAlly(evt.from) && evt.to > 0)
| 535| 535| 		{
| 536| 536| 			let ent = gameState.getEntityById(evt.entity);
| 537| 537| 			if (ent && ent.hasClass("CivCentre")) // one of our cc has been captured
| 538| 538| 				gameState.ai.HQ.attackManager.switchDefenseToAttack(gameState, ent, { "range": 150 });
| 539| 539| 		}
| 540|    |-	}
|    | 540|+	
| 541| 541| 
| 542| 542| 	let allAttacked = {};
| 543| 543| 	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
| 552| 552| 		let attacker = gameState.getEntityById(evt.attacker);
| 553| 553| 		if (attacker && gameState.isEntityOwn(attacker) && gameState.isEntityEnemy(target) && !attacker.hasClass("Ship") &&
| 554| 554| 		   (!target.hasClass("Structure") || target.attackRange("Ranged")))
| 555|    |-		{
|    | 555|+		
| 556| 556| 			// If enemies are in range of one of our defensive structures, garrison it for arrow multiplier
| 557| 557| 			// (enemy non-defensive structure are not considered to stay in sync with garrisonManager)
| 558| 558| 			if (attacker.position() && attacker.isGarrisonHolder() && attacker.getArrowMultiplier() &&
| 559| 559| 			    (target.owner() != 0 || !target.hasClass("Unit") ||
| 560| 560| 			     target.unitAIState() && target.unitAIState().split(".")[1] == "COMBAT"))
| 561| 561| 				this.garrisonUnitsInside(gameState, attacker, { "attacker": target });
| 562|    |-		}
|    | 562|+		
| 563| 563| 
| 564| 564| 		if (!gameState.isEntityOwn(target))
| 565| 565| 			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
| 957| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/config.js
|  54|  54| 		"armyMergeSize": 1400	// squared.
|  55|  55| 	};
|  56|  56| 
|  57|    |-	// Additional buildings that the AI does not yet know when to build 
|    |  57|+	// Additional buildings that the AI does not yet know when to build
|  58|  58| 	// and that it will try to build on phase 3 when enough resources.
|  59|  59| 	this.buildings =
|  60|  60| 	{

binaries/data/mods/public/simulation/ai/petra/config.js
| 265| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js
|  87|  87| 		// If the elements are still strings, split them by space or by '+'
|  88|  88| 		if (typeof sublist == "string")
|  89|  89| 			sublist = sublist.split(/[+\s]+/);
|  90|    |-		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1)
|  91|    |-		                    || (c[0] != "!" && classes.indexOf(c) != -1)))
|    |  90|+		if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) ||
|    |  91|+		                    (c[0] != "!" && classes.indexOf(c) != -1)))
|  92|  92| 			return true;
|  93|  93| 	}
|  94|  94| 

binaries/data/mods/public/globalscripts/Templates.js
|  91| »   »   ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|  33|  33| 		{
|  34|  34| 			let args = string.split("/");
|  35|  35| 			for (let arg of args)
|  36|    |-			{
|    |  36|+			
|  37|  37| 				if (value[arg])
|  38|  38| 					value = value[arg];
|  39|  39| 				else
|  41|  41| 					value = undefined;
|  42|  42| 					break;
|  43|  43| 				}
|  44|    |-			}
|    |  44|+			
|  45|  45| 			this._tpCache.set(string, value);
|  46|  46| 		}
|  47|  47| 		return this._tpCache.get(string);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 230| 230| 	},
| 231| 231| 
| 232| 232| 	"attackStrengths": function(type) {
| 233|    |-		let path = "Attack/" + type +"/Damage/"
|    | 233|+		let path = "Attack/" + type +"/Damage/";
| 234| 234| 		if (!this.get(path))
| 235| 235| 			return undefined;
| 236| 236| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js
| 310| 310| 			return undefined;
| 311| 311| 
| 312| 312| 		if (this.get("Attack/" + type + "/Bonuses"))
| 313|    |-		{
|    | 313|+		
| 314| 314| 			for (let b in this.get("Attack/" + type + "/Bonuses"))
| 315| 315| 			{
| 316| 316| 				let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes");
| 320| 320| 					if (bcl == againstClass)
| 321| 321| 						return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier");
| 322| 322| 			}
| 323|    |-		}
|    | 323|+		
| 324| 324| 		return 1;
| 325| 325| 	},
| 326| 326| 

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 800| »   »   if·(this.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 817| »   »   if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 947| }(API3);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'API3' was used before it was defined.

binaries/data/mods/public/simulation/ai/common-api/entity.js
| 233| »   »   let·path·=·"Attack/"·+·type·+"/Damage/"
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/tests/test_UpgradeModification.js
| 100| »   "ApplyModificationsTemplate":·(valueName,·curValue,·template)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 302| 302| m.getHolder = function(gameState, ent)
| 303| 303| {
| 304| 304| 	for (let holder of gameState.getEntities().values())
| 305|    |-	{
|    | 305|+	
| 306| 306| 		if (holder.isGarrisonHolder() && holder.garrisoned().indexOf(ent.id()) !== -1)
| 307| 307| 			return holder;
| 308|    |-	}
|    | 308|+	
| 309| 309| 	return undefined;
| 310| 310| };
| 311| 311| 

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  30| »   »   »   damageTypeFactors[str]·?·strength·+=·damageTypeFactors[str]·*·val·/·damageTypes.length·:
|    | [NORMAL] ESLintBear (no-unused-expressions):
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  60| »   »   damageTypeFactors[str]·?·strength·+=·damageTypeFactors[str]·*·val·/·damageTypes.length·:
|    | [NORMAL] ESLintBear (no-unused-expressions):
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
| 418| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  31| »   »   »   »   API3.warn("Petra:·"·+·str·+·"·unknown·attackStrength·in·getMaxStrength·(please·add·"·+·str·+·"··to·config.js).");
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/ai/petra/entityExtend.js
|  61| »   »   »   API3.warn("Petra:·"·+·str·+·"·unknown·armourStrength·in·getMaxStrength·(please·add·"·+·str·+·"··to·config.js).");
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 524| 524| 
| 525| 525| 		let horizSpeed = +this.template[type].Projectile.Speed;
| 526| 526| 		let gravity = +this.template[type].Projectile.Gravity;
| 527|    |-		//horizSpeed /= 2; gravity /= 2; // slow it down for testing
|    | 527|+		// horizSpeed /= 2; gravity /= 2; // slow it down for testing
| 528| 528| 
| 529| 529| 		let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 530| 530| 		if (!cmpPosition || !cmpPosition.IsInWorld())
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 571| 571| 		// TODO: Use unit rotation to implement x/z offsets.
| 572| 572| 		let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0);
| 573| 573| 		let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint);
| 574|    |-		
|    | 574|+
| 575| 575| 		let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 576| 576| 		if (cmpVisual)
| 577| 577| 		{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js
| 643| 643| 			});
| 644| 644| 	}
| 645| 645| 	else
| 646|    |-	{
|    | 646|+	
| 647| 647| 		// Melee attack - hurt the target immediately
| 648| 648| 		cmpDamage.CauseDamage({
| 649| 649| 			"strengths": this.GetAttackStrengths(type),
| 653| 653| 			"type": type,
| 654| 654| 			"attackerOwner": attackerOwner
| 655| 655| 		});
| 656|    |-	}
|    | 656|+	
| 657| 657| };
| 658| 658| 
| 659| 659| /**

binaries/data/mods/public/simulation/components/Attack.js
| 514| ·»   let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/components/Attack.js
| 618| »   »   cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data);
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (space-unary-ops):
|    | Unexpected space after unary operator '-'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  30|  30|  * Constants needed for heightmap_manipulation.js
|  31|  31|  */
|  32|  32| const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE; // Engine limit, Roughly 700 meters
|  33|    |-const MIN_HEIGHT = - SEA_LEVEL;
|    |  33|+const MIN_HEIGHT = -SEA_LEVEL;
|  34|  34| 
|  35|  35| /**
|  36|  36|  * Length of one tile of the terrain grid in metres.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  66|  66| 	let obstructionSize =
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|    |-		// Used for gates, should consider the position too
|    |  69|+			// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  67|  67| 		obstruction.Static ?
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|    |-		obstruction.Obstructions ?
|    |  70|+			obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  68|  68| 			new Vector2D(obstruction.Static["@depth"], obstruction.Static["@width"]) :
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|    |-			new Vector2D(
|    |  71|+				new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  69|  69| 		// Used for gates, should consider the position too
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|    |-				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|    |  72|+					Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  70|  70| 		obstruction.Obstructions ?
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|    |-				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|    |  73|+					Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|  74| 			new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|  71|  71| 			new Vector2D(
|  72|  72| 				Object.keys(obstruction.Obstructions).reduce((depth, key) => Math.max(depth, +obstruction.Obstructions[key]["@depth"]), 0),
|  73|  73| 				Object.keys(obstruction.Obstructions).reduce((width, key) => width + +obstruction.Obstructions[key]["@width"], 0)) :
|  74|    |-			new Vector2D(0, 0);
|    |  74|+				new Vector2D(0, 0);
|  75|  75| 
|  76|  76| 	return obstructionSize.div(TERRAIN_TILE_SIZE).add(new Vector2D(2, 2).mult(margin));
|  77|  77| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 247| 247| /**
| 248| 248|  * Create an avoid constraint for the given classes by the given distances
| 249| 249|  */
| 250|    |-function avoidClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 250|+function avoidClasses(/* class1, dist1, class2, dist2, etc*/)
| 251| 251| {
| 252| 252| 	let ar = [];
| 253| 253| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 263| 263| /**
| 264| 264|  * Create a stay constraint for the given classes by the given distances
| 265| 265|  */
| 266|    |-function stayClasses(/*class1, dist1, class2, dist2, etc*/)
|    | 266|+function stayClasses(/* class1, dist1, class2, dist2, etc*/)
| 267| 267| {
| 268| 268| 	let ar = [];
| 269| 269| 	for (let i = 0; i < arguments.length/2; ++i)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '/*' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/rmgen/library.js
| 279| 279| /**
| 280| 280|  * Create a border constraint for the given classes by the given distances
| 281| 281|  */
| 282|    |-function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/)
|    | 282|+function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc*/)
| 283| 283| {
| 284| 284| 	let ar = [];
| 285| 285| 	for (let i = 0; i < arguments.length/3; ++i)

binaries/data/mods/public/maps/random/rmgen/library.js
|  73| »   »   »   »   Object.keys(obstruction.Obstructions).reduce((width,·key)·=>·width·+·+obstruction.Obstructions[key]["@width"],·0))·:
|    | [NORMAL] JSHintBear:
|    | Confusing plusses.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 389| 389| function getRepairTimeTooltip(entState)
| 390| 390| {
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 392|+		"label": headerFont(translate("Number of repairers:")),
| 393| 393| 			"details": entState.repairable.numBuilders
| 394| 394| 		}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 390| 390| {
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392| 392| 			"label": headerFont(translate("Number of repairers:")),
| 393|    |-			"details": entState.repairable.numBuilders
|    | 393|+		"details": entState.repairable.numBuilders
| 394| 394| 		}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
| 396| 396| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 391| 391| 	return sprintf(translate("%(label)s %(details)s"), {
| 392| 392| 			"label": headerFont(translate("Number of repairers:")),
| 393| 393| 			"details": entState.repairable.numBuilders
| 394|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 394|+	}) + "\n" + (entState.repairable.numBuilders ?
| 395| 395| 		sprintf(translatePlural(
| 396| 396| 			"Add another worker to speed up the repairs by %(second)s second.",
| 397| 397| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 411| 411| function getBuildTimeTooltip(entState)
| 412| 412| {
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414|    |-			"label": headerFont(translate("Number of builders:")),
|    | 414|+		"label": headerFont(translate("Number of builders:")),
| 415| 415| 			"details": entState.foundation.numBuilders
| 416| 416| 		}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 412| 412| {
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414| 414| 			"label": headerFont(translate("Number of builders:")),
| 415|    |-			"details": entState.foundation.numBuilders
|    | 415|+		"details": entState.foundation.numBuilders
| 416| 416| 		}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
| 418| 418| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js
| 413| 413| 	return sprintf(translate("%(label)s %(details)s"), {
| 414| 414| 			"label": headerFont(translate("Number of builders:")),
| 415| 415| 			"details": entState.foundation.numBuilders
| 416|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 416|+	}) + "\n" + (entState.foundation.numBuilders ?
| 417| 417| 		sprintf(translatePlural(
| 418| 418| 			"Add another worker to speed up the construction by %(second)s second.",
| 419| 419| 			"Add another worker to speed up the construction by %(second)s seconds.",
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|  66|  66| 		let phase = "";
|  67|  67| 		let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager);
|  68|  68| 		if (cmpTechnologyManager)
|  69|    |-		{
|    |  69|+		
|  70|  70| 			if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|  71|  71| 				phase = "city";
|  72|  72| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|  73|  73| 				phase = "town";
|  74|  74| 			else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|  75|  75| 				phase = "village";
|  76|    |-		}
|    |  76|+		
|  77|  77| 
|  78|  78| 		// store player ally/neutral/enemy data as arrays
|  79|  79| 		let allies = [];
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 415| 415| 			ret.attack[type].elevationBonus = range.elevationBonus;
| 416| 416| 
| 417| 417| 			if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld())
| 418|    |-			{
|    | 418|+			
| 419| 419| 				// For units, take the range in front of it, no spread. So angle = 0
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421|    |-			}
|    | 421|+			
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423| 423| 			{
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 420| 420| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0);
| 421| 421| 			}
| 422| 422| 			else if(cmpPosition && cmpPosition.IsInWorld())
| 423|    |-			{
|    | 423|+			
| 424| 424| 				// For buildings, take the average elevation around it. So angle = 2*pi
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426|    |-			}
|    | 426|+			
| 427| 427| 			else
| 428| 428| 			{
| 429| 429| 				// not in world, set a default?
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 425| 425| 				ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI);
| 426| 426| 			}
| 427| 427| 			else
| 428|    |-			{
|    | 428|+			
| 429| 429| 				// not in world, set a default?
| 430| 430| 				ret.attack[type].elevationAdaptedRange = ret.attack.maxRange;
| 431|    |-			}
|    | 431|+			
| 432| 432| 		}
| 433| 433| 	}
| 434| 434| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
| 796| 796| 		updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ?
| 797| 797| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] :
| 798| 798| 			[IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer],
| 799|    |-			cmpRangeManager.GetEntitiesByPlayer(i));
|    | 799|+		cmpRangeManager.GetEntitiesByPlayer(i));
| 800| 800| 	}
| 801| 801| 	updateEntityColor([IID_Selectable, IID_StatusBars], data.selected);
| 802| 802| 	Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1315|1315| 		}
|1316|1316| 	}
|1317|1317| 	else
|1318|    |-	{
|    |1318|+	
|1319|1319| 		// Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps
|1320|1320| 		// when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned
|1321|1321| 		// wall piece.
|1336|1336| 			"pos": start.pos,
|1337|1337| 			"angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle
|1338|1338| 		});
|1339|    |-	}
|    |1339|+	
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|1342| 	{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1339|1339| 	}
|1340|1340| 
|1341|1341| 	if (end.pos)
|1342|    |-	{
|    |1342|+	
|1343|1343| 		// Analogous to the starting side case above
|1344|1344| 		if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY)
|1345|1345| 		{
|1377|1377| 				"pos": end.pos,
|1378|1378| 				"angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle
|1379|1379| 			});
|1380|    |-	}
|    |1380|+	
|1381|1381| 
|1382|1382| 	let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
|1383|1383| 	if (!cmpTerrain)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1555|1555| 
|1556|1556| 		let cmpVisual = Engine.QueryInterface(ent, IID_Visual);
|1557|1557| 		if (cmpVisual)
|1558|    |-		{
|    |1558|+		
|1559|1559| 			if (!allPiecesValid || !canAfford)
|1560|1560| 				cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1);
|1561|1561| 			else
|1562|1562| 				cmpVisual.SetShadingColor(1, 1, 1, 1);
|1563|    |-		}
|    |1563|+		
|1564|1564| 
|1565|1565| 		++entPool.numUsed;
|1566|1566| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1629|1629| 			{
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|    |-						"x": pos.x,
|    |1632|+					"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1630|1630| 				minDist2 = dist2;
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|    |-						"z": pos.z,
|    |1633|+					"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1631|1631| 				minDistEntitySnapData = {
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|    |-						"angle": cmpPosition.GetRotation().y,
|    |1634|+					"angle": cmpPosition.GetRotation().y,
|1635|1635| 						"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1632|1632| 						"x": pos.x,
|1633|1633| 						"z": pos.z,
|1634|1634| 						"angle": cmpPosition.GetRotation().y,
|1635|    |-						"ent": ent
|    |1635|+					"ent": ent
|1636|1636| 				};
|1637|1637| 			}
|1638|1638| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1777|1777| 			result.gain = cmpEntityTrader.GetGoods().amount;
|1778|1778| 	}
|1779|1779| 	else if (data.target === secondMarket)
|1780|    |-	{
|    |1780|+	
|1781|1781| 		result = {
|1782|1782| 			"type": "is second",
|1783|1783| 			"gain": cmpEntityTrader.GetGoods().amount,
|1784|1784| 		};
|1785|    |-	}
|    |1785|+	
|1786|1786| 	else if (!firstMarket)
|1787|1787| 	{
|1788|1788| 		result = { "type": "set first" };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1784|1784| 		};
|1785|1785| 	}
|1786|1786| 	else if (!firstMarket)
|1787|    |-	{
|    |1787|+	
|1788|1788| 		result = { "type": "set first" };
|1789|    |-	}
|    |1789|+	
|1790|1790| 	else if (!secondMarket)
|1791|1791| 	{
|1792|1792| 		result = {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1788|1788| 		result = { "type": "set first" };
|1789|1789| 	}
|1790|1790| 	else if (!secondMarket)
|1791|    |-	{
|    |1791|+	
|1792|1792| 		result = {
|1793|1793| 			"type": "set second",
|1794|1794| 			"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
|1795|1795| 		};
|1796|    |-	}
|    |1796|+	
|1797|1797| 	else
|1798|1798| 	{
|1799|1799| 		// Else both markets are not null and target is different from them
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js
|1795|1795| 		};
|1796|1796| 	}
|1797|1797| 	else
|1798|    |-	{
|    |1798|+	
|1799|1799| 		// Else both markets are not null and target is different from them
|1800|1800| 		result = { "type": "set first" };
|1801|    |-	}
|    |1801|+	
|1802|1802| 	return result;
|1803|1803| };
|1804|1804| 
|    | [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], gameState.ai.Config.DamageTypeFactors) * 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
|2004|2004| 		nAdvanced += gameState.countEntitiesAndQueuedByType(advanced, true);
|2005|2005| 
|2006|2006| 	if (!nAdvanced || nAdvanced < this.bAdvanced.length && this.getAccountedPopulation(gameState) > 110)
|2007|    |-	{
|    |2007|+	
|2008|2008| 		for (let advanced of this.bAdvanced)
|2009|2009| 		{
|2010|2010| 			if (gameState.countEntitiesAndQueuedByType(advanced, true) > 0 || !this.canBuild(gameState, advanced))
|2019|2019| 				queues.militaryBuilding.addPlan(new m.ConstructionPlan(gameState, advanced));
|2020|2020| 			return;
|2021|2021| 		}
|2022|    |-	}
|    |2022|+	
|2023|2023| };
|2024|2024| 
|2025|2025| /**
|    | [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
|2107|2107| 	// in which case we prefer melee units
|2108|2108| 	let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor);
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|    |-	{
|    |2110|+	
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|2112| 		{
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|2117| 		}
|2118|    |-	}
|    |2118|+	
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   nearestAnchor.hitpoints() > nearestAnchor.garrisonEjectHealth() * nearestAnchor.maxHitpoints();
|2121|2121| 	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
|2109|2109| 	if (nearestAnchor._entity.trainingQueue)
|2110|2110| 	{
|2111|2111| 		for (let item of nearestAnchor._entity.trainingQueue)
|2112|    |-		{
|    |2112|+		
|2113|2113| 			if (item.metadata && item.metadata.garrisonType)
|2114|2114| 				numGarrisoned += item.count;
|2115|2115| 			else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|2116|2116| 				nearestAnchor.stopProduction(item.id);
|2117|    |-		}
|    |2117|+		
|2118|2118| 	}
|2119|2119| 	let autogarrison = numGarrisoned < nearestAnchor.garrisonMax() &&
|2120|2120| 	                   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
|2149|2149| 	let cost = new API3.Resources(templateFound[1].cost());
|2150|2150| 	queueManager.setAccounts(gameState, cost, "emergency");
|2151|2151| 	if (!queueManager.canAfford("emergency", cost))
|2152|    |-	{
|    |2152|+	
|2153|2153| 		for (let q in queueManager.queues)
|2154|2154| 		{
|2155|2155| 			if (q == "emergency")
|2158|2158| 			if (queueManager.canAfford("emergency", cost))
|2159|2159| 				break;
|2160|2160| 		}
|2161|    |-	}
|    |2161|+	
|2162|2162| 	let metadata = { "role": "worker", "base": nearestAnchor.getMetadata(PlayerID, "base"), "plan": -1, "trainer": nearestAnchor.id() };
|2163|2163| 	if (autogarrison)
|2164|2164| 		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
|2439|2439| m.HQ.prototype.assignGatherers = function()
|2440|2440| {
|2441|2441| 	for (let base of this.baseManagers)
|2442|    |-	{
|    |2442|+	
|2443|2443| 		for (let worker of base.workers.values())
|2444|2444| 		{
|2445|2445| 			if (worker.unitAIState().split(".")[1] != "RETURNRESOURCE")
|2449|2449| 				continue;
|2450|2450| 			this.AddTCGatherer(orders[1].target);
|2451|2451| 		}
|2452|    |-	}
|    |2452|+	
|2453|2453| };
|2454|2454| 
|2455|2455| 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
|2621|2621| 	{
|2622|2622| 		let pop = gameState.getPopulation();
|2623|2623| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2624|    |-		{
|    |2624|+		
|2625|2625| 			for (let item of ent.trainingQueue())
|2626|2626| 			{
|2627|2627| 				if (!item.unitTemplate)
|2630|2630| 				if (unitPop)
|2631|2631| 					pop += item.count * unitPop;
|2632|2632| 			}
|2633|    |-		}
|    |2633|+		
|2634|2634| 		this.turnCache.accountedPopulation = pop;
|2635|2635| 	}
|2636|2636| 	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
|2645|2645| 	{
|2646|2646| 		let workers = gameState.getOwnEntitiesByRole("worker", true).length;
|2647|2647| 		for (let ent of gameState.getOwnTrainingFacilities().values())
|2648|    |-		{
|    |2648|+		
|2649|2649| 			for (let item of ent.trainingQueue())
|2650|2650| 			{
|2651|2651| 				if (!item.metadata || !item.metadata.role || item.metadata.role != "worker")
|2652|2652| 					continue;
|2653|2653| 				workers += item.count;
|2654|2654| 			}
|2655|    |-		}
|    |2655|+		
|2656|2656| 		this.turnCache.accountedWorkers = workers;
|2657|2657| 	}
|2658|2658| 	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
|2683|2683| 			this.phasing = 0;
|2684|2684| 	}
|2685|2685| 
|2686|    |-/*	if (this.Config.debug > 1)
|    |2686|+	/*	if (this.Config.debug > 1)
|2687|2687| 	{
|2688|2688| 		gameState.getOwnUnits().forEach (function (ent) {
|2689|2689| 			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
|2758|2758| 		this.currentBase %= this.baseManagers.length;
|2759|2759| 		activeBase = this.baseManagers[this.currentBase++].update(gameState, queues, events);
|2760|2760| 		--nbBases;
|2761|    |-// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|    |2761|+		// TODO what to do with this.reassignTerritories(this.baseManagers[this.currentBase]);
|2762|2762| 	}
|2763|2763| 	while (!activeBase && nbBases != 0);
|2764|2764| 

binaries/data/mods/public/simulation/ai/petra/headquarters.js
|2896| }(PETRA);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'PETRA' was used before it was defined.

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.'.
Executing section cli...

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

wraitii added inline comments.Wed, Jun 19, 9:04 AM
binaries/data/mods/public/simulation/components/Armour.js
71

foundations have separate armour damage. So we handle it specially here too.

I have an idea on how to fix that cleanly but it'll need c++ code.

Freagarach marked 2 inline comments as done.Wed, Jun 19, 9:40 AM