public static int unitScoreWithUnits(GameEntity en, ArrayList<BaseEntity> enemies, ArrayList<BaseEntity> rivals) //Calculates score of a unit. Adaptive.
	{
		float sum = 0;
		if (en.name.equals("Settler"))
			sum = 10;
		else if (en.mode == 0)
			return 0;
		else if (en.mode == 1)
			sum = en.offensiveStr + en.defensiveStr;
		else if (en.mode == 2)
			sum = en.rangedStr + en.defensiveStr;
		double averageOffDef = 0; int n = 0;
		//Weighted averages of the off-def potential of a unit versus all adversaries
		for (BaseEntity enemy: enemies)
		{
			if (enemy instanceof GameEntity)
			{
				//double[] offDef = ConflictSystem.calcOffDefMod(en, (GameEntity)enemy);
				Object[] offDef = ConflictSystem.attack(en, (GameEntity)enemy);
				averageOffDef += (Double)offDef[3]*2/(Double)offDef[4]; 
				n += 2; //double the weight
			}
		}
		for (BaseEntity rival: rivals)
		{
			if (rival instanceof GameEntity)
			{
				//double[] offDef = ConflictSystem.calcOffDefMod(en, (GameEntity)rival);
				Object[] offDef = ConflictSystem.attack(en, (GameEntity)rival);
				averageOffDef += (Double)offDef[4]/(Double)offDef[5]; 
				n += 1;
			}
		}
		if (n == 0)
			return (int)sum;
		averageOffDef /= n;
		sum *= averageOffDef;
		return (int)sum;
	}