Skip to content

Instantly share code, notes, and snippets.

@cube-drone
Created August 31, 2021 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cube-drone/be3ae15e11122956a717082f2d150e1d to your computer and use it in GitHub Desktop.
Save cube-drone/be3ae15e11122956a717082f2d150e1d to your computer and use it in GitHub Desktop.
Behold The Secret Card Database
let cards = {
"card_zero": {
id: 'card_zero',
title: "Default Card",
description: `
This card was the first card ever created. Card zero.
The original card.
`,
rulesDescription: `
This card cannot be played, and so it won't do anything.
`,
images: [
"/static/images/playingcards/AD.png",
],
tags: new Set(['unplayable']),
},
"card_rest": {
id: 'card_rest',
title: "Rest",
description: `
You've been working awfully hard. Just give yourself a second to recoup.
`,
rulesDescription: `
Return all cards from your discard to your backpack.
`,
images: [
"https://dz2cdn1.dzone.com/storage/temp/12543479-pic-integration-restapitutorials.jpg",
],
tags: new Set([]),
playFn: game => {
// put the discard back into the backpack.
let discard = game.discard;
game.discard = [];
game.backpack = game.backpack.concat(discard);
return game;
}
},
"card_leaves": {
id: 'card_leaves',
title: "Leaves",
description: `
Eats shoots and leaves.
`,
rulesDescription: `
Leaves are a resource.
`,
expiry: 'day',
images: [
"https://images.unsplash.com/photo-1550147760-44c9966d6bc7?ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8bGVhZnxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&w=1000&q=80",
],
tags: new Set(['resource', 'unplayable']),
},
"card_wood": {
id: 'card_wood',
title: "Wood",
description: `
It's big, it's heavy, it's wood.
`,
rulesDescription: `
Wood is a resource.
`,
expiry: 'day',
images: [
"https://static.scientificamerican.com/blogs/cache/file/7468562B-7EBC-4D8A-B6820036ED274FA7_source.jpg?w=590&h=800&4866B8A3-9660-4D40-A221BEA24E521B1A",
],
tags: new Set(['resource', 'unplayable']),
},
"card_planks": {
id: 'card_planks',
title: "Planks",
description: `
This wood is flat and square, ideal for construction.
`,
rulesDescription: `
Planks are a resource.
`,
expiry: 'day',
images: [
"https://m.media-amazon.com/images/I/91Vx-TC3BtL._AC_SY450_.jpg",
],
tags: new Set(['resource', 'unplayable']),
},
"card_mill": {
id: 'card_mill',
title: "Mill",
description: `
With some effort, you can trim wood until it's a very fixed shape, which is good for building things.
`,
rulesDescription: `
Converts 1 wood from your backpack into 1 plank.
`,
expiry: 'day',
images: [
"https://cdn.popularwoodworking.com/wp-content/uploads/2021/01/lead-sawmill-4-84a9406.jpg",
],
tags: new Set(),
playFn: game => {
let idx = game.backpack.findIndex(card => card === "card_wood");
if(idx === -1){
return game;
}
game.backpack = game.backpack.splice(idx, 1);
game.backpack.push("card_planks");
return game;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment