From 5c621c9394fec816cb667706772ee702dcf2f814 Mon Sep 17 00:00:00 2001 From: Kenneth Allen Date: Fri, 22 Oct 2021 19:39:12 +1100 Subject: [PATCH] Add wonder data --- packages/wonders-common/src/basic.ts | 2 +- packages/wonders-common/src/structure.ts | 21 +++-- packages/wonders-common/src/wonder.ts | 101 +++++++++++++++++++---- 3 files changed, 101 insertions(+), 23 deletions(-) diff --git a/packages/wonders-common/src/basic.ts b/packages/wonders-common/src/basic.ts index f79fbbc..cee7b51 100644 --- a/packages/wonders-common/src/basic.ts +++ b/packages/wonders-common/src/basic.ts @@ -15,7 +15,7 @@ export type Science = 'engineering' | 'research' | 'education' export const sciences: Science[] = ['engineering', 'research', 'education'] export interface TurnPlan { - action: 'structure' | 'discard' + action: 'structure' | 'discard' | 'wonder' cardIdx: number goldLeft: number goldRight: number diff --git a/packages/wonders-common/src/structure.ts b/packages/wonders-common/src/structure.ts index 688faee..252376f 100644 --- a/packages/wonders-common/src/structure.ts +++ b/packages/wonders-common/src/structure.ts @@ -5,14 +5,8 @@ export const structureTypes: StructureType[] = ['commerce', 'culture', 'science' export type Countable = StructureType | 'wonder stage' | 'defeat' -export interface Structure { - type: StructureType - name: string - appears?: (undefined | (3 | 4 | 5 | 6 | 7)[])[] - +export interface Project { cost?: Map - freeWith?: string[] - paysFor?: string[] gold?: number goldPer?: Map @@ -28,6 +22,19 @@ export interface Structure { direction: ('left' | 'right')[] amount: number }[] + playBothOnLastTurn?: boolean + buildDiscardedNow?: boolean + copyNeighboringGuild?: boolean + ignoreCostOncePerAge?: boolean +} + +export interface Structure extends Project { + type: StructureType + name: string + appears?: (undefined | (3 | 4 | 5 | 6 | 7)[])[] + + freeWith?: string[] + paysFor?: string[] } export const structuresByAge: Structure[][] = [ diff --git a/packages/wonders-common/src/wonder.ts b/packages/wonders-common/src/wonder.ts index ec7f2ad..0a861d6 100644 --- a/packages/wonders-common/src/wonder.ts +++ b/packages/wonders-common/src/wonder.ts @@ -1,54 +1,125 @@ import { Resource } from "./basic" +import { Project } from "./structure" export interface Wonder { name: string innateResource: Resource - //stages: Structure[] + stages: Project[] } const wonderList: Wonder[] = [ { name: 'Great Pyramid of Giza A', - innateResource: 'stone' + innateResource: 'stone', + stages: [ + { cost: new Map([['stone', 2]]), points: 3 }, + { cost: new Map([['wood', 3]]), points: 5 }, + { cost: new Map([['stone', 4]]), points: 7 }, + ], }, { name: 'Great Pyramid of Giza B', - innateResource: 'stone' + innateResource: 'stone', + stages: [ + { cost: new Map([['wood', 2]]), points: 3 }, + { cost: new Map([['stone', 3]]), points: 5 }, + { cost: new Map([['brick', 3]]), points: 5 }, + { cost: new Map([['paper', 1], ['stone', 4]]), points: 7 }, + ], }, { name: 'Hanging Gardens of Babylon A', - innateResource: 'brick' + innateResource: 'brick', + stages: [ + { cost: new Map([['brick', 2]]), points: 3 }, + { cost: new Map([['wood', 3]]), sciences: new Set(['engineering', 'research', 'education']) }, + { cost: new Map([['brick', 4]]), points: 7 }, + ], }, { name: 'Hanging Gardens of Babylon B', - innateResource: 'brick' + innateResource: 'brick', + stages: [ + { cost: new Map([['cloth', 1], ['brick', 1]]), points: 3 }, + { cost: new Map([['glass', 1], ['wood', 2]]), playBothOnLastTurn: true }, + { cost: new Map([['paper', 1], ['brick', 3]]), sciences: new Set(['engineering', 'research', 'education']) }, + ], }, { name: 'Temple of Artemis at Ephesus A', - innateResource: 'paper' + innateResource: 'paper', + stages: [ + { cost: new Map([['stone', 2]]), points: 3 }, + { cost: new Map([['wood', 2]]), gold: 9 }, + { cost: new Map([['paper', 2]]), points: 7 }, + ], }, { name: 'Temple of Artemis at Ephesus B', - innateResource: 'paper' + innateResource: 'paper', + stages: [ + { cost: new Map([['stone', 2]]), points: 2, gold: 4 }, + { cost: new Map([['wood', 2]]), points: 3, gold: 4 }, + { cost: new Map([['paper', 1], ['cloth', 1], ['glass', 1]]), points: 5, gold: 4 }, + ], }, { name: 'Statue of Zeus at Olympia A', - innateResource: 'wood' + innateResource: 'wood', + stages: [ + { cost: new Map([['wood', 2]]), points: 3 }, + { cost: new Map([['stone', 2]]), ignoreCostOncePerAge: true }, + { cost: new Map([['ore', 2]]), points: 7 }, + ], }, { name: 'Statue of Zeus at Olympia B', - innateResource: 'wood' + innateResource: 'wood', + stages: [ + { cost: new Map([['wood', 2]]), discountTrade: [{ resourceType: 'basic', direction: ['left', 'right'], amount: 1 }] }, + { cost: new Map([['stone', 2]]), points: 5 }, + { cost: new Map([['cloth', 1], ['ore', 2]]), copyNeighboringGuild: true }, + ], }, { name: 'Mausoleum at Halicarnassus A', - innateResource: 'cloth' + innateResource: 'cloth', + stages: [ + { cost: new Map([['brick', 2]]), points: 3 }, + { cost: new Map([['ore', 3]]), buildDiscardedNow: true }, + { cost: new Map([['cloth', 2]]), points: 7 }, + ], }, { name: 'Mausoleum at Halicarnassus B', - innateResource: 'cloth' + innateResource: 'cloth', + stages: [ + { cost: new Map([['ore', 2]]), points: 2, buildDiscardedNow: true }, + { cost: new Map([['brick', 3]]), points: 1, buildDiscardedNow: true }, + { cost: new Map([['paper', 1], ['cloth', 1], ['glass', 1]]), buildDiscardedNow: true }, + ], }, { name: 'Colossus of Rhodes A', - innateResource: 'ore' + innateResource: 'ore', + stages: [ + { cost: new Map([['wood', 2]]), points: 3 }, + { cost: new Map([['brick', 3]]), shields: 2 }, + { cost: new Map([['ore', 4]]), points: 7 }, + ], }, { name: 'Colossus of Rhodes B', - innateResource: 'ore' + innateResource: 'ore', + stages: [ + { cost: new Map([['stone', 3]]), shields: 1, points: 3, gold: 3 }, + { cost: new Map([['ore', 4]]), shields: 1, points: 4, gold: 4 }, + ], }, { name: 'Lighthouse of Alexandria A', - innateResource: 'glass' + innateResource: 'glass', + stages: [ + { cost: new Map([['stone', 2]]), points: 3 }, + { cost: new Map([['ore', 2]]), resources: new Map([['brick', 1], ['ore', 1], ['wood', 1], ['stone', 1]]) }, + { cost: new Map([['glass', 2]]), points: 7 }, + ], }, { name: 'Lighthouse of Alexandria B', - innateResource: 'glass' + innateResource: 'glass', + stages: [ + { cost: new Map([['brick', 2]]), resources: new Map([['brick', 1], ['ore', 1], ['wood', 1], ['stone', 1]]) }, + { cost: new Map([['wood', 2]]), resources: new Map([['glass', 1], ['cloth', 1], ['paper', 1]]) }, + { cost: new Map([['stone', 3]]), points: 7 }, + ], }, ] export const wonders = new Map(wonderList.map(w => [w.name, w]))