Skip to content

Commit

Permalink
Add Chronicles: Battle for Greece civs
Browse files Browse the repository at this point in the history
  • Loading branch information
HSZemi committed Oct 27, 2024
1 parent 8140ebb commit 05e8e6e
Show file tree
Hide file tree
Showing 26 changed files with 125 additions and 15 deletions.
Binary file added public/images/civemblems/achaemenids.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/civemblems/athenians.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/civemblems/spartans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/civs/achaemenids.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/civs/athenians.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/civs/spartans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added public/images/units-animated/athenians-left.apng
Binary file not shown.
Binary file not shown.
Binary file added public/images/units-animated/spartans-left.apng
Binary file not shown.
Binary file added public/images/units-animated/spartans-right.apng
Binary file not shown.
13 changes: 7 additions & 6 deletions src/__tests__/models/CivilisationEncoder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ it('vikings only yields 2^30', () => {
expect(encoded).toEqual('40000000');
});

it('all 45+1 civs yield 2^46-1', () => {
it('all 45+1+3 civs yield 2^49-1', () => {
const encoded = CivilisationEncoder.encodeCivilisationArray(Civilisation.ALL);
expect(Civilisation.ALL.length).toEqual(45+1);
expect(Civilisation.ALL.length).toEqual(45+1+3);
expect(Civilisation.ALL_ACTIVE.length).toEqual(45);
expect(encoded).toEqual(CivilisationEncoder.toHexString(Math.pow(2, 46) - 1));
expect(encoded).toEqual('3fffffffffff');
expect(encoded).toEqual(CivilisationEncoder.toHexString(Math.pow(2, 49) - 1));
expect(encoded).toEqual('1ffffffffffff');
});

it('decode 0 yields empty array', () => {
Expand All @@ -44,8 +44,8 @@ it('decode 2^30 yields vikings', () => {

});

it('decode 2^46-1 yields all civs', () => {
const decoded = CivilisationEncoder.decodeCivilisationArray('3fffffffffff');
it('decode 2^49-1 yields all civs', () => {
const decoded = CivilisationEncoder.decodeCivilisationArray('1ffffffffffff');
expect(decoded).toEqual([...Civilisation.ALL].sort((a, b) => a.name.localeCompare(b.name)));
});

Expand All @@ -68,6 +68,7 @@ describe('The decoding shortcut does not lie', () => {
${'7ffffffefff'} | ${42}
${'fffffffefff'} | ${43}
${'3fffffffefff'} | ${45}
${'1ffffffffefff'} | ${48}
`('$civilisationArray', ({civilisationArray, expectedLength}) => {
const decoded = CivilisationEncoder.decodeCivilisationArray(civilisationArray);
expect(decoded.length).toEqual(expectedLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,5 +600,44 @@ Array [
},
"name": "Georgians",
},
Civilisation {
"category": "default",
"gameVersion": 12,
"i18nPrefix": "civs.",
"id": "Achemenids",
"imageUrls": Object {
"animated_left": "/images/units-animated/achemenids-left.apng",
"animated_right": "/images/units-animated/achemenids-right.apng",
"emblem": "/images/civemblems/achemenids.png",
"unit": "/images/civs/achemenids.png",
},
"name": "Achemenids",
},
Civilisation {
"category": "default",
"gameVersion": 12,
"i18nPrefix": "civs.",
"id": "Athenians",
"imageUrls": Object {
"animated_left": "/images/units-animated/athenians-left.apng",
"animated_right": "/images/units-animated/athenians-right.apng",
"emblem": "/images/civemblems/athenians.png",
"unit": "/images/civs/athenians.png",
},
"name": "Athenians",
},
Civilisation {
"category": "default",
"gameVersion": 12,
"i18nPrefix": "civs.",
"id": "Spartans",
"imageUrls": Object {
"animated_left": "/images/units-animated/spartans-left.apng",
"animated_right": "/images/units-animated/spartans-right.apng",
"emblem": "/images/civemblems/spartans.png",
"unit": "/images/civs/spartans.png",
},
"name": "Spartans",
},
]
`;
16 changes: 8 additions & 8 deletions src/__tests__/models/__snapshots__/NameGenerator.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
exports[`NameGenerator yields deterministic results 1`] = `
Array [
"King Alfonso",
"Yaroslav the Wise",
"Lothair II",
"Vasco da Gama",
"Frederick Barbarossa",
"King Alfonso",
"Henry Bolingbroke",
"Nasiruddin Mahmud Shah",
"Waterlily Jaguar",
"Maxixca",
"Avitus",
"Frumentius",
"Charles the Bold",
"Babur",
"Bleda the Hun",
"Ahuitzotol",
"Giorgi the Brilliant",
"Ouali Keita",
]
`;
1 change: 1 addition & 0 deletions src/constants/GameVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum GameVersion {
DYNASTIES_OF_INDIA,
RETURN_OF_ROME,
THE_MOUNTAIN_ROYALS,
CHRONICLES_BATTLE_FOR_GREECE,
}

export default GameVersion;
3 changes: 3 additions & 0 deletions src/languages/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Römer",
"Armenians": "Armenier",
"Georgians": "Georgier",
"Achaemenids": "Achämeniden",
"Athenians": "Athener",
"Spartans": "Spartaner",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Romans",
"Armenians": "Armenians",
"Georgians": "Georgians",
"Achaemenids": "Achaemenids",
"Athenians": "Athenians",
"Spartans": "Spartans",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Romanos",
"Armenians": "Armenios",
"Georgians": "Georgianos",
"Achaemenids": "Aqueménidas",
"Athenians": "Atenienses",
"Spartans": "Espartanos",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Romains",
"Armenians": "Arméniens",
"Georgians": "Géorgiens",
"Achaemenids": "Achéménides",
"Athenians": "Athéniens",
"Spartans": "Spartiates",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Rzymianie",
"Armenians": "Ormianie",
"Georgians": "Gruzini",
"Achaemenids": "Achemenidzi",
"Athenians": "Ateńczycy",
"Spartans": "Spartanie",
"HIDDEN_PICK": "Ukryty Wybór",
"HIDDEN_BAN": "Ukryty Ban",
"HIDDEN_SNIPE": "Ukryty Odrzut",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "Romanos",
"Armenians": "Armênios",
"Georgians": "Georgianos",
"Achaemenids": "Aquemênidas",
"Athenians": "Atenienses",
"Spartans": "Espartanos",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "罗马",
"Armenians": "亚美尼亚",
"Georgians": "格鲁吉亚",
"Achaemenids": "阿契美尼德",
"Athenians": "雅典",
"Spartans": "斯巴达",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"Romans": "羅馬",
"Armenians": "亞美尼亞",
"Georgians": "喬治亞",
"Achaemenids": "阿契美尼",
"Athenians": "雅典",
"Spartans": "斯巴達",
"HIDDEN_PICK": "",
"HIDDEN_BAN": "",
"HIDDEN_SNIPE": "",
Expand Down
14 changes: 13 additions & 1 deletion src/models/Civilisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ enum Name {

ARMENIANS = "Armenians",
GEORGIANS = "Georgians",

ACHAEMENIDS = "Achaemenids",
ATHENIANS = "Athenians",
SPARTANS = "Spartans",
}

class Civilisation extends DraftOption {
Expand Down Expand Up @@ -119,6 +123,10 @@ class Civilisation extends DraftOption {
public static readonly ARMENIANS: Civilisation = new Civilisation(Name.ARMENIANS, GameVersion.THE_MOUNTAIN_ROYALS);
public static readonly GEORGIANS: Civilisation = new Civilisation(Name.GEORGIANS, GameVersion.THE_MOUNTAIN_ROYALS);

public static readonly ACHAEMENIDS: Civilisation = new Civilisation(Name.ACHAEMENIDS, GameVersion.CHRONICLES_BATTLE_FOR_GREECE);
public static readonly ATHENIANS: Civilisation = new Civilisation(Name.ATHENIANS, GameVersion.CHRONICLES_BATTLE_FOR_GREECE);
public static readonly SPARTANS: Civilisation = new Civilisation(Name.SPARTANS, GameVersion.CHRONICLES_BATTLE_FOR_GREECE);


// DO NOT CHANGE THE ORDER OF ELEMENTS IN THIS ARRAY!!!
// ONLY APPEND NEW CIVILISATIONS AT THE END!!!
Expand Down Expand Up @@ -169,9 +177,13 @@ class Civilisation extends DraftOption {
Civilisation.ROMANS,
Civilisation.ARMENIANS,
Civilisation.GEORGIANS,
Civilisation.ACHAEMENIDS,
Civilisation.ATHENIANS,
Civilisation.SPARTANS,
];

public static readonly ALL_ACTIVE = Civilisation.ALL.filter(value => value.name !== Name.INDIANS);
public static readonly ALL_ACTIVE = Civilisation.ALL.filter(value => value.name !== Name.INDIANS
&& value.gameVersion != GameVersion.CHRONICLES_BATTLE_FOR_GREECE);

public readonly gameVersion: GameVersion;

Expand Down
33 changes: 33 additions & 0 deletions src/util/NameGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,39 @@ class NameGenerator {
"Michael I",
"Alexander I",
"Constantine",
//Achaemenids
"Darius",
"Datis",
"Artaphernes",
"Cyrus",
"Cambyses",
"Xerxes",
"Artaxerxes",
"Mardonius",
"Boges",
"Tissaphernes",
//Athenians
"Themistocles",
"Aristides",
"Pericles",
"Miltiades",
"Cleon",
"Nicias",
"Cimon",
"Demosthenes",
"Thucydides",
"Iphicrates",
//Spartans
"Leonidas",
"Lysander",
"Brasidas",
"Pausanias",
"Agis",
"Gylippus",
"Archidamus",
"Cleomenes",
"Pleistoanax",
"Clearchus",
];

private seed: number;
Expand Down

0 comments on commit 05e8e6e

Please sign in to comment.