Page 1 of 1

Early Tercio Melee POA Question

Posted: Fri May 14, 2021 2:45 am
by SnuggleBunnies
Question. harvey's Early Tercio is meleeing my Later Tercio in the stream. He has no melee POA. Shouldn't he still be getting 50POA, as he is only Moderately Disordered? Screens attached.

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 2:47 am
by SnuggleBunnies
Can't get two screens on the first post for some reason, here's #2

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 6:17 am
by rbodleyscott
Has his unit dropped below the strength required to get the Keil POA?

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 10:54 am
by Cronos09
rbodleyscott wrote: Fri May 14, 2021 6:17 am Has his unit dropped below the strength required to get the Keil POA?
If I understand the FUNCTION PercentKeil(me) properly

Code: Select all

// Determines if unit has enough pikes, heavy weapon men and swordsmen left to qualify as a keil. Returns 0 if not keil, otherwise percent of men qualifying for keil POA
// No individual man should have more than one of these attribs.
FUNCTION PercentKeil(me)
{
	int percent;
	int original_block_size;
	int block_size;
	int ret;

	ret = 0;

	percent = GetAttrib(me, "Pike"); // Pikes

	if ((percent >= 40) || ((percent >= 25) && (GetAttrib(me, "Heavy_Weapon") >= 25))) // Unit at least 40% pikes (or, to cope with Elizabethan foot, at least 25% pikes and 25% heavy weapon).
		{
			// Add heavy weapon men and swordsmen
			percent = percent + GetAttrib(me, "Heavy_Weapon") + GetAttrib(me,"Swordsmen");
			original_block_size = percent * GetBaseAttrib(me, "UnitSize"));
			original_block_size /= 100;
			if (original_block_size > 500) // Not >= because of 50:50 early Later Tercios
				{
					block_size = percent * GetAttrib(me, "UnitSize"));
					block_size *= GetAttrib(me, "TotalMen");
					block_size /= StartingStrength(me);
					block_size /= 100;

					if (block_size >= 400)
						{
							ret = percent;
						}
				}
		}

	return ret;
}
the current SnuggleBunnies' block_size level is 50*1600*1697/1920/100 = 707, which is much more than 400. This parameter is 800 for initial Early Tercio, and this unit must lose about half of its original strength in order to lose the Keil feature.

The unit disorder parameter depends on stream characteristics (ordinary, large or medium and deep)

Code: Select all

// Return tile disorder value for unit (Returns a standard value if unit not specified)
FUNCTION TileDisorder(me, x, y)
{
	int disorder;
	int terrain;

	disorder = 0;

	terrain = GetTerrainCoverValue(x, y, 4);

	// Medium or Heavy Fortifications
	if (GetTerrainCoverValue(x, y, 3) > 1)
		{
			if (me == -1)
				{
					terrain = 3;
				}
			else
				{
					// If inside fortification, count as clear
					if ((GetUnitX(me) == x) && (GetUnitY(me) == y))
						{
							terrain = 0;
						}
					else // If outside, count as difficult if across the fortifications
						{
							if (IsTileEdgeDefendibleObstacle(x, y, GetUnitX(me), GetUnitY(me)) > 1) // Fortified edge
								{
									terrain = 3;
								}
							else
								{
									terrain = 0;
								}
						}
				}
		}

	// Difficult
	if (terrain == 3)
		{
			if (me == -1)
				{
					disorder = 200;
				}
			else
				{
					if ((IsUnitSquadType(me, "Light_Foot") == 1) || (IsUnitSquadType(me, "Commanded_Shot") == 1))
						{
							disorder = 0;
						}
					else
						{
							if (IsUnitSquadType(me, "Mixed_Foot") == 1)
								{
									disorder = 134; // Quick and dirty estimate based on 1/3 pike, 2/3 shot. However, could be calculated according to proportion of weapon capabilities
								}
							else
								{
									if ((IsUnitSquadType(me, "Medium_Foot") == 1) || (IsUnitSquadType(me, "Warriors") == 1) || (IsUnitSquadType(me, "Dragoons") == 1) || (IsUnitSquadType(me, "Mob") == 1))
										{
											disorder = 100;
										}
									else
										{
											disorder = 200;
										}
								}
						}
				}
		}

	// Rough
	if (terrain == 2)
		{
			if (me == -1)
				{
					disorder = 100;
				}
			else
				{
					if ((IsUnitSquadType(me, "Light_Foot") == 1) || (IsUnitSquadType(me, "Commanded_Shot") == 1) || (IsUnitSquadType(me, "Medium_Foot") == 1) || (IsUnitSquadType(me, "Warriors") == 1) || (IsUnitSquadType(me, "Dragoons") == 1) || (IsUnitSquadType(me, "Mob") == 1))
						{
							disorder = 0;
						}
					else
						{
							if (IsUnitSquadType(me, "Mixed_Foot") == 1)
								{
									disorder = 34; // Quick and dirty estimate based on 1/3 pike, 2/3 shot. However, could be calculated according to proportion of weapon capabilities
								}
							else
								{
									if ((IsUnitSquadType(me, "Artillery") == 1) || ((IsUnitSquadType(me, "Gendarmes") == 1) && (GetAttrib(me, "BodyArmour") > 200)))
										{
											disorder = 200;
										}
									else
										{
											disorder = 100;
										}
								}
						}
				}
		}

	return disorder;
}
terrain = GetTerrainCoverValue(x, y, 4) is the key script. Its value you can see in Terrain.txt DATA folder for different kinds of stream
[Stream] COVERVALUE4 1 // 1 = not open but otherwise clear
[StreamMedium] COVERVALUE4 2 // 2 = Rough
[StreamDeep] COVERVALUE4 3 // 3 = Difficult

If Later Tercio is on Stream or Large/Medium Stream Early Tercio has +50 PoA during melee phase. If Later Tercio is on Deep Stream Early Tercio has no melee PoA advantage, as terrain is Difficult and disorder = 200 - severely disordered. Which is most likely in this case. Moderately Disordered is not quite correct description for this I think. As well Sligthly Disordered when Later Tercio is on Large/Medium Stream and no string of disorder when Later Tercio is on Stream.

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 11:20 am
by rbodleyscott
Ah, yes, that probably explains it. Thanks Cronos.

Was it a Deep Stream Jack?

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 12:25 pm
by SnuggleBunnies
rbodleyscott wrote: Fri May 14, 2021 11:20 am Ah, yes, that probably explains it. Thanks Cronos.

Was it a Deep Stream Jack?
It is Deep, but I'm a bit confused - isn't the Early Tercio classed as Mixed Foot, and thus shouldn't it be Disorder 134?

Assuming that part is WAD, does it just mean that the display of the unit description as Moderate is wrong?

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 1:09 pm
by Cronos09
SnuggleBunnies wrote: Fri May 14, 2021 12:25 pm It is Deep, but I'm a bit confused - isn't the Early Tercio classed as Mixed Foot, and thus shouldn't it be Disorder 134?

Assuming that part is WAD, does it just mean that the display of the unit description as Moderate is wrong?
You are right. Early and Later Tercio are Mixed Foot and they have disorder = 134 in Difficult terrain (I was mistaken with 200). Therefore, they are Moderately Disordered (less than 175) - the unit description is correct.
But in FUNCTION GetMeleePOA(me, enemy, attacking, print, test) we have the next code

Code: Select all

	percent_severely_disordered = Max(PercentDisordered(me, enemy, attacking) - 100, 0);

	// Pike
	percent = GetAttrib(me,"Pike");
	if (percent > 0)
		{
			if (enemy == -1)
				{
					if (print == 1)
						{
							any_printed = 1;
							PrintStringIndexedX(1, test, "IDS_CAPABILITY", 18);
							PrintStringLiteralX(1, test, ": ");
							PrintStringX(1, test, "IDS_UI_INFO_MELEE_PIKE");
							PrintStringLiteralX(1, test, "\n");
						}

					if (GetAttrib(me,"MoraleState") < 2) // If not FRAGMENTED
						{
							increment = 50 - percent_severely_disordered;  // average vs horse and foot
							POA += increment; // Note percent of pike does not affect this, as other troops with them qualify as "Protected".
							// Note that this currently includes non-shot troops such as archers - differs from FOGR, but probably better for Elizabethan units
						}
				}
			else
				{
					if (GetAttrib(me,"MoraleState") < 2) // If not FRAGMENTED
						{
							if (IsMounted(enemy) == 1) // If enemy is mounted
								{
									increment = 100 - percent_severely_disordered;
									POA += increment; // Note percent of pike does not affect this, as other troops with them qualify as "Protected".
									// Note that this currently includes non-shot troops such as archers - differs from FOGR, but probably better for Elizabethan units
									if ((print == 1) && (increment > 0))
										{
											if (any_printed == 1)
												{
													PrintStringLiteralX(1, test, ", ");
												}
											PrintStringIndexedX(1, test, "IDS_CAPABILITY", 18);
											PrintStringLiteralX(1, test, " +");
											PrintIntX(1, test, increment);
											any_printed = 1;
										}
								}
						}
				}

			if (enemy == -1)
				{
					percent_keil = PercentKeil(me);

					if (percent_keil > 0)
						{
							if (print == 1)
								{
									any_printed = 1;
									PrintStringX(1, test, "IDS_UNIT_KEIL");
									PrintStringLiteralX(1, test, ": +");
									PrintIntX(1, test, percent_keil);
									PrintStringLiteralX(1, test, " ");
									PrintStringX(1, test, "IDS_UI_INFO_MELEE_KEIL");
									PrintStringLiteralX(1, test, "\n");
								}

							// If unit has large block of pike/heavy weapon/swordsmen and is not fragmented or severely disordered
							if (GetAttrib(me,"MoraleState") < 2)
								{
									if (percent_severely_disordered == 0)
										{
											increment = percent_keil;
											POA += increment;
										}
								}
						}
				}
			else
				{
					if (GetAttrib(me,"MoraleState") < 2) // If not FRAGMENTED
						{
							// If unit has large block of pike/heavy weapon/swordsmen, and not severely disordered
							percent_keil = PercentKeil(me);
							if ((percent_keil > 0) && (percent_severely_disordered == 0))
								{
									increment = percent_keil;
									POA += increment;
									if ((print == 1) && (increment > 0))
										{
											if (any_printed == 1)
												{
													PrintStringLiteralX(1, test, ", ");
												}
											PrintStringX(1, test, "IDS_UNIT_KEIL");
											PrintStringLiteralX(1, test, " +");
											PrintIntX(1, test, increment);
											any_printed = 1;
										}
								}
						}
				}
		}
In your case percent_severely_disordered 134 - 100 = 34 and it is more than 0. Therefore, the condition for melee PoA if ((percent_keil > 0) && (percent_severely_disordered == 0)) is wrong: PoA are not added.

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 2:03 pm
by rbodleyscott
I had forgotten that this is how it worked, but it is WAD. It is confusing because the term Moderately Disordered covers a range of values up to 175, but the Keil POA is lost if the value is above 100. i.e. If any of the unit is severely disordered.

Mixed units are 34% severely disordered in Difficult Terrain. The intention is that the pikes are severely disordered, but the muskets are only moderately disordered. Actually it should be 50% severely disordered for early tercios, but we set all mixed foot as if they had a 2:1 ratio of muskets to pikes for the numerical disorder value for the sake of simplicity.

However, the POA code is based on the premise that all of the pikes in a mixed unit are Severely Disordered in Difficult Terrain, so in effect all of the keil part of the unit is Severely Disordered and therefore gets no POA.

The unit is on average Moderately Disordered, as stated in the UI, but the keil part of it is in fact Severely Disordered.

Re: Early Tercio Melee POA Question

Posted: Fri May 14, 2021 2:24 pm
by SnuggleBunnies
rbodleyscott wrote: Fri May 14, 2021 2:03 pm
Thank you Richard, it's admittedly confusing at first but now that I've had it explained to me it makes total sense. I know Pike and Shot is long finished, but perhaps the language can be clearer when we get to Swiss pikes in FoG2M.