Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): auras from elite pin, red guard training +3 grades

Olcay Seyganadd9c2a741b9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a444762db..c43c48361 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@ found and fixed, EA's own, not port damage.**
- America, China and GLA units now get what their rank ladder on the website promises. Rank has always raised a unit's stats; now certain grades also add a perk of their own, and the officers and leaders further up the ladder carry an aura that helps friendly units around them.
- Perks work on the unit itself: a GLA Fighter starts mending itself at 0.5% of its health a second, a Hardened Raider carries 8% more health, an American Private First Class the same. Aura kinds are rate of fire, damage taken, mending, sight, speed, experience, detection, resistance to EMP and paralysis, capture time and a share of kill value. They never touch the leader, and auras of one kind do not add up: a unit near three leaders takes the strongest of each kind.
+- Auras start at the Elite rank: an American Warrant Officer (grade 13), a Chinese Second Lieutenant or a GLA Raid Captain (grade 10). Below that, whole squads of corporals and sergeants carried rings and buffed each other. A sergeant's old aura is now the same bonus on himself: a Chinese Master Sergeant Second Class (grade 8) takes 7% less damage while he holds his ground, an American Command Sergeant Major (grade 11) fires 10% faster, a GLA Squadhand (grade 6) runs 8% faster. Drill, steady and spoils have nothing to turn into and are gone below the officers; America's steady aura moved up to the W-2 Chief Warrant Officer (grade 14).
+- Red Guard Training lifts a new Red Guard three grades, to Corporal, where it used to make him a Veteran Sergeant with the horde bonus from his first second. The Infantry General's version lifts his Mini-Gunners three grades above Sergeant, where it made them Elite.
- An American Second Lieutenant (grade 18) gives every friendly unit within 140 of it +12% rate of fire; a Captain two grades later heals them 1% of their health a second. A GLA Field Commander (grade 13) heals 1% a second at a radius of 140, and a Warlord (grade 15) speeds up every unit near it by 12%.
- Every aura a ranked leader gives draws its own ring on the ground, out at that aura's radius, so you can see which units each one covers. The rings are always there, nothing to select, under your leaders and the enemy's alike, and an enemy leader hidden in the fog, or stealthed and not detected, shows no ring. The rings borrow Turkiye's five patterns and tell the kinds apart by tint where two share a pattern. Detection draws none.
- The full tables, grade by grade, are on the Rank ladder page of the website.
@@ -104,7 +106,7 @@ found and fixed, EA's own, not port damage.**
- Three chevrons are now a whole army's ladder. An American unit climbs 28 promotions from E-1 Private to General of the Army, a Chinese one 19 from Private to General, a GLA one 20 from Recruit to Supreme Liberator. Every unit starts unranked with a bare health bar and no bonus; from the first promotion on, each grade wears its own insignia beside the health bar and floats it up over the unit's head the moment it is earned. Hover the portrait for the rank's name and how far the next one is: "Next rank 340/420 XP".
- The climb is long. The first promotion is one kill of a unit like your own, every step after costs a fixed share more, and the top is 120 such kills on every side: 12,000 experience for a Crusader. One kill lifts a unit one grade at most, so a Ranger who kills a tank early gets two grades out of it, not five. Six kills used to make a tank Heroic; now they make it an American Corporal, a Chinese Staff Sergeant or a GLA Hardened Raider.
- Every grade makes a unit a little better, on one curve for all three armies: rate of fire times damage times health is 1.13 times a regular's after the first kill, about 1.25 at Veteran, 1.6 at Elite, 2 at Heroic and 2.4 at the very top, where EA's Heroic gave 3.1 after six kills. Each army takes it its own way: America in rate of fire, health and up to 7% more range, China in health and a 10% faster horde, GLA in rate of fire, up to 14% more speed and up to 2% of its health mended a second once it has gone five seconds unhurt.
-- Veteran, Elite and Heroic still exist and still bring their weapons, voices and upgrades: America turns Veteran at Corporal, Elite at Warrant Officer and Heroic at Lieutenant Colonel; China at Sergeant, Second Lieutenant and Colonel; GLA at Raider, Raid Captain and Warlord. Red Guard Training and the other trainings, a pilot climbing into a vehicle, map-placed veterans and the Heroic cheat land on those ranks. A veterancy crate is worth three grades, never past Heroic, since one EA level is up to 42 kills on this ladder.
+- Veteran, Elite and Heroic still exist and still bring their weapons, voices and upgrades: America turns Veteran at Corporal, Elite at Warrant Officer and Heroic at Lieutenant Colonel; China at Sergeant, Second Lieutenant and Colonel; GLA at Raider, Raid Captain and Warlord. The trainings other than Red Guard Training, a pilot climbing into a vehicle, map-placed veterans and the Heroic cheat land on those ranks. A veterancy crate is worth three grades, never past Heroic, since one EA level is up to 42 kills on this ladder.
- Burton, Black Lotus and Jarmen Kell climb like everyone else but wear high rank from the start: Burton is a Colonel on his first day and a General of the Army at the top, Lotus goes from Colonel to General, Kell from Warlord to Supreme Liberator.
- Every general's army takes its side's ladder; civilians and other armies keep EA's three ranks. Replays recorded before this change play out differently.
diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
index fd994d23c..780061643 100644
--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini
+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
@@ -1865,6 +1865,48 @@ Armor DemoGenTerroristArmor
Armor = POISON 50%
End
+; Red Guard Training made every Red Guard a Veteran, Sergeant on the ladder, with his rank perks and
+; the horde bonus from the first second; the owner found it too much. It now lifts him three grades
+; from where he starts, to Corporal. The Infantry General's own training lifted his Mini-Gunners from
+; the Veteran his ModuleTag_03 gives them to Elite; it now lifts them three grades from that pin, to
+; Master Sergeant Third Class. StartingGrades takes StartingLevel's place on a ladder side, so the
+; lines carry no StartingLevel and the build button shows no chevron the unit does not get.
+Object ChinaInfantryRedguard
+ ReplaceModule ModuleTag_03
+ Behavior = VeterancyGainCreate ModuleTag_RedGuardTraining
+ StartingGrades = 3
+ ScienceRequired = SCIENCE_RedGuardTraining
+ End
+ End
+End
+
+Object Nuke_ChinaInfantryRedguard
+ ReplaceModule ModuleTag_03
+ Behavior = VeterancyGainCreate ModuleTag_RedGuardTraining
+ StartingGrades = 3
+ ScienceRequired = SCIENCE_RedGuardTraining
+ End
+ End
+End
+
+Object Tank_ChinaInfantryRedguard
+ ReplaceModule ModuleTag_03
+ Behavior = VeterancyGainCreate ModuleTag_RedGuardTraining
+ StartingGrades = 3
+ ScienceRequired = SCIENCE_RedGuardTraining
+ End
+ End
+End
+
+Object Infa_ChinaInfantryMiniGunner
+ ReplaceModule ModuleTag_08
+ Behavior = VeterancyGainCreate ModuleTag_RedGuardTraining
+ StartingGrades = 3
+ ScienceRequired = Infa_SCIENCE_RedGuardTraining
+ End
+ End
+End
+
; ---- the rank ladder ------------------------------------------------------------------------------
;
; Every rank in the art is a grade: 28 promotions for America (E-1 to General of the Army), 19 for
@@ -1875,9 +1917,10 @@ End
; promotion is one same-class kill, and r is solved so the top grade costs Top x E. One gain, a kill
; or a heal, lifts one grade at most. docs/plans/RANK-LADDER.md in the wrapper has the tables.
;
-; EA's four levels follow the grade: a unit is Veteran from VeteranPin on, and so on. Crates, Red
-; Guard Training, map objects, the rank cheat and scripts land on a pin; a veterancy crate gives
-; CrateGrades grades instead of one level, never past the Heroic pin. A hero's insignia starts on
+; EA's four levels follow the grade: a unit is Veteran from VeteranPin on, and so on. Crates, the
+; other trainings, map objects, the rank cheat and scripts land on a pin; a veterancy crate gives
+; CrateGrades grades instead of one level, never past the Heroic pin, and Red Guard Training gives
+; its StartingGrades (the blocks just above). A hero's insignia starts on
; HeroStart and reaches the top with the hero's last grade; its stats are its grade's like anyone's.
;
; Stats come from the grade in place of EA's VETERAN, ELITE and HERO lines and HealthBonus_*. Worth
@@ -1897,7 +1940,9 @@ End
; for an aura its own radius and who it reaches. A grade holds every perk of the grades below it,
; and of one kind the strongest, so Turkiye's sight goes 110%, 120%, 130% with each line replacing
; the last. A line as strong as the one before replaces it with its radius and receivers; a line with
-; no radius keeps the one before it. A grade with no line is stats only. The site's /wiki/ranks
+; no radius keeps the one before it. A grade with no line is stats only. No aura sits below its
+; side's Elite pin: squads of corporals ringing and buffing each other read as noise, so a sergeant's
+; old aura is now the same bonus on himself, or gone where no self kind exists. The site's /wiki/ranks
; describes the America, China and GLA ladders below; all of it is here but GLA's Ambush.
;
; SIGHT 110% its own shroud clearing, past the half-again-its-weapon cap
@@ -1959,7 +2004,7 @@ Veterancy
Perk_Turkiye = 4 STILL_GUARD 10% ; Uzman Cavus
Perk_Turkiye = 6 MEND 1% ; Astsubay Kidemli Cavus
Perk_Turkiye = 8 SIGHT 120% ; Astsubay Kidemli Ustcavus
- Perk_Turkiye = 10 AURA_RATE_OF_FIRE 5% ; Astsubay Kidemli Bascavus
+ Perk_Turkiye = 10 RATE_OF_FIRE 5% ; Astsubay Kidemli Bascavus
Perk_Turkiye = 11 SPOTTER ; Tegmen
Perk_Turkiye = 13 AURA_SIGHT 10% ; Yuzbasi
Perk_Turkiye = 14 SCATTER 15% ; Binbasi
@@ -1974,17 +2019,15 @@ Veterancy
Perk_America = 1 RATE_OF_FIRE 5% ; E-2 Private: Drilled
Perk_America = 2 RANGE 3% ; E-3 Private First Class: Steady hands
Perk_America = 3 MEND 0.5% ; E-4 Specialist: Field kit
- Perk_America = 4 AURA_RATE_OF_FIRE 5% 80 ; E-4 Corporal: Fire team
+ ; 4 E-4 Corporal: stats only, its old rate-of-fire aura I is Drilled's 5% held from 1
Perk_America = 5 SIGHT 120% ; E-5 Sergeant: Eyes
- Perk_America = 6 AURA_MEND 0.5% 80 INFANTRY ; E-6 Staff Sergeant: Combat lifesaver
- Perk_America = 7 AURA_RATE_OF_FIRE 8% 100 ; E-7 Sergeant First Class
- Perk_America = 8 AURA_DRILL 4 100 ; E-8 Master Sergeant: up to Corporal
- Perk_America = 9 AURA_STEADY 20% 100 ; E-8 First Sergeant
- Perk_America = 10 AURA_DRILL 6 120 ; E-9 Sergeant Major: up to Staff Sergeant
- Perk_America = 11 AURA_RATE_OF_FIRE 10% 120 ; E-9 Command Sergeant Major
- Perk_America = 12 AURA_STEADY 35% 140 ; E-9 Sergeant Major of the Army
+ ; 6 E-6 Staff Sergeant: stats only, its old mend aura I is Field kit's 0.5% held from 3
+ Perk_America = 7 RATE_OF_FIRE 8% ; E-7 Sergeant First Class
+ ; 8, 9, 10 and 12 are stats only: drill and steady have no self kind
+ Perk_America = 11 RATE_OF_FIRE 10% ; E-9 Command Sergeant Major
Perk_America = 13 AURA_MEND 0.75% 100 ; W-1 Warrant Officer: Technician, vehicles too
Perk_America = 14 RANGE 6% ; W-2: Calibrated, 3% more
+ Perk_America = 14 AURA_STEADY 35% 140 ; W-2: the Sergeant Major of the Army's steady aura
Perk_America = 15 SCATTER 50% ; W-3: Precision
Perk_America = 16 AURA_SIGHT 15% 120 ; W-4: Spotter
Perk_America = 17 DETECT 75 ; W-5: Sensor
@@ -2004,13 +2047,11 @@ Veterancy
Perk_America = 28 AURA_RATE_OF_FIRE 18% 200
Perk_China = 2 HEALTH 8% ; Private First Class: Hardy
- Perk_China = 3 AURA_GUARD 4% 80 ; Corporal: Shoulder to shoulder
- Perk_China = 4 AURA_DRILL 3 100 ; Sergeant: Old soldier, up to Corporal
- Perk_China = 5 AURA_STEADY 25% 100 ; Staff Sergeant Second Class
- Perk_China = 6 AURA_RATE_OF_FIRE 5% 100 ; Staff Sergeant First Class
- Perk_China = 7 AURA_MEND 0.5% 100 ; Master Sergeant Third Class
- Perk_China = 8 AURA_GUARD 7% 120 ; Master Sergeant Second Class
- Perk_China = 9 AURA_DRILL 6 120 ; Master Sergeant First Class: up to Staff Sergeant First Class
+ Perk_China = 3 STILL_GUARD 4% ; Corporal: Shoulder to shoulder
+ ; 4, 5 and 9 are stats only: drill and steady have no self kind
+ Perk_China = 6 RATE_OF_FIRE 5% ; Staff Sergeant First Class
+ Perk_China = 7 MEND 0.5% ; Master Sergeant Third Class
+ Perk_China = 8 STILL_GUARD 7% ; Master Sergeant Second Class
Perk_China = 10 AURA_RATE_OF_FIRE 10% 140 ; Second Lieutenant: Rally
Perk_China = 11 AURA_STEADY 50% 140 ; First Lieutenant: Fearless
Perk_China = 12 AURA_CAPTURE 30% 140 ; Captain: Seize
@@ -2027,10 +2068,10 @@ Veterancy
Perk_GLA = 3 MEND 0.5% ; Fighter: Patch-up
Perk_GLA = 4 SCAVENGE 10% ; Raider: Scavenger
Perk_GLA = 5 HEALTH 8% ; Hardened Raider: Tough
- Perk_GLA = 6 AURA_PACE 8% 80 INFANTRY ; Squadhand: Move with me
- Perk_GLA = 7 AURA_SPOILS 5% 100 ; Squad Leader
+ Perk_GLA = 6 SPEED 8% ; Squadhand: Move with me
+ ; 7 Squad Leader: stats only, its old spoils aura I is under Scavenger's 10% held from 4
; 8 Cell Leader's Ambush is not built: it needs a StealthUpdate on every GLA unit
- Perk_GLA = 9 AURA_MEND 0.5% 100 ; Senior Cell Leader: Scrap repair
+ ; 9 Senior Cell Leader: stats only, its old mend aura I is Patch-up's 0.5% held from 3
Perk_GLA = 10 AURA_PACE 8% 120 ; Raid Captain: every unit
Perk_GLA = 11 AURA_CAPTURE 30% 120 ; Column Captain: Seize
Perk_GLA = 12 AURA_RATE_OF_FIRE 8% 120 ; Strike Commander: First strike
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 25d0cc7b9..654769f3f 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -3583,3 +3583,13 @@ END
GUI:FactionPickSideNameHint
"Click a side's name to play a random army of that side."
END
+
+// Red Guard Training gives three grades on the rank ladder instead of a whole level.
+
+CONTROLBAR:ToolTipChinaScienceRedGuardTraining
+"All Red Guard will be built three ranks up, as Corporals"
+END
+
+CONTROLBAR:Infa_ToolTipChinaScienceRedGuardTraining
+"All Mini-Gunners will be built three ranks above Veteran"
+END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index da258925b..e85d233e8 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -7346,7 +7346,7 @@ CONTROLBAR:ToolTipChinaScienceNukeCannon
END
CONTROLBAR:ToolTipChinaScienceRedGuardTraining
-"Tüm Kızıl Muhafızlar kıdemli olarak üretilir"
+"Tüm Kızıl Muhafızlar üç rütbe yukarıda, Onbaşı olarak üretilir"
END
CONTROLBAR:ToolTipChinaScienceClusterMines
@@ -13882,7 +13882,7 @@ SCIENCE:Infa_ChinaRedGuardTraining
END
CONTROLBAR:Infa_ToolTipChinaScienceRedGuardTraining
-"Tüm Minigun Erleri Seçkin olarak üretilir"
+"Tüm Minigun Erleri kıdemliden üç rütbe yukarıda üretilir"
END
CONTROLBAR:ToolTipChinaBuildNuclearMissileLauncherBoss
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h
index e3c18d9fa..e27f141d8 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ExperienceTracker.h
@@ -99,6 +99,7 @@ public:
* on the pin of the summed level. */
Bool gainExpForLevel(Int levelsToGain, Bool canScaleForBonus = TRUE, Bool byLevel = FALSE );
Bool canGainExpForLevel(Int levelsToGain) const; ///< return same value as gainExpForLevel, but don't change anything
+ void gainGrades( Int grades ); ///< on a rank ladder, this many grades up, never past the Heroic pin; nothing without one
void setExperienceAndLevel(Int experienceIn, Bool provideFeedback = TRUE );
void setExperienceSink( ObjectID sink ); ///< My experience actually goes to this person (loose couple)
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/VeterancyGainCreate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/VeterancyGainCreate.h
index 170600bfb..977216b5c 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/VeterancyGainCreate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/VeterancyGainCreate.h
@@ -46,6 +46,7 @@ class VeterancyGainCreateModuleData : public CreateModuleData
public:
VeterancyLevel m_startingLevel; ///< Level to set Object at
ScienceType m_scienceRequired; ///< The science you must have to trigger this
+ Int m_startingGrades; ///< on a rank ladder, grades given in place of StartingLevel; 0 lands on the level's pin
VeterancyGainCreateModuleData();
static void buildFieldParse(MultiIniFieldParse& p);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
index d876bf6fb..ec52d138b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
@@ -43,6 +43,7 @@ VeterancyGainCreateModuleData::VeterancyGainCreateModuleData()
{
m_startingLevel = LEVEL_REGULAR;
m_scienceRequired = SCIENCE_INVALID;
+ m_startingGrades = 0;
}
//-------------------------------------------------------------------------------------------------
@@ -55,6 +56,7 @@ void VeterancyGainCreateModuleData::buildFieldParse(MultiIniFieldParse& p)
{
{ "StartingLevel", INI::parseIndexList, TheVeterancyNames, offsetof( VeterancyGainCreateModuleData, m_startingLevel ) },
{ "ScienceRequired", INI::parseScience, NULL, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) },
+ { "StartingGrades", INI::parseInt, NULL, offsetof( VeterancyGainCreateModuleData, m_startingGrades ) },
{ 0, 0, 0, 0 }
};
@@ -92,7 +94,10 @@ void VeterancyGainCreate::onCreate( void )
if( myExp && myExp->isTrainable() )
{
// srj sez: use "setMin" here so that we never lose levels
- myExp->setMinVeterancyLevel( md->m_startingLevel );// sVL can override isTrainable, but this module should not.
+ if( md->m_startingGrades > 0 )
+ myExp->gainGrades( md->m_startingGrades );
+ else
+ myExp->setMinVeterancyLevel( md->m_startingLevel );// sVL can override isTrainable, but this module should not.
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp
index 338893939..7ab20a45c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ExperienceTracker.cpp
@@ -250,6 +250,19 @@ Bool ExperienceTracker::gainExpForLevel(Int levelsToGain, Bool canScaleForBonus,
return false;
}
+//-------------------------------------------------------------------------------------------------
+void ExperienceTracker::gainGrades( Int grades )
+{
+ // a unit of no side in the ladder (a mod faction, a civilian) has no grades to gain
+ const RankLadder *ladder = TheGlobalData->getRankLadder( m_parent->getTemplate() );
+ if (ladder == NULL)
+ return;
+ const Int grade = MIN( m_currentGrade + grades, ladder->m_pin[LEVEL_LAST] );
+ const Int experience = ladder->threshold( RankLadder::unitValue( m_parent->getTemplate() ), grade );
+ if (experience > m_currentExperience)
+ setExperienceAndLevel( experience );
+}
+
//-------------------------------------------------------------------------------------------------
Bool ExperienceTracker::canGainExpForLevel(Int levelsToGain) const
{
diff --git a/GeneralsMD/Code/Tests/test_rank_ladder.cpp b/GeneralsMD/Code/Tests/test_rank_ladder.cpp
index c17003fc5..394b007eb 100644
--- a/GeneralsMD/Code/Tests/test_rank_ladder.cpp
+++ b/GeneralsMD/Code/Tests/test_rank_ladder.cpp
@@ -164,7 +164,8 @@ TEST(rank_ladder_hero_insignia_runs_from_its_start_to_the_top)
TEST(rank_ladder_perks_carry_up_and_the_strongest_of_a_kind_holds)
{
- /* Turkiye's Perk_ lines: sight 110%, 120%, 130% at 3, 8, 18; the rate-of-fire aura 5% at 10, 10% at 16 */
+ /* Turkiye's Perk_ lines: sight 110%, 120%, 130% at 3, 8, 18; the rate-of-fire aura 10% at 16, and
+ a 5% one at 10 as the Bascavus carried before auras moved above the Elite pin */
RankLadder ladder;
ladder.clear();
ladder.m_grades = 21;
@@ -188,7 +189,7 @@ TEST(rank_ladder_perks_carry_up_and_the_strongest_of_a_kind_holds)
CHECK_NEAR( ladder.perk( 8, RANK_PERK_SIGHT ), 1.20f, 1e-6f );
CHECK_NEAR( ladder.perk( 21, RANK_PERK_SIGHT ), 1.30f, 1e-6f );
- /* the Albay's 10% replaces the Bascavus's 5%, it does not add to it */
+ /* the Albay's 10% replaces the 5% below it, it does not add to it */
CHECK_EQ( ladder.aura( 9, RANK_AURA_RATE_OF_FIRE ), 0.0f );
CHECK_NEAR( ladder.aura( 10, RANK_AURA_RATE_OF_FIRE ), 0.05f, 1e-6f );
CHECK_NEAR( ladder.aura( 16, RANK_AURA_RATE_OF_FIRE ), 0.10f, 1e-6f );
@@ -250,9 +251,14 @@ TEST(rank_ladder_america_ships_the_wiki_ladder)
RankLadder usa = america();
CHECK( shippedLadder( usa, "America" ) );
- /* self: Drilled at E-2, Steady hands then Calibrated, Precision, the Designator's 2 s then 4 s */
+ /* self: Drilled at E-2, raised at 7 and 11 where the NCOs' rate-of-fire auras were, Steady hands
+ then Calibrated, Precision, the Designator's 2 s then 4 s */
CHECK_EQ( usa.perk( 0, RANK_PERK_RATE_OF_FIRE ), 0.0f );
CHECK_NEAR( usa.perk( 1, RANK_PERK_RATE_OF_FIRE ), 0.05f, 1e-6f );
+ CHECK_NEAR( usa.perk( 6, RANK_PERK_RATE_OF_FIRE ), 0.05f, 1e-6f );
+ CHECK_NEAR( usa.perk( 7, RANK_PERK_RATE_OF_FIRE ), 0.08f, 1e-6f );
+ CHECK_NEAR( usa.perk( 11, RANK_PERK_RATE_OF_FIRE ), 0.10f, 1e-6f );
+ CHECK_NEAR( usa.perk( 28, RANK_PERK_RATE_OF_FIRE ), 0.10f, 1e-6f );
CHECK_NEAR( usa.perk( 2, RANK_PERK_RANGE ), 0.03f, 1e-6f );
CHECK_NEAR( usa.perk( 14, RANK_PERK_RANGE ), 0.06f, 1e-6f );
CHECK_NEAR( usa.perk( 3, RANK_PERK_MEND ), 0.005f, 1e-6f );
@@ -262,25 +268,25 @@ TEST(rank_ladder_america_ships_the_wiki_ladder)
CHECK_NEAR( usa.perk( 28, RANK_PERK_DESIGNATE ), 4.0f, 1e-6f );
CHECK_NEAR( usa.perk( 28, RANK_PERK_DESIGNATE_REVEAL ), 1.0f, 1e-6f );
- /* the rate-of-fire aura I to VI, each with its own radius */
- CHECK_EQ( usa.aura( 3, RANK_AURA_RATE_OF_FIRE ), 0.0f );
- CHECK_NEAR( usa.aura( 4, RANK_AURA_RATE_OF_FIRE ), 0.05f, 1e-6f );
- CHECK_NEAR( usa.auraRadius( 4, RANK_AURA_RATE_OF_FIRE ), 80.0f, 1e-3f );
- CHECK_NEAR( usa.auraRadius( 10, RANK_AURA_RATE_OF_FIRE ), 100.0f, 1e-3f );
+ /* the rate-of-fire aura I to III from the Second Lieutenant, each with its own radius */
+ CHECK_EQ( usa.aura( 17, RANK_AURA_RATE_OF_FIRE ), 0.0f );
+ CHECK_NEAR( usa.aura( 18, RANK_AURA_RATE_OF_FIRE ), 0.12f, 1e-6f );
+ CHECK_NEAR( usa.auraRadius( 18, RANK_AURA_RATE_OF_FIRE ), 140.0f, 1e-3f );
CHECK_NEAR( usa.aura( 23, RANK_AURA_RATE_OF_FIRE ), 0.15f, 1e-6f );
CHECK_NEAR( usa.auraRadius( 23, RANK_AURA_RATE_OF_FIRE ), 160.0f, 1e-3f );
- /* the mend aura reaches infantry at 80, then every unit at 100 from the Warrant Officer */
- CHECK_NEAR( usa.aura( 6, RANK_AURA_MEND ), 0.005f, 1e-6f );
- CHECK_EQ( (Int)usa.auraReach( 6, RANK_AURA_MEND ), (Int)RANK_REACH_INFANTRY );
- CHECK_NEAR( usa.auraRadius( 12, RANK_AURA_MEND ), 80.0f, 1e-3f );
+ /* the mend aura starts on the Warrant Officer and reaches every unit; the steady aura is the W-2's */
+ CHECK_EQ( usa.aura( 12, RANK_AURA_MEND ), 0.0f );
CHECK_NEAR( usa.aura( 13, RANK_AURA_MEND ), 0.0075f, 1e-6f );
CHECK_EQ( (Int)usa.auraReach( 13, RANK_AURA_MEND ), (Int)RANK_REACH_UNITS );
CHECK_NEAR( usa.auraRadius( 13, RANK_AURA_MEND ), 100.0f, 1e-3f );
+ CHECK_EQ( usa.aura( 13, RANK_AURA_STEADY ), 0.0f );
+ CHECK_NEAR( usa.aura( 14, RANK_AURA_STEADY ), 0.35f, 1e-6f );
+ CHECK_NEAR( usa.auraRadius( 14, RANK_AURA_STEADY ), 140.0f, 1e-3f );
/* drill caps on the grade it names, detect is a radius, and the O-10's command net reaches 25%
farther with every aura but not with its detection */
- CHECK_NEAR( usa.aura( 8, RANK_AURA_DRILL ), 4.0f, 1e-6f );
+ CHECK_EQ( usa.aura( 24, RANK_AURA_DRILL ), 0.0f );
CHECK_NEAR( usa.aura( 25, RANK_AURA_DRILL ), 13.0f, 1e-6f );
CHECK_NEAR( usa.perk( 21, RANK_PERK_DETECT ), 100.0f, 1e-3f );
CHECK_NEAR( usa.auraRadius( 26, RANK_AURA_GUARD ), 180.0f, 1e-3f );
@@ -296,16 +302,23 @@ TEST(rank_ladder_china_ships_the_wiki_ladder)
RankLadder prc = china();
CHECK( shippedLadder( prc, "China" ) );
- /* self: Hardy, and Last stand from the Major General */
+ /* self: Hardy, the NCOs' old auras on the man himself (shoulder to shoulder 4% then 7% while he
+ stands, rate of fire, mend), and Last stand from the Major General */
CHECK_EQ( prc.perk( 1, RANK_PERK_HEALTH ), 0.0f );
CHECK_NEAR( prc.perk( 2, RANK_PERK_HEALTH ), 0.08f, 1e-6f );
+ CHECK_NEAR( prc.perk( 3, RANK_PERK_STILL_GUARD ), 0.04f, 1e-6f );
+ CHECK_NEAR( prc.perk( 8, RANK_PERK_STILL_GUARD ), 0.07f, 1e-6f );
+ CHECK_NEAR( prc.perk( 6, RANK_PERK_RATE_OF_FIRE ), 0.05f, 1e-6f );
+ CHECK_NEAR( prc.perk( 7, RANK_PERK_MEND ), 0.005f, 1e-6f );
CHECK_EQ( prc.perk( 16, RANK_PERK_LAST_STAND ), 0.0f );
CHECK_NEAR( prc.perk( 17, RANK_PERK_LAST_STAND ), 0.25f, 1e-6f );
- /* guard I to III, steady to Fearless's -50%, seize, and forced march for infantry only */
- CHECK_NEAR( prc.aura( 3, RANK_AURA_GUARD ), 0.04f, 1e-6f );
- CHECK_NEAR( prc.auraRadius( 3, RANK_AURA_GUARD ), 80.0f, 1e-3f );
+ /* guard from the Lieutenant Colonel, steady at Fearless's -50%, seize, and forced march for
+ infantry only */
+ CHECK_EQ( prc.aura( 13, RANK_AURA_GUARD ), 0.0f );
CHECK_NEAR( prc.aura( 14, RANK_AURA_GUARD ), 0.10f, 1e-6f );
+ CHECK_NEAR( prc.auraRadius( 14, RANK_AURA_GUARD ), 160.0f, 1e-3f );
+ CHECK_EQ( prc.aura( 10, RANK_AURA_STEADY ), 0.0f );
CHECK_NEAR( prc.aura( 11, RANK_AURA_STEADY ), 0.50f, 1e-6f );
CHECK_NEAR( prc.aura( 12, RANK_AURA_CAPTURE ), 0.30f, 1e-6f );
CHECK_NEAR( prc.aura( 16, RANK_AURA_PACE ), 0.08f, 1e-6f );
@@ -324,8 +337,10 @@ TEST(rank_ladder_gla_ships_the_wiki_ladder)
RankLadder gla_ = gla();
CHECK( shippedLadder( gla_, "GLA" ) );
- /* self: Light feet, Patch-up, Scavenger, Tough, Cell survives */
+ /* self: Light feet, then Move with me's 8% on the Squadhand himself, Patch-up, Scavenger, Tough,
+ Cell survives */
CHECK_NEAR( gla_.perk( 2, RANK_PERK_SPEED ), 0.05f, 1e-6f );
+ CHECK_NEAR( gla_.perk( 6, RANK_PERK_SPEED ), 0.08f, 1e-6f );
CHECK_NEAR( gla_.perk( 3, RANK_PERK_MEND ), 0.005f, 1e-6f );
CHECK_EQ( gla_.perk( 3, RANK_PERK_SCAVENGE ), 0.0f );
CHECK_NEAR( gla_.perk( 4, RANK_PERK_SCAVENGE ), 0.10f, 1e-6f );
@@ -333,14 +348,16 @@ TEST(rank_ladder_gla_ships_the_wiki_ladder)
CHECK_EQ( gla_.perk( 17, RANK_PERK_SALVAGE_CRATE ), 0.0f );
CHECK_NEAR( gla_.perk( 18, RANK_PERK_SALVAGE_CRATE ), 1.0f, 1e-6f );
- /* pace I is infantry's, pace II as strong for every unit replaces it, III is stronger */
- CHECK_EQ( (Int)gla_.auraReach( 6, RANK_AURA_PACE ), (Int)RANK_REACH_INFANTRY );
+ /* pace I from the Raid Captain for every unit, II stronger */
+ CHECK_EQ( gla_.aura( 9, RANK_AURA_PACE ), 0.0f );
+ CHECK_NEAR( gla_.aura( 10, RANK_AURA_PACE ), 0.08f, 1e-6f );
CHECK_EQ( (Int)gla_.auraReach( 10, RANK_AURA_PACE ), (Int)RANK_REACH_UNITS );
CHECK_NEAR( gla_.auraRadius( 10, RANK_AURA_PACE ), 120.0f, 1e-3f );
CHECK_NEAR( gla_.aura( 15, RANK_AURA_PACE ), 0.12f, 1e-6f );
- /* spoils I to III, the last one paying for buildings' kills too */
- CHECK_NEAR( gla_.aura( 7, RANK_AURA_SPOILS ), 0.05f, 1e-6f );
+ /* spoils I and II from the Sector Commander, the last one paying for buildings' kills too */
+ CHECK_EQ( gla_.aura( 13, RANK_AURA_SPOILS ), 0.0f );
+ CHECK_NEAR( gla_.aura( 14, RANK_AURA_SPOILS ), 0.10f, 1e-6f );
CHECK_EQ( (Int)gla_.auraReach( 14, RANK_AURA_SPOILS ), (Int)RANK_REACH_UNITS );
CHECK_NEAR( gla_.aura( 17, RANK_AURA_SPOILS ), 0.15f, 1e-6f );
CHECK_EQ( (Int)gla_.auraReach( 17, RANK_AURA_SPOILS ), (Int)RANK_REACH_STRUCTURES );
@@ -408,7 +425,7 @@ TEST(rank_ladder_perk_line_grammar_refuses_what_it_does_not_know)
TEST(rank_ladder_drill_teaches_up_to_its_cap_and_no_further)
{
const RankLadder usa = america();
- /* a Crusader, E 100, 5% a second under a drill aura I (Corporal, grade 4) */
+ /* a Crusader, E 100, 5% a second under a drill aura capped at Corporal (grade 4) */
const Int corporal = usa.threshold( 100, 4 );
CHECK_EQ( usa.drillGain( 100, 0, 4, 0.05f ), 5 );
CHECK_EQ( usa.drillGain( 100, corporal - 2, 4, 0.05f ), 2 );
@@ -434,3 +451,63 @@ TEST(rank_ladder_drill_caps_below_the_grade_that_gives_it)
CHECK( side.ladder.aura( grade, RANK_AURA_DRILL ) < (Real)grade );
}
}
+
+TEST(rank_ladder_no_aura_below_the_elite_pin)
+{
+ /* squads of corporals and sergeants ringing and buffing each other: auras are for officers */
+ struct Side { const char *name; RankLadder ladder; } sides[] =
+ {
+ { "America", america() }, { "China", china() }, { "GLA", gla() },
+ { "Turkiye", makeLadder( 21, 4, 11, 16, 16, 1.42f, 1.19f, 1.42f ) },
+ };
+ for( Side &side : sides )
+ {
+ CHECK( shippedLadder( side.ladder, side.name ) );
+ for( Int grade = 0; grade < side.ladder.m_pin[LEVEL_ELITE]; ++grade )
+ for( Int kind = 0; kind < RANK_AURA_COUNT; ++kind )
+ {
+ if( side.ladder.aura( grade, (RankAura)kind ) > 0.0f )
+ printf( " %s grade %d gives %s\n", side.name, grade, TheRankAuraNames[ kind ] );
+ CHECK_EQ( side.ladder.aura( grade, (RankAura)kind ), 0.0f );
+ }
+ }
+}
+
+TEST(rank_ladder_red_guard_training_gives_three_grades)
+{
+ /* every object Red Guard Training reaches gives three grades through StartingGrades and names no
+ StartingLevel, or the build button would show a Veteran chevron the unit no longer gets */
+ FILE *fp = fopen( BALANCE_REFORGED_INI, "rb" );
+ CHECK( fp != NULL );
+ if( fp == NULL )
+ return;
+ static char text[ 1 << 20 ];
+ text[ fread( text, 1, sizeof( text ) - 1, fp ) ] = '\0';
+ fclose( fp );
+ const char *const trained[] =
+ {
+ "ChinaInfantryRedguard", "Nuke_ChinaInfantryRedguard", "Tank_ChinaInfantryRedguard", "Infa_ChinaInfantryMiniGunner",
+ };
+ for( const char *name : trained )
+ {
+ char header[ 96 ];
+ snprintf( header, sizeof( header ), "\nObject %s", name );
+ const char *block = strstr( text, header );
+ while( block && strchr( "\r\n", block[ strlen( header ) ] ) == NULL ) // not a longer name
+ block = strstr( block + 1, header );
+ CHECK( block != NULL );
+ if( block == NULL )
+ continue;
+ const char *end = strstr( block + 1, "\nEnd" ); // the object's own End; a module's is indented
+ const char *grades = strstr( block, "StartingGrades = 3" );
+ const char *level = strstr( block, "StartingLevel" );
+ CHECK( end != NULL && grades != NULL && grades < end );
+ CHECK( level == NULL || level > end );
+ }
+
+ /* a Red Guard lands on Corporal, short of the Veteran pin; the Infantry General's Mini-Gunner,
+ always Veteran, three grades above the pin and short of Elite */
+ const RankLadder prc = china();
+ CHECK_EQ( prc.levelOf( 3 ), LEVEL_REGULAR );
+ CHECK_EQ( prc.levelOf( prc.m_pin[LEVEL_VETERAN] + 3 ), LEVEL_VETERAN );
+}