From 6a849800ae9f178e7a7c152a062a5d8b374ec74c Mon Sep 17 00:00:00 2001 From: Rob Dennis Date: Sun, 24 Apr 2011 14:48:48 -0400 Subject: [PATCH] cornucopia fairgrounds implemented; tested for accurate unique card count --- card_list.js | 1 + dominion.js | 88 ++++++++++++++++++++++++++++++++++++++++++++++++--- manifest.json | 2 +- 3 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 card_list.js diff --git a/card_list.js b/card_list.js new file mode 100644 index 0000000..03771d5 --- /dev/null +++ b/card_list.js @@ -0,0 +1 @@ +var card_list = [{"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Adventurer", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "6", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Adventurers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Alchemist", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P3", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Alchemists"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Ambassador", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Ambassadors"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Apothecary", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P2", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Apothecaries"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Apprentice", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Apprentices"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Bag of Gold", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "*0", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Bag of Gold"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Bank", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "7", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Banks"}, {"Reaction": "0", "Coins": "4", "Duration": "0", "Singular": "Baron", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Barons"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Bazaar", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Bazaars"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Bishop", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Bishops"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Black Market", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Black Markets"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Bridge", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Bridges"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Bureaucrat", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Bureaucrats"}, {"Reaction": "0", "Coins": "0", "Duration": "1", "Singular": "Caravan", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Caravans"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Cellar", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Cellars"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Chancellor", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Chancellors"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Chapel", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "4", "Plural": "Chapels"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "City", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Cities"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Colony", "Treasure": "0", "Actions": "0", "VP": "10", "Action": "0", "Attack": "0", "Cost": "11", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Colonies"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Conspirator", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Conspirators"}, {"Reaction": "0", "Coins": "3", "Duration": "0", "Singular": "Contraband", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Contrabands"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Copper", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "0", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Coppers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Coppersmith", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Coppersmiths"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Council Room", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "4", "Trash": "0", "Plural": "Council Rooms"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Counting House", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Counting Houses"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Courtyard", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Courtyards"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Curse", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "0", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Curses"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Cutpurse", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Cutpurses"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Diadem", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "*0", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Diadem"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Duchy", "Treasure": "0", "Actions": "0", "VP": "5", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Duchies"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Duke", "Treasure": "0", "Actions": "0", "VP": "?", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Dukes"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Embargo", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Embargoes"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Envoy", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "4", "Trash": "0", "Plural": "Envoys"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Estate", "Treasure": "0", "Actions": "0", "VP": "1", "Action": "0", "Attack": "0", "Cost": "2", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Estates"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Expand", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "7", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Expands"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Explorer", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Explorers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Fairgrounds", "Treasure": "0", "Actions": "0", "VP": "1", "Action": "0", "Attack": "0", "Cost": "6", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Fairgrounds"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Familiar", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "1", "Cost": "P3", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Familiars"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Farming Village", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Farming Villages"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Feast", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Feasts"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Festival", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Festivals"}, {"Reaction": "0", "Coins": "1", "Duration": "1", "Singular": "Fishing Village", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Fishing Villages"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Followers", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "*0", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Followers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Forge", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "7", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "99", "Plural": "Forges"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Fortune Teller", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Fortune Tellers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Gardens", "Treasure": "0", "Actions": "0", "VP": "?", "Action": "0", "Attack": "0", "Cost": "4", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Gardens"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Ghost Ship", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Ghost Ships"}, {"Reaction": "0", "Coins": "3", "Duration": "0", "Singular": "Gold", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "6", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Golds"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Golem", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Golems"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Goons", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "6", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Goons"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Grand Market", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "6", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Grand Markets"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Great Hall", "Treasure": "0", "Actions": "1", "VP": "1", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "1", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Great Halls"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Hamlet", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Hamlets"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Harem", "Treasure": "1", "Actions": "0", "VP": "2", "Action": "0", "Attack": "0", "Cost": "6", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Harems"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Harvest", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Harvests"}, {"Reaction": "0", "Coins": "0", "Duration": "1", "Singular": "Haven", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Havens"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Herbalist", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Herbalists"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Hoard", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "6", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Hoards"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Horn of Plenty", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Horns of Plenty"}, {"Reaction": "1", "Coins": "3", "Duration": "0", "Singular": "Horse Traders", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "1", "Cards": "-2", "Trash": "0", "Plural": "Horse Traders"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Hunting Party", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Hunting Parties"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Ironworks", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Ironworks"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Island", "Treasure": "0", "Actions": "0", "VP": "2", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Islands"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Jester", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Jesters"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "King's Court", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "7", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "King's Courts"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Laboratory", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Laboratories"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Library", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "3", "Trash": "0", "Plural": "Libraries"}, {"Reaction": "1", "Coins": "1", "Duration": "1", "Singular": "Lighthouse", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Lighthouses"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Loan", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Loans"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Lookout", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Lookouts"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Market", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Markets"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Masquerade", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "1", "Plural": "Masquerades"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Menagerie", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "", "Cards": "3", "Trash": "0", "Plural": "Menageries"}, {"Reaction": "0", "Coins": "2", "Duration": "1", "Singular": "Merchant Ship", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Merchant Ships"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Militia", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Militias"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Mine", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Mines"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Mining Village", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "1", "Plural": "Mining Villages"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Minion", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Minions"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Mint", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "?", "Plural": "Mints"}, {"Reaction": "1", "Coins": "0", "Duration": "0", "Singular": "Moat", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Moats"}, {"Reaction": "0", "Coins": "3", "Duration": "0", "Singular": "Moneylender", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Moneylenders"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Monument", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Monuments"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Mountebank", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Mountebanks"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Native Village", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Native Villages"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Navigator", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Navigators"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Nobles", "Treasure": "0", "Actions": "2", "VP": "2", "Action": "1", "Attack": "0", "Cost": "6", "Victory": "1", "Buys": "0", "Cards": "3", "Trash": "0", "Plural": "Nobles"}, {"Reaction": "0", "Coins": "0", "Duration": "1", "Singular": "Outpost", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Outposts"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Pawn", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Pawns"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Pearl Diver", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Pearl Divers"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Peddler", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "8", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Peddlers"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Philosopher's Stone", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "P3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Philosopher's Stones"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Pirate Ship", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Pirate Ships"}, {"Reaction": "0", "Coins": "5", "Duration": "0", "Singular": "Platinum", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "9", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Platinums"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Possession", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P6", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Possessions"}, {"Reaction": "0", "Coins": "P", "Duration": "0", "Singular": "Potion", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Potions"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Princess", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "*0", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Princess"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Province", "Treasure": "0", "Actions": "0", "VP": "6", "Action": "0", "Attack": "0", "Cost": "8", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Provinces"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Quarry", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Quarries"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Rabble", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "3", "Trash": "0", "Plural": "Rabbles"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Remake", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Remakes"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Remodel", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Remodels"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Royal Seal", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Royal Seals"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Saboteur", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Saboteurs"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Salvager", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "1", "Plural": "Salvagers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Scout", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Scouts"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Scrying Pool", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "1", "Cost": "P2", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Scrying Pools"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Sea Hag", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Sea Hags"}, {"Reaction": "1", "Coins": "?", "Duration": "0", "Singular": "Secret Chamber", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Secret Chambers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Shanty Town", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Shanty Towns"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Silver", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Silvers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Smithy", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "3", "Trash": "0", "Plural": "Smithies"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Smugglers", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Smugglers"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Spy", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Spies"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Stash", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Stashes"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Steward", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "2", "Plural": "Stewards"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Swindler", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Swindlers"}, {"Reaction": "0", "Coins": "0", "Duration": "1", "Singular": "Tactician", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Tacticians"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Talisman", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Talismans"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Thief", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Thieves"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Throne Room", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Throne Rooms"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Torturer", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "3", "Trash": "0", "Plural": "Torturers"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Tournament", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Tournaments"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Trade Route", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "1", "Plural": "Trade Routes"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Trading Post", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "2", "Plural": "Trading Posts"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Transmute", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "1", "Plural": "Transmutes"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Treasure Map", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "2", "Plural": "Treasure Maps"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Treasury", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Treasuries"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Tribute", "Treasure": "0", "Actions": "?", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "?", "Trash": "0", "Plural": "Tributes"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Trusty Steed", "Treasure": "2", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "*0", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Trusty Steed"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "University", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "P2", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Universities"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Upgrade", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "1", "Plural": "Upgrades"}, {"Reaction": "0", "Coins": "?", "Duration": "0", "Singular": "Vault", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Vaults"}, {"Reaction": "0", "Coins": "1", "Duration": "0", "Singular": "Venture", "Treasure": "1", "Actions": "0", "VP": "0", "Action": "0", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Ventures"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Village", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Villages"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Vineyard", "Treasure": "0", "Actions": "0", "VP": "?", "Action": "0", "Attack": "0", "Cost": "P", "Victory": "1", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Vineyards"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Warehouse", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Warehouses"}, {"Reaction": "1", "Coins": "0", "Duration": "0", "Singular": "Watchtower", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Watchtowers"}, {"Reaction": "0", "Coins": "0", "Duration": "1", "Singular": "Wharf", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "5", "Victory": "0", "Buys": "1", "Cards": "2", "Trash": "0", "Plural": "Wharves"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Wishing Well", "Treasure": "0", "Actions": "1", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "1", "Trash": "0", "Plural": "Wishing Wells"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Witch", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "1", "Cost": "5", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Witches"}, {"Reaction": "0", "Coins": "2", "Duration": "0", "Singular": "Woodcutter", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "1", "Cards": "0", "Trash": "0", "Plural": "Woodcutters"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Worker's Village", "Treasure": "0", "Actions": "2", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "1", "Cards": "1", "Trash": "0", "Plural": "Worker's Villages"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Workshop", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "3", "Victory": "0", "Buys": "0", "Cards": "0", "Trash": "0", "Plural": "Workshops"}, {"Reaction": "0", "Coins": "0", "Duration": "0", "Singular": "Young Witch", "Treasure": "0", "Actions": "0", "VP": "0", "Action": "1", "Attack": "0", "Cost": "4", "Victory": "0", "Buys": "0", "Cards": "2", "Trash": "0", "Plural": "Young Witches"}]; diff --git a/dominion.js b/dominion.js index a9560e3..0a142b5 100644 --- a/dominion.js +++ b/dominion.js @@ -19,6 +19,7 @@ var i_introduced = false; var disabled = false; var had_error = false; var show_action_count = false; +var show_unique_count = false; var possessed_turn = false; var turn_number = 0; var announced_error = false; @@ -39,6 +40,11 @@ RegExp.quote = function(str) { return str.replace(/([.?*+^$[\]\\(){}-])/g, "\\$1"); }; +var plural_map = {}; +for (var card_info in card_list) { + plural_map[card_list[card_info]['Plural']] = card_list[card_info]['Singular']; +} + function debugString(thing) { return JSON.stringify(thing); } @@ -111,7 +117,8 @@ function Player(name) { // Map from special counts (such as number of gardens) to count. // TODO(drheld): Should we just track all cards? - this.special_counts = { "Treasure" : 7, "Victory" : 3 } + this.special_counts = { "Treasure" : 7, "Victory" : 3, "Uniques" : 2 }; + this.card_counts = { "Copper" : 7, "Estate" : 3 }; this.getScore = function() { var score_str = this.score; @@ -143,6 +150,16 @@ function Player(name) { score_str = score_str + "+" + vineyards + "v@" + vineyard_points; total_score = total_score + vineyards * vineyard_points; } + + if (this.special_counts["Fairgrounds"] != undefined) { + var fairgrounds = this.special_counts["Fairgrounds"]; + var fairgrounds_points = 0; + if (this.special_counts["Uniques"] != undefined) { + fairgrounds_points = Math.floor(this.special_counts["Uniques"] / 5) * 2; + } + score_str = score_str + "+" + fairgrounds + "f@" + fairgrounds_points; + total_score = total_score + fairgrounds * fairgrounds_points; + } if (total_score != this.score) { score_str = score_str + "=" + total_score; @@ -152,8 +169,27 @@ function Player(name) { this.getDeckString = function() { var str = this.deck_size; - if (show_action_count && this.special_counts["Actions"]) { - str += "(" + this.special_counts["Actions"] + "a)"; + var need_action_string = (show_action_count && this.special_counts["Actions"]); + var need_unique_string = (show_unique_count && this.special_counts["Uniques"]); + if (need_action_string || need_unique_string) { + str += "("; + + var special_types = []; + if (need_unique_string) { + special_types.push(this.special_counts["Uniques"] + "u"); + } + + if (need_action_string) { + special_types.push(this.special_counts["Actions"] + "a"); + } + + if (special_types.length == 1) { + str += special_types[0]; + } else { + str += special_types.join(", "); + } + + str += ")"; } return str; } @@ -168,6 +204,25 @@ function Player(name) { } this.special_counts[name] = this.special_counts[name] + delta; } + + this.recordUniqueCards = function(name, count) { + + if (this.card_counts[name] == undefined || this.card_counts[name] == 0) { + this.card_counts[name] = count; + this.special_counts["Uniques"] += 1; + } else { + this.card_counts[name] += count; + } + + if (this.card_counts[name] <= 0) { + if (this.card_counts[name] < 0) { + handleError("Card count for " + name + " is negative (" + this.card_counts[name] + ")"); + } + delete this.card_counts[name]; + this.special_counts["Uniques"] -= 1; + } + + } this.recordSpecialCards = function(card, count) { var name = card.innerHTML; @@ -183,8 +238,13 @@ function Player(name) { if (name.indexOf("Vineyard") == 0) { this.changeSpecialCount("Vineyard", count); } - + + if (name.indexOf("Fairgrounds") == 0) { + this.changeSpecialCount("Fairgrounds", count); + } + var types = card.className.split("-").slice(1); + for (type_i in types) { var type = types[type_i]; if (type == "none" || type == "duration" || @@ -209,8 +269,21 @@ function Player(name) { last_gain_player = this; count = parseInt(count); this.deck_size = this.deck_size + count; - this.changeScore(pointsForCard(card.innerText) * count); + + var singular_card_name = getSingularCardName(card.innerText); + this.changeScore(pointsForCard(singular_card_name) * count); this.recordSpecialCards(card, count); + this.recordUniqueCards(singular_card_name, count); + } +} + +function getSingularCardName(name) { + if (plural_map[name] == undefined) { + //assume it's singular already + return name; + } else { + //return the singular value for the given pluralized card name + return plural_map[name] } } @@ -548,6 +621,7 @@ function initialize(doc) { disabled = false; had_error = false; show_action_count = false; + show_unique_count = false; possessed_turn = false; turn_number = 0; announced_error = false; @@ -727,6 +801,10 @@ function handle(doc) { for (var elem in elems) { if (elems[elem].innerText == "Vineyard") show_action_count = true; } + + for (var elem in elems) { + if (elems[elem].innerText == "Fairgrounds") show_unique_count = true; + } } if (doc.constructor == HTMLElement && doc.parentNode.id == "log" && diff --git a/manifest.json b/manifest.json index ed858d4..f2e46e3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "content_scripts": [ { - "js": [ "jquery.js", "dominion.js" ], + "js": [ "jquery.js", "card_list.js", "dominion.js" ], "matches": [ "http://dominion.isotropic.org/play" ] }, {