Skip to content

Commit

Permalink
Add a counter to available mercs into tab select buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziktofel committed Aug 16, 2024
1 parent 0119994 commit ef77e3e
Show file tree
Hide file tree
Showing 9 changed files with 1,611 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11638,14 +11638,17 @@
<CAbilEffectInstant id="AP_MercCompoundInfantry">
<Effect index="0" value="AP_MercCompoundInfantryTabSet"/>
<CmdButtonArray index="Execute" DefaultButtonFace="AP_MercInfantry" Requirements="AP_MercCompoundCanSwitchInfantry"/>
<Cost index="0"/>
</CAbilEffectInstant>
<CAbilEffectInstant id="AP_MercCompoundVehicles">
<Effect index="0" value="AP_MercCompoundVehiclesTabSet"/>
<CmdButtonArray index="Execute" DefaultButtonFace="AP_MercVehicle" Requirements="AP_MercCompoundCanSwitchVehicles"/>
<Cost index="0"/>
</CAbilEffectInstant>
<CAbilEffectInstant id="AP_MercCompoundStarships">
<Effect index="0" value="AP_MercCompoundStarshipsTabSet"/>
<CmdButtonArray index="Execute" DefaultButtonFace="AP_MercShip" Requirements="AP_MercCompoundCanSwitchStarships"/>
<Cost index="0"/>
</CAbilEffectInstant>
<CAbilQueue id="AP_que7">
<EditorCategories value="Race:Neutral,AbilityorEffectType:Structures"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13181,4 +13181,40 @@
<CUpgrade id="AP_MercCompoundInfantrySelected"/>
<CUpgrade id="AP_MercCompoundVehiclesSelected"/>
<CUpgrade id="AP_MercCompoundStarshipsSelected"/>
<CUpgrade id="AP_MercCompoundInfantryCounter">
<MaxLevel value="127"/>
<EffectArray Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountMax" Value="1"/>
<EffectArray Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountStart" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountUse" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.TimeUse" Value="0.01"/>
</CUpgrade>
<CUpgrade id="AP_MercCompoundInfantryCounterNothingReady">
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountUse" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountStart" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundInfantry,Cost[0].Charge.CountMax" Value="0"/>
</CUpgrade>
<CUpgrade id="AP_MercCompoundVehiclesCounter">
<MaxLevel value="127"/>
<EffectArray Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountMax" Value="1"/>
<EffectArray Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountStart" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountUse" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.TimeUse" Value="0.01"/>
</CUpgrade>
<CUpgrade id="AP_MercCompoundVehiclesCounterNothingReady">
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountUse" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountStart" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundVehicles,Cost[0].Charge.CountMax" Value="0"/>
</CUpgrade>
<CUpgrade id="AP_MercCompoundStarshipsCounter">
<MaxLevel value="127"/>
<EffectArray Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountMax" Value="1"/>
<EffectArray Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountStart" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountUse" Value="1"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.TimeUse" Value="0.01"/>
</CUpgrade>
<CUpgrade id="AP_MercCompoundStarshipsCounterNothingReady">
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountUse" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountStart" Value="0"/>
<EffectArray Operation="Set" Reference="Abil,AP_MercCompoundStarships,Cost[0].Charge.CountMax" Value="0"/>
</CUpgrade>
</Catalog>
145 changes: 145 additions & 0 deletions Mods/ArchipelagoPlayer.SC2Mod/Base.SC2Data/Lib15EF4C78.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -2941,6 +2941,66 @@ int lib15EF4C78_gf_AP_Player_getKerriganLevel (int lp_player) {
return lib15EF4C78_gv_zS_KerriganLevel[lp_player];
}

void lib15EF4C78_gf_AP_Player_Terran_MercCompoundUpdateAvailableCount (int lp_player) {
// Variable Declarations
int lv_index;
int lv_readyInfantryCount;
int lv_readyVehiclesCount;
int lv_readyStarshipsCount;
string lv_cooldownLink;
abilcmd lv_abiltyCommand;
int lv_mercenaryClass;

// Automatic Variable Declarations
const int auto561E814D_ae = lib15EF4C78_gv_aP_Player_Terran_MERC_COOLDOWN_LINK_SIZE;
const int auto561E814D_ai = 1;
int autoF7824E53_val;

// Variable Initialization
lv_cooldownLink = "";

// Implementation
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundInfantryCounterNothingReady", 0);
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundStarshipsCounterNothingReady", 0);
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundVehiclesCounterNothingReady", 0);
lv_index = 0;
for ( ; ( (auto561E814D_ai >= 0 && lv_index <= auto561E814D_ae) || (auto561E814D_ai < 0 && lv_index >= auto561E814D_ae) ) ; lv_index += auto561E814D_ai ) {
lv_abiltyCommand = lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[lv_index];
lv_cooldownLink = lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[lv_index];
lv_mercenaryClass = lib15EF4C78_gv_aP_Player_Terran_MercType[lv_index];
if ((TechTreeAbilityIsAllowed(lp_player, lv_abiltyCommand) == true) && (PlayerGetCooldown(lp_player, lv_cooldownLink) <= 0.0)) {
autoF7824E53_val = lv_mercenaryClass;
if (autoF7824E53_val == lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY) {
lv_readyInfantryCount = (lv_readyInfantryCount + 1);
}
else if (autoF7824E53_val == lib15EF4C78_ge_AP_Player_Terran_MercenaryType_VEHICLE) {
lv_readyVehiclesCount = (lv_readyVehiclesCount + 1);
}
else if (autoF7824E53_val == lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP) {
lv_readyStarshipsCount = (lv_readyStarshipsCount + 1);
}
else {
}
}

}
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundInfantryCounter", lv_readyInfantryCount);
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundVehiclesCounter", lv_readyVehiclesCount);
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundStarshipsCounter", lv_readyStarshipsCount);
if ((lv_readyInfantryCount == 0)) {
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundInfantryCounterNothingReady", 1);
}

if ((lv_readyVehiclesCount == 0)) {
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundVehiclesCounterNothingReady", 1);
}

if ((lv_readyStarshipsCount == 0)) {
libNtve_gf_SetUpgradeLevelForPlayer(lp_player, "AP_MercCompoundStarshipsCounterNothingReady", 1);
}

}

void lib15EF4C78_gf_RemoveUnusedStartingUnits (unitgroup lp_startingUnits, string lp_desiredFaction) {
// Automatic Variable Declarations
unitgroup autoA0E4A284_g;
Expand Down Expand Up @@ -6859,38 +6919,55 @@ bool lib15EF4C78_gt_AP_Player_Terran_Merc_ArrayInit_Func (bool testConds, bool r

lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[0] = "AP_KelMorianMercs";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[0] = AbilityCommand("AP_SummonMercenaries", 0);
lib15EF4C78_gv_aP_Player_Terran_MercType[0] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[1] = "AP_DevilDogs";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[1] = AbilityCommand("AP_SummonMercenaries", 1);
lib15EF4C78_gv_aP_Player_Terran_MercType[1] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[2] = "AP_SpartanCompany";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[2] = AbilityCommand("AP_SummonMercenaries", 2);
lib15EF4C78_gv_aP_Player_Terran_MercType[2] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_VEHICLE;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[3] = "AP_HammerSecurities";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[3] = AbilityCommand("AP_SummonMercenaries", 3);
lib15EF4C78_gv_aP_Player_Terran_MercType[3] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[4] = "AP_SiegeBreakers";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[4] = AbilityCommand("AP_SummonMercenaries", 4);
lib15EF4C78_gv_aP_Player_Terran_MercType[4] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_VEHICLE;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[5] = "AP_HelsAngels";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[5] = AbilityCommand("AP_SummonMercenaries", 5);
lib15EF4C78_gv_aP_Player_Terran_MercType[5] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[6] = "AP_DuskWing";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[6] = AbilityCommand("AP_SummonMercenaries", 6);
lib15EF4C78_gv_aP_Player_Terran_MercType[6] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[7] = "AP_DukesRevenge";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[7] = AbilityCommand("AP_SummonMercenaries", 7);
lib15EF4C78_gv_aP_Player_Terran_MercType[7] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[8] = "AP_MercMedic";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[8] = AbilityCommand("AP_SummonMercenaries", 8);
lib15EF4C78_gv_aP_Player_Terran_MercType[8] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[9] = "AP_MercReaper";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[9] = AbilityCommand("AP_SummonMercenaries", 9);
lib15EF4C78_gv_aP_Player_Terran_MercType[9] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_INFANTRY;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[10] = "AP_MercWraith";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[10] = AbilityCommand("AP_SummonMercenaries", 10);
lib15EF4C78_gv_aP_Player_Terran_MercType[10] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[11] = "AP_MercLiberator";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[11] = AbilityCommand("AP_SummonMercenaries", 11);
lib15EF4C78_gv_aP_Player_Terran_MercType[11] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[12] = "AP_BrynhildFighter";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[12] = AbilityCommand("AP_SummonMercenaries", 12);
lib15EF4C78_gv_aP_Player_Terran_MercType[12] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_STARSHIP;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[13] = "AP_MercThor";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[13] = AbilityCommand("AP_SummonMercenaries", 13);
lib15EF4C78_gv_aP_Player_Terran_MercType[13] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_VEHICLE;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[14] = "AP_InfestedMedics";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[14] = AbilityCommand("AP_SummonInfestedMercs", 0);
lib15EF4C78_gv_aP_Player_Terran_MercType[14] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_ZERG;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[15] = "AP_InfestedSiegeTanks";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[15] = AbilityCommand("AP_SummonInfestedMercs", 1);
lib15EF4C78_gv_aP_Player_Terran_MercType[15] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_ZERG;
lib15EF4C78_gv_aP_Player_Terran_MercCooldownLinks[16] = "AP_InfestedBanshees";
lib15EF4C78_gv_aP_Player_Terran_MercAbilityCommands[16] = AbilityCommand("AP_SummonInfestedMercs", 2);
lib15EF4C78_gv_aP_Player_Terran_MercType[16] = lib15EF4C78_ge_AP_Player_Terran_MercenaryType_ZERG;
return true;
}

Expand Down Expand Up @@ -6984,6 +7061,72 @@ void lib15EF4C78_gt_AP_Player_Terran_MercCompoundTabSetStarships_Init () {
TriggerAddEventPlayerEffectUsed(lib15EF4C78_gt_AP_Player_Terran_MercCompoundTabSetStarships, c_playerAny, "AP_MercCompoundStarshipsTabSet");
}

//--------------------------------------------------------------------------------------------------
// Trigger: AP_Player_Terran_MercCompoundUpdateCounts
//--------------------------------------------------------------------------------------------------
bool lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts_Func (bool testConds, bool runActions) {
// Variable Declarations
int lv_player;

// Automatic Variable Declarations
playergroup autoD79E6013_g;

// Variable Initialization

// Actions
if (!runActions) {
return true;
}

autoD79E6013_g = PlayerGroupAll();
lv_player = -1;
while (true) {
lv_player = PlayerGroupNextPlayer(autoD79E6013_g, lv_player);
if (lv_player < 0) { break; }
lib15EF4C78_gf_AP_Player_Terran_MercCompoundUpdateAvailableCount(lv_player);
}
return true;
}

//--------------------------------------------------------------------------------------------------
void lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts_Init () {
lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts = TriggerCreate("lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts_Func");
TriggerAddEventTimePeriodic(lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts, 1.0, c_timeGame);
}

//--------------------------------------------------------------------------------------------------
// Trigger: AP_Player_TerranMercCompoundOnMercUse
//--------------------------------------------------------------------------------------------------
bool lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse_Func (bool testConds, bool runActions) {
// Automatic Variable Declarations
// Actions
if (!runActions) {
return true;
}

lib15EF4C78_gf_AP_Player_Terran_MercCompoundUpdateAvailableCount(EventPlayer());
return true;
}

//--------------------------------------------------------------------------------------------------
void lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse_Init () {
lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse = TriggerCreate("lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse_Func");
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 0), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 1), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 2), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 3), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 4), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 5), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 6), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 7), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 8), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 9), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 10), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 11), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 12), c_unitAbilStageExecute, false);
TriggerAddEventUnitAbility(lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse, null, AbilityCommand("AP_SummonMercenaries", 13), c_unitAbilStageExecute, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MedivacTankPickup
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -7351,6 +7494,8 @@ void lib15EF4C78_InitTriggers () {
lib15EF4C78_gt_AP_Player_Terran_MercCompoundTabSetInfantry_Init();
lib15EF4C78_gt_AP_Player_Terran_MercCompoundTabSetVehicles_Init();
lib15EF4C78_gt_AP_Player_Terran_MercCompoundTabSetStarships_Init();
lib15EF4C78_gt_AP_Player_Terran_MercCompoundUpdateCounts_Init();
lib15EF4C78_gt_AP_Player_TerranMercCompoundOnMercUse_Init();
lib15EF4C78_gt_MedivacTankPickup_Init();
lib15EF4C78_gt_MedivacTankDrop_Init();
lib15EF4C78_gt_MedivacMercTankPickup_Init();
Expand Down
Loading

0 comments on commit ef77e3e

Please sign in to comment.