SiegeEngineers / aoe2techtree

Age of Empires II Tech Tree
https://aoe2techtree.net/
MIT License
225 stars 59 forks source link

Armenians Barracks Units available on Age earlier #136

Closed denniske closed 10 months ago

denniske commented 11 months ago

The Armenians Militia and Spearman line need to go one line up:

image
HSZemi commented 11 months ago

Indeed, just as Burgundian eco upgrades need to be available one age earlier. Which is sadly a bit tricky to do with how the tech tree is constructed. But if you have a smart idea how to implement that in a generic way, go ahead 😬

denniske commented 11 months ago

Well I have so many manual overrides in the tech tree implementation in the aoe2companion app that I am sure I am not the right candidate for this job 😅 I will still take a look when I have some time.

denniske commented 11 months ago

What do you think about this?

const unitAges = {
    BARRACKS: 'dark',
    MILITIA: 'dark',
    MAN_AT_ARMS: 'feudal',
    LONG_SWORDSMAN: 'castle',
    TWO_HANDED_SWORDSMAN: 'imperial',
    CHAMPION: 'imperial',
    LEGIONARY: 'imperial',
}

if (civ == 'armenians') {
    unitAges['LONG_SWORDSMAN'] = 'feudal';
    unitAges['TWO_HANDED_SWORDSMAN'] = 'castle';
}

const barracks = {
    item: building(BARRACKS),
    children: [{
        item: unit(MILITIA),
        children: [{
            item: unit(MAN_AT_ARMS),
            children: [{
                item: unit(LONG_SWORDSMAN),
                children: [{
                    item: unit(TWO_HANDED_SWORDSMAN),
                    children: [{
                        item: unit(CHAMPION)
                    }]
                }, {
                    item: unit(uniqueunit(LEGIONARY))
                }]
            }]
        }]
    }]
};

// Now make a function that generates this from the above data:

let barrackslane = new Lane();
barrackslane.rows.dark_1.push(building(BARRACKS));
barrackslane.rows.dark_2.push(unit(MILITIA));
barrackslane.rows.feudal_1.push(unit(MAN_AT_ARMS));
barrackslane.rows.feudal_1.push(tech(SUPPLIES));
barrackslane.rows.feudal_1.push(unit(SPEARMAN));
barrackslane.rows.feudal_1.push(unit(EAGLE_SCOUT));
barrackslane.rows.castle_1.push(unit(LONG_SWORDSMAN));
barrackslane.rows.castle_1.push(tech(GAMBESONS));
barrackslane.rows.castle_1.push(unit(PIKEMAN));
barrackslane.rows.castle_1.push(unit(EAGLE_WARRIOR));
barrackslane.rows.castle_1.push(tech(SQUIRES));
barrackslane.rows.castle_1.push(tech(ARSON));
barrackslane.rows.imperial_1.push(unit(TWO_HANDED_SWORDSMAN));
barrackslane.rows.imperial_1.push(uniqueunit(LEGIONARY));
barrackslane.rows.imperial_2.push(unit(CHAMPION));
barrackslane.rows.imperial_1.push(unit(HALBERDIER));
barrackslane.rows.imperial_1.push(unit(ELITE_EAGLE_WARRIOR));
barrackslane.rows.imperial_1.push(uniqueunit(CONDOTTIERO));
barrackslane.rows.imperial_1.push(uniqueunit(FLEMISHPIKEMAN));
tree.lanes.push(barrackslane);
denniske commented 11 months ago

There also seems to be information about the age which units are available at per civ in the file civTechTrees.json in the aoe folder:

image

Age ID

HSZemi commented 10 months ago

Alright, so I had an idea: grafik

It's already implemented as well. I think this works? :thinking:

denniske commented 10 months ago

Yes that looks good. Also this makes it easy to see which units are affected by the age shift 👍