1
0
forked from 0ad/0ad

Turret walls on Jebel Barkal & outposts on Danubius again

After they had been broken in 21e866fcf0

Author / patch by: @lairkers

Troubleshooting / comments by @elexis @Freagarach

Fixes #6831

This was SVN commit r27937.
This commit is contained in:
marder 2023-11-18 16:10:58 +00:00
parent 0dcaefc2f6
commit f544c6776b
3 changed files with 44 additions and 10 deletions

View File

@ -19,6 +19,7 @@ const danubiusAttackerTemplates = deepfreeze({
"healers": TriggerHelper.GetTemplateNamesByClasses("Healer", "gaul", undefined, undefined, true), "healers": TriggerHelper.GetTemplateNamesByClasses("Healer", "gaul", undefined, undefined, true),
"champions": TriggerHelper.GetTemplateNamesByClasses("Champion", "gaul", undefined, undefined, true), "champions": TriggerHelper.GetTemplateNamesByClasses("Champion", "gaul", undefined, undefined, true),
"champion_infantry": TriggerHelper.GetTemplateNamesByClasses("Champion+Infantry", "gaul", undefined, undefined, true), "champion_infantry": TriggerHelper.GetTemplateNamesByClasses("Champion+Infantry", "gaul", undefined, undefined, true),
"infantry_ranged": TriggerHelper.GetTemplateNamesByClasses("Infantry+Ranged", "gaul", undefined, undefined, true),
"citizen_soldiers": TriggerHelper.GetTemplateNamesByClasses("CitizenSoldier", "gaul", undefined, "Basic", true), "citizen_soldiers": TriggerHelper.GetTemplateNamesByClasses("CitizenSoldier", "gaul", undefined, "Basic", true),
"heroes": [ "heroes": [
// Excludes the Vercingetorix variant // Excludes the Vercingetorix variant
@ -46,11 +47,18 @@ var gallicBuildingGarrison = [
"unitTemplates": danubiusAttackerTemplates.champions, "unitTemplates": danubiusAttackerTemplates.champions,
}, },
{ {
"buildingClasses": ["Tower", "Outpost"], "buildingClasses": ["Tower"],
"unitTemplates": danubiusAttackerTemplates.champion_infantry "unitTemplates": danubiusAttackerTemplates.champion_infantry
} }
]; ];
var gallicBuildingTurret = [
{
"buildingClasses": ["Outpost"],
"unitTemplates": danubiusAttackerTemplates.infantry_ranged
}
];
/** /**
* Notice if gaia becomes too strong, players will just turtle and try to outlast the players on the other side. * Notice if gaia becomes too strong, players will just turtle and try to outlast the players on the other side.
* However we want interaction and fights between the teams. * However we want interaction and fights between the teams.
@ -200,6 +208,18 @@ Trigger.prototype.GarrisonAllGallicBuildings = function()
} }
}; };
Trigger.prototype.TurretAllGallicBuildings = function()
{
this.debugLog("Turreting all gallic buildings");
for (let buildingTurret of gallicBuildingTurret)
for (let buildingClass of buildingTurret.buildingClasses)
{
let unitCounts = TriggerHelper.SpawnAndTurretAtClasses(gaulPlayer, buildingClass, buildingTurret.unitTemplates, 1);
this.debugLog("Turreting at " + buildingClass + ": " + uneval(unitCounts));
}
};
/** /**
* Spawn units of the template at each gaia Civic Center and set them to defensive. * Spawn units of the template at each gaia Civic Center and set them to defensive.
*/ */
@ -627,6 +647,7 @@ Trigger.prototype.InitDanubius = function()
this.StartCelticRitual(); this.StartCelticRitual();
this.GarrisonAllGallicBuildings(); this.GarrisonAllGallicBuildings();
this.TurretAllGallicBuildings();
this.SpawnInitialCCDefenders(); this.SpawnInitialCCDefenders();
this.SpawnCCAttackers(); this.SpawnCCAttackers();

View File

@ -68,8 +68,8 @@ var jebelBarkal_formations = [
var scaleByTime = (minCurrent, min0, min60) => min0 + (min60 - min0) * Math.min(1, minCurrent / 60); var scaleByTime = (minCurrent, min0, min60) => min0 + (min60 - min0) * Math.min(1, minCurrent / 60);
/** /**
* @returns min0 value at the beginning of the game, min60 after an hour of gametime or longer and * @returns min value at map size 128 (very small), max at map size 512 and
* a proportionate number between these two values before the first hour is reached. * a proportionate number between these two values.
*/ */
var scaleByMapSize = (min, max) => min + (max - min) * (TriggerHelper.GetMapSizeTiles() - 128) / (512 - 128); var scaleByMapSize = (min, max) => min + (max - min) * (TriggerHelper.GetMapSizeTiles() - 128) / (512 - 128);
@ -191,12 +191,18 @@ var jebelBarkal_buildingGarrison = difficulty => [
}, },
{ {
"buildingClasses": ["StoneWall+Tower"], "buildingClasses": ["WallTower"],
"unitTemplates": jebelBarkal_templates.champion_infantry_ranged, "unitTemplates": jebelBarkal_templates.champion_infantry_ranged,
"capacityRatio": difficulty > 3 ? 1 : 0 "capacityRatio": difficulty > 3 ? 1 : 0
}, }
];
/**
* This defines which units are spawned and turretted at the gamestart per building.
*/
var jebelBarkal_buildingTurret = difficulty => [
{ {
"buildingClasses": ["StoneWall+!Tower"], "buildingClasses": ["WallLong", "WallMedium", "WallShort"],
"unitTemplates": difficulty > 3 ? jebelBarkal_templates.champion_infantry_ranged : jebelBarkal_templates.citizenSoldier_infantry_ranged, "unitTemplates": difficulty > 3 ? jebelBarkal_templates.champion_infantry_ranged : jebelBarkal_templates.citizenSoldier_infantry_ranged,
"capacityRatio": (difficulty - 2) / 3 "capacityRatio": (difficulty - 2) / 3
} }
@ -369,6 +375,7 @@ Trigger.prototype.JebelBarkal_Init = function()
this.JebelBarkal_SetDefenderStance(); this.JebelBarkal_SetDefenderStance();
this.JebelBarkal_StartRitualAnimations(); this.JebelBarkal_StartRitualAnimations();
this.JebelBarkal_GarrisonBuildings(); this.JebelBarkal_GarrisonBuildings();
this.JebelBarkal_TurretBuildings();
this.DoAfterDelay(jebelBarkal_firstCityPatrolTime(this.GetDifficulty(), isNomad) * 60 * 1000, "JebelBarkal_SpawnCityPatrolGroups", {}); this.DoAfterDelay(jebelBarkal_firstCityPatrolTime(this.GetDifficulty(), isNomad) * 60 * 1000, "JebelBarkal_SpawnCityPatrolGroups", {});
this.JebelBarkal_StartAttackTimer(jebelBarkal_firstAttackTime(this.GetDifficulty(), isNomad)); this.JebelBarkal_StartAttackTimer(jebelBarkal_firstAttackTime(this.GetDifficulty(), isNomad));
}; };
@ -433,6 +440,12 @@ Trigger.prototype.JebelBarkal_GarrisonBuildings = function()
TriggerHelper.SpawnAndGarrisonAtClasses(jebelBarkal_playerID, buildingGarrison.buildingClasses, buildingGarrison.unitTemplates, buildingGarrison.capacityRatio); TriggerHelper.SpawnAndGarrisonAtClasses(jebelBarkal_playerID, buildingGarrison.buildingClasses, buildingGarrison.unitTemplates, buildingGarrison.capacityRatio);
}; };
Trigger.prototype.JebelBarkal_TurretBuildings = function()
{
for (let buildingTurret of jebelBarkal_buildingTurret(this.GetDifficulty()))
TriggerHelper.SpawnAndTurretAtClasses(jebelBarkal_playerID, buildingTurret.buildingClasses, buildingTurret.unitTemplates, buildingTurret.capacityRatio);
};
/** /**
* Spawn new groups if old ones were wiped out. * Spawn new groups if old ones were wiped out.
*/ */

View File

@ -556,14 +556,14 @@ TriggerHelper.SpawnAndGarrisonAtClasses = function(playerID, classes, templates,
for (let entGarrisonHolder of Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(playerID)) for (let entGarrisonHolder of Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(playerID))
{ {
let cmpIdentity = Engine.QueryInterface(entGarrisonHolder, IID_Identity);
if (!cmpIdentity || !MatchesClassList(cmpIdentity.GetClassesList(), classes))
continue;
let cmpGarrisonHolder = Engine.QueryInterface(entGarrisonHolder, IID_GarrisonHolder); let cmpGarrisonHolder = Engine.QueryInterface(entGarrisonHolder, IID_GarrisonHolder);
if (!cmpGarrisonHolder) if (!cmpGarrisonHolder)
continue; continue;
let cmpIdentity = Engine.QueryInterface(entGarrisonHolder, IID_Identity);
if (!cmpIdentity || !MatchesClassList(cmpIdentity.GetClassesList(), classes))
continue;
// TODO: account for already garrisoned entities and garrison size. // TODO: account for already garrisoned entities and garrison size.
results[entGarrisonHolder] = this.RandomTemplateComposition(templates, Math.floor(cmpGarrisonHolder.GetCapacity() * capacityPercent)); results[entGarrisonHolder] = this.RandomTemplateComposition(templates, Math.floor(cmpGarrisonHolder.GetCapacity() * capacityPercent));